Index: Source/core/inspector/PageRuntimeAgent.cpp |
diff --git a/Source/core/inspector/PageRuntimeAgent.cpp b/Source/core/inspector/PageRuntimeAgent.cpp |
index c6e81e5e446df4a218d40de6f29b1fc639d78474..23a69c2262ed1000f81f5efc233c3158242aed6d 100644 |
--- a/Source/core/inspector/PageRuntimeAgent.cpp |
+++ b/Source/core/inspector/PageRuntimeAgent.cpp |
@@ -31,6 +31,7 @@ |
#include "config.h" |
#include "core/inspector/PageRuntimeAgent.h" |
+#include "bindings/dart/DartController.h" |
#include "bindings/v8/DOMWrapperWorld.h" |
#include "bindings/v8/ScriptController.h" |
#include "core/inspector/InjectedScript.h" |
@@ -168,6 +169,8 @@ void PageRuntimeAgent::reportExecutionContextCreation() |
ScriptState* scriptState = mainWorldScriptState(frame); |
notifyContextCreated(frameId, scriptState, 0, true); |
+ notifyDartContextCreated(frameId, scriptState); |
+ |
frame->script()->collectIsolatedContexts(isolatedContexts); |
if (isolatedContexts.isEmpty()) |
continue; |
@@ -177,11 +180,27 @@ void PageRuntimeAgent::reportExecutionContextCreation() |
} |
} |
+void PageRuntimeAgent::notifyDartContextCreated(const String& frameId, ScriptState* v8ScriptState) |
+{ |
+ ScriptExecutionContext* scriptExecutionContext = v8ScriptState->scriptExecutionContext(); |
+ DartController* dartController = DartController::retrieve(scriptExecutionContext); |
+ if (dartController) { |
+ Vector<ScriptState*> scriptStates; |
+ dartController->collectScriptStates(v8ScriptState, scriptStates); |
+ for (size_t i = 0; i< scriptStates.size(); i++) |
+ notifyContextCreated(frameId, scriptStates[i], 0, false); |
+ } |
+} |
+ |
void PageRuntimeAgent::notifyContextCreated(const String& frameId, ScriptState* scriptState, SecurityOrigin* securityOrigin, bool isPageContext) |
{ |
- ASSERT(securityOrigin || isPageContext); |
+ // FIXME(dartbug.com/13801): remove the check for |
+ // !scriptState->isJavaScript() once Dart scripts have correct security |
+ // origins. |
+ ASSERT(securityOrigin || isPageContext || !scriptState->isJavaScript()); |
int executionContextId = injectedScriptManager()->injectedScriptIdFor(scriptState); |
- String name = securityOrigin ? securityOrigin->toRawString() : ""; |
+ String name = scriptState->name() ? *scriptState->name() : (securityOrigin ? securityOrigin->toRawString() : ""); |
+ |
m_frontend->executionContextCreated(ExecutionContextDescription::create() |
.setId(executionContextId) |
.setIsPageContext(isPageContext) |