Index: third_party/WebKit/Source/core/inspector/InjectedScriptManager.cpp |
diff --git a/third_party/WebKit/Source/core/inspector/InjectedScriptManager.cpp b/third_party/WebKit/Source/core/inspector/InjectedScriptManager.cpp |
index aadc8d4e09f8a9d0a5caf027fef6de9c39fa9e54..edd4f85dc79299ff58e1f7510eb067cafc7eba4a 100644 |
--- a/third_party/WebKit/Source/core/inspector/InjectedScriptManager.cpp |
+++ b/third_party/WebKit/Source/core/inspector/InjectedScriptManager.cpp |
@@ -30,7 +30,6 @@ |
#include "core/inspector/InjectedScriptManager.h" |
-#include "bindings/core/v8/ScriptValue.h" |
#include "core/inspector/InjectedScript.h" |
#include "core/inspector/InjectedScriptHost.h" |
#include "core/inspector/InjectedScriptNative.h" |
@@ -91,10 +90,15 @@ void InjectedScriptManager::discardInjectedScripts() |
int InjectedScriptManager::discardInjectedScriptFor(v8::Local<v8::Context> context) |
{ |
int contextId = V8Debugger::contextId(context); |
- m_idToInjectedScript.remove(contextId); |
+ discardInjectedScript(contextId); |
return contextId; |
} |
+void InjectedScriptManager::discardInjectedScript(int contextId) |
+{ |
+ m_idToInjectedScript.remove(contextId); |
+} |
+ |
void InjectedScriptManager::releaseObjectGroup(const String& objectGroup) |
{ |
Vector<int> keys; |
@@ -130,12 +134,13 @@ InjectedScript* InjectedScriptManager::injectedScriptFor(v8::Local<v8::Context> |
if (it != m_idToInjectedScript.end()) |
return it->value.get(); |
- if (!m_client->callingContextCanAccessContext(context)) |
+ v8::Local<v8::Context> callingContext = context->GetIsolate()->GetCallingContext(); |
+ if (!callingContext.IsEmpty() && !m_client->callingContextCanAccessContext(callingContext, context)) |
return nullptr; |
RefPtr<InjectedScriptNative> injectedScriptNative = adoptRef(new InjectedScriptNative(context->GetIsolate())); |
- v8::Local<v8::Object> injectedScriptValue = createInjectedScript(injectedScriptSource(), context, contextId, injectedScriptNative.get()); |
- OwnPtr<InjectedScript> result = adoptPtr(new InjectedScript(injectedScriptValue, m_client, injectedScriptNative.release(), contextId)); |
+ v8::Local<v8::Object> object = createInjectedScript(injectedScriptSource(), context, contextId, injectedScriptNative.get()); |
+ OwnPtr<InjectedScript> result = adoptPtr(new InjectedScript(this, context, object, m_client, injectedScriptNative.release(), contextId)); |
InjectedScript* resultPtr = result.get(); |
if (m_customObjectFormatterEnabled) |
result->setCustomObjectFormatterEnabled(m_customObjectFormatterEnabled); |