| Index: third_party/WebKit/Source/core/inspector/PageRuntimeAgent.cpp
|
| diff --git a/third_party/WebKit/Source/core/inspector/PageRuntimeAgent.cpp b/third_party/WebKit/Source/core/inspector/PageRuntimeAgent.cpp
|
| index 651902ee1b7cf4751787b1ce032738d35b0b3b3c..c9b25d1a4fe3265faae5c59d33ce2bc8f51bb2a2 100644
|
| --- a/third_party/WebKit/Source/core/inspector/PageRuntimeAgent.cpp
|
| +++ b/third_party/WebKit/Source/core/inspector/PageRuntimeAgent.cpp
|
| @@ -49,6 +49,7 @@ namespace blink {
|
| PageRuntimeAgent::PageRuntimeAgent(Client* client, V8Debugger* debugger, InspectedFrames* inspectedFrames)
|
| : InspectorRuntimeAgent(debugger, client)
|
| , m_inspectedFrames(inspectedFrames)
|
| + , m_mainWorldContextCreated(false)
|
| {
|
| }
|
|
|
| @@ -65,26 +66,35 @@ DEFINE_TRACE(PageRuntimeAgent)
|
| InspectorRuntimeAgent::trace(visitor);
|
| }
|
|
|
| +void PageRuntimeAgent::init()
|
| +{
|
| + InspectorRuntimeAgent::init();
|
| + m_instrumentingAgents->setPageRuntimeAgent(this);
|
| +}
|
| +
|
| void PageRuntimeAgent::enable(ErrorString* errorString)
|
| {
|
| if (m_enabled)
|
| return;
|
|
|
| InspectorRuntimeAgent::enable(errorString);
|
| - m_instrumentingAgents->setPageRuntimeAgent(this);
|
| }
|
|
|
| void PageRuntimeAgent::disable(ErrorString* errorString)
|
| {
|
| if (!m_enabled)
|
| return;
|
| - m_instrumentingAgents->setPageRuntimeAgent(nullptr);
|
| InspectorRuntimeAgent::disable(errorString);
|
| }
|
|
|
| void PageRuntimeAgent::didClearDocumentOfWindowObject(LocalFrame* frame)
|
| {
|
| + m_mainWorldContextCreated = true;
|
| +
|
| + if (!m_enabled)
|
| + return;
|
| ASSERT(frontend());
|
| +
|
| if (frame == m_inspectedFrames->root())
|
| m_v8RuntimeAgent->clearInspectedObjects();
|
| frame->script().initializeMainWorld();
|
| @@ -92,6 +102,8 @@ void PageRuntimeAgent::didClearDocumentOfWindowObject(LocalFrame* frame)
|
|
|
| void PageRuntimeAgent::didCreateScriptContext(LocalFrame* frame, ScriptState* scriptState, SecurityOrigin* origin, int worldId)
|
| {
|
| + if (!m_enabled)
|
| + return;
|
| ASSERT(frontend());
|
| bool isMainWorld = worldId == MainWorldId;
|
| String originString = origin ? origin->toRawString() : "";
|
| @@ -126,7 +138,7 @@ void PageRuntimeAgent::reportExecutionContexts()
|
| // 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_client->didCommitLoadFired())
|
| + if (!m_mainWorldContextCreated)
|
| return;
|
|
|
| Vector<std::pair<ScriptState*, SecurityOrigin*>> isolatedContexts;
|
|
|