Title: [120822] trunk/Source/WebCore
Revision
120822
Author
[email protected]
Date
2012-06-20 08:07:28 -0700 (Wed, 20 Jun 2012)

Log Message

Web Inspector: don't report context ids before DidCommitLoad
https://bugs.webkit.org/show_bug.cgi?id=89567

Reviewed by Pavel Feldman.

When inspector state is restored only report existing context ids
if "did commit load" even has already been dispatched.

* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController):
* inspector/PageRuntimeAgent.cpp:
(WebCore::PageRuntimeAgent::PageRuntimeAgent):
(WebCore::PageRuntimeAgent::restore):
* inspector/PageRuntimeAgent.h:
(WebCore):
(WebCore::PageRuntimeAgent::create):
(PageRuntimeAgent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (120821 => 120822)


--- trunk/Source/WebCore/ChangeLog	2012-06-20 15:03:23 UTC (rev 120821)
+++ trunk/Source/WebCore/ChangeLog	2012-06-20 15:07:28 UTC (rev 120822)
@@ -1,3 +1,23 @@
+2012-06-20  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: don't report context ids before DidCommitLoad
+        https://bugs.webkit.org/show_bug.cgi?id=89567
+
+        Reviewed by Pavel Feldman.
+
+        When inspector state is restored only report existing context ids
+        if "did commit load" even has already been dispatched.
+
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::InspectorController):
+        * inspector/PageRuntimeAgent.cpp:
+        (WebCore::PageRuntimeAgent::PageRuntimeAgent):
+        (WebCore::PageRuntimeAgent::restore):
+        * inspector/PageRuntimeAgent.h:
+        (WebCore):
+        (WebCore::PageRuntimeAgent::create):
+        (PageRuntimeAgent):
+
 2012-06-20  Zeev Lieber  <[email protected]>
 
         [Chromium] Remove redundant #includes in compositor

Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (120821 => 120822)


--- trunk/Source/WebCore/inspector/InspectorController.cpp	2012-06-20 15:03:23 UTC (rev 120821)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp	2012-06-20 15:07:28 UTC (rev 120822)
@@ -121,7 +121,7 @@
     m_resourceAgent = resourceAgentPtr.get();
     m_agents.append(resourceAgentPtr.release());
 
-    OwnPtr<InspectorRuntimeAgent> runtimeAgentPtr(PageRuntimeAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get(), page, pageAgent));
+    OwnPtr<InspectorRuntimeAgent> runtimeAgentPtr(PageRuntimeAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get(), page, pageAgent, m_inspectorAgent));
     InspectorRuntimeAgent* runtimeAgent = runtimeAgentPtr.get();
     m_agents.append(runtimeAgentPtr.release());
 

Modified: trunk/Source/WebCore/inspector/PageRuntimeAgent.cpp (120821 => 120822)


--- trunk/Source/WebCore/inspector/PageRuntimeAgent.cpp	2012-06-20 15:03:23 UTC (rev 120821)
+++ trunk/Source/WebCore/inspector/PageRuntimeAgent.cpp	2012-06-20 15:07:28 UTC (rev 120822)
@@ -38,6 +38,7 @@
 #include "Document.h"
 #include "InjectedScript.h"
 #include "InjectedScriptManager.h"
+#include "InspectorAgent.h"
 #include "InspectorPageAgent.h"
 #include "InspectorState.h"
 #include "InstrumentingAgents.h"
@@ -52,10 +53,11 @@
 static const char reportExecutionContextCreation[] = "reportExecutionContextCreation";
 };
 
-PageRuntimeAgent::PageRuntimeAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, InjectedScriptManager* injectedScriptManager, Page* page, InspectorPageAgent* pageAgent)
+PageRuntimeAgent::PageRuntimeAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, InjectedScriptManager* injectedScriptManager, Page* page, InspectorPageAgent* pageAgent, InspectorAgent* inspectorAgent)
     : InspectorRuntimeAgent(instrumentingAgents, state, injectedScriptManager)
     , m_inspectedPage(page)
     , m_pageAgent(pageAgent)
+    , m_inspectorAgent(inspectorAgent)
     , m_frontend(0)
 {
 }
@@ -81,8 +83,13 @@
 {
     if (!m_state->getBoolean(PageRuntimeAgentState::reportExecutionContextCreation))
         return;
-    String error;
-    setReportExecutionContextCreation(&error, true);
+    // Only report existing contexts if the page did commit load, otherwise we may
+    // unintentionally initialize contexts in the frames which may trigger some listeners
+    // that are expected to be triggered only after the load is committed, see http://crbug.com/131623
+    if (m_inspectorAgent->didCommitLoadFired()) {
+        String error;
+        setReportExecutionContextCreation(&error, true);
+    }
 }
 
 void PageRuntimeAgent::setReportExecutionContextCreation(ErrorString*, bool enable)

Modified: trunk/Source/WebCore/inspector/PageRuntimeAgent.h (120821 => 120822)


--- trunk/Source/WebCore/inspector/PageRuntimeAgent.h	2012-06-20 15:03:23 UTC (rev 120821)
+++ trunk/Source/WebCore/inspector/PageRuntimeAgent.h	2012-06-20 15:07:28 UTC (rev 120822)
@@ -40,15 +40,16 @@
 
 namespace WebCore {
 
+class InspectorAgent;
 class InspectorPageAgent;
 class Page;
 class SecurityOrigin;
 
 class PageRuntimeAgent : public InspectorRuntimeAgent {
 public:
-    static PassOwnPtr<PageRuntimeAgent> create(InstrumentingAgents* instrumentingAgents, InspectorState* state, InjectedScriptManager* injectedScriptManager, Page* page, InspectorPageAgent* pageAgent)
+    static PassOwnPtr<PageRuntimeAgent> create(InstrumentingAgents* instrumentingAgents, InspectorState* state, InjectedScriptManager* injectedScriptManager, Page* page, InspectorPageAgent* pageAgent, InspectorAgent* inspectorAgent)
     {
-        return adoptPtr(new PageRuntimeAgent(instrumentingAgents, state, injectedScriptManager, page, pageAgent));
+        return adoptPtr(new PageRuntimeAgent(instrumentingAgents, state, injectedScriptManager, page, pageAgent, inspectorAgent));
     }
     virtual ~PageRuntimeAgent();
     virtual void setFrontend(InspectorFrontend*);
@@ -60,7 +61,7 @@
     void didCreateIsolatedContext(Frame*, ScriptState*, SecurityOrigin*);
 
 private:
-    PageRuntimeAgent(InstrumentingAgents*, InspectorState*, InjectedScriptManager*, Page*, InspectorPageAgent*);
+    PageRuntimeAgent(InstrumentingAgents*, InspectorState*, InjectedScriptManager*, Page*, InspectorPageAgent*, InspectorAgent*);
 
     virtual InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId);
     virtual void muteConsole();
@@ -69,6 +70,7 @@
 
     Page* m_inspectedPage;
     InspectorPageAgent* m_pageAgent;
+    InspectorAgent* m_inspectorAgent;
     InspectorFrontend::Runtime* m_frontend;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to