Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(496)

Unified Diff: third_party/WebKit/Source/core/inspector/InjectedScriptManager.cpp

Issue 1636223002: DevTools: remove ScriptState/Value from the InjectedScript APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 4573133cedc00dee99d50e3d22a24f9f32addac0..1eb4d2785b1f17f066284db81b66c38389624f8a 100644
--- a/third_party/WebKit/Source/core/inspector/InjectedScriptManager.cpp
+++ b/third_party/WebKit/Source/core/inspector/InjectedScriptManager.cpp
@@ -88,10 +88,9 @@ void InjectedScriptManager::discardInjectedScripts()
m_idToInjectedScript.clear();
}
-int InjectedScriptManager::discardInjectedScriptFor(ScriptState* scriptState)
+int InjectedScriptManager::discardInjectedScriptFor(v8::Local<v8::Context> context)
{
- ScriptState::Scope scope(scriptState);
- int contextId = V8Debugger::contextId(scriptState->context());
+ int contextId = V8Debugger::contextId(context);
m_idToInjectedScript.remove(contextId);
return contextId;
}
@@ -122,20 +121,21 @@ String InjectedScriptManager::injectedScriptSource()
return String(injectedScriptSourceResource.data(), injectedScriptSourceResource.size());
}
-InjectedScript* InjectedScriptManager::injectedScriptFor(ScriptState* scriptState)
+InjectedScript* InjectedScriptManager::injectedScriptFor(v8::Local<v8::Context> context)
{
- ScriptState::Scope scope(scriptState);
- int contextId = V8Debugger::contextId(scriptState->context());
+ v8::HandleScope handles(context->GetIsolate());
dgozman 2016/01/27 02:36:37 Not needed.
pfeldman 2016/01/27 16:56:20 Done.
+ v8::Context::Scope scope(context);
dgozman 2016/01/27 02:36:37 Now you have to artificially enter this context in
pfeldman 2016/01/27 16:56:20 This is a trial check for access. Actual access is
+ int contextId = V8Debugger::contextId(context);
IdToInjectedScriptMap::iterator it = m_idToInjectedScript.find(contextId);
if (it != m_idToInjectedScript.end())
return it->value.get();
- if (!m_client->canAccessContext(scriptState->context()))
+ if (!m_client->callingContextCanAccessContext(context))
return nullptr;
- RefPtr<InjectedScriptNative> injectedScriptNative = adoptRef(new InjectedScriptNative(scriptState->isolate()));
- ScriptValue injectedScriptValue = createInjectedScript(injectedScriptSource(), scriptState, contextId, injectedScriptNative.get());
+ 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));
InjectedScript* resultPtr = result.get();
if (m_customObjectFormatterEnabled)

Powered by Google App Engine
This is Rietveld 408576698