Title: [122762] branches/chromium/1180/Source/WebCore/inspector
Revision
122762
Author
mih...@chromium.org
Date
2012-07-16 14:11:20 -0700 (Mon, 16 Jul 2012)

Log Message

Merge 120822 - 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):

TBR=yu...@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10779021

Modified Paths

Diff

Modified: branches/chromium/1180/Source/WebCore/inspector/InspectorController.cpp (122761 => 122762)


--- branches/chromium/1180/Source/WebCore/inspector/InspectorController.cpp	2012-07-16 21:06:54 UTC (rev 122761)
+++ branches/chromium/1180/Source/WebCore/inspector/InspectorController.cpp	2012-07-16 21:11:20 UTC (rev 122762)
@@ -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: branches/chromium/1180/Source/WebCore/inspector/PageRuntimeAgent.cpp (122761 => 122762)


--- branches/chromium/1180/Source/WebCore/inspector/PageRuntimeAgent.cpp	2012-07-16 21:06:54 UTC (rev 122761)
+++ branches/chromium/1180/Source/WebCore/inspector/PageRuntimeAgent.cpp	2012-07-16 21:11:20 UTC (rev 122762)
@@ -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: branches/chromium/1180/Source/WebCore/inspector/PageRuntimeAgent.h (122761 => 122762)


--- branches/chromium/1180/Source/WebCore/inspector/PageRuntimeAgent.h	2012-07-16 21:06:54 UTC (rev 122761)
+++ branches/chromium/1180/Source/WebCore/inspector/PageRuntimeAgent.h	2012-07-16 21:11:20 UTC (rev 122762)
@@ -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
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to