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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/InjectedScriptManager.cpp

Issue 1811853002: [DevTools] Move evaluateOnCallFrame to native (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/platform/v8_inspector/InjectedScriptManager.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptManager.cpp b/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptManager.cpp
index e36ead08782b104735fb00a531a925a7ce2795e2..7d74a17d6a282b02bd04ed048efc32b974b6f7f7 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptManager.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptManager.cpp
@@ -185,4 +185,36 @@ v8::Local<v8::Object> InjectedScriptManager::createInjectedScript(const String16
return injectedScriptValue.As<v8::Object>();
}
+
+InjectedScriptManager::ScopedGlobalObjectExtension::ScopedGlobalObjectExtension(InjectedScript* current, InjectedScriptManager* manager, v8::MaybeLocal<v8::Object> extension)
+ : m_context(current->context())
+{
+ v8::Local<v8::Object> extensionObject;
+ if (!extension.ToLocal(&extensionObject))
+ return;
+
+ m_symbol = V8Debugger::scopeExtensionSymbol(current->isolate());
+ if (!manager) {
+ setOnGlobal(current->context()->Global(), extensionObject);
+ } else {
+ InjectedScriptManager::IdToInjectedScriptMap::iterator end = manager->m_idToInjectedScript.end();
+ for (InjectedScriptManager::IdToInjectedScriptMap::iterator it = manager->m_idToInjectedScript.begin(); it != end; ++it) {
+ if (it->second->canAccessInspectedWindow())
+ setOnGlobal(it->second->context()->Global(), extensionObject);
+ }
+ }
+}
+
+InjectedScriptManager::ScopedGlobalObjectExtension::~ScopedGlobalObjectExtension()
+{
+ for (size_t i = 0; i < m_globals.size(); ++i)
+ m_globals[i]->ToObject(m_context).ToLocalChecked()->Delete(m_context, m_symbol);
+}
+
+void InjectedScriptManager::ScopedGlobalObjectExtension::setOnGlobal(v8::Local<v8::Object> global, v8::Local<v8::Object> extension)
+{
+ if (global->Set(m_context, m_symbol, extension).FromMaybe(false))
+ m_globals.append(global);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698