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

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

Issue 2030453002: [DevTools] Support CommandLineAPI in workers and Node.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/InjectedScript.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
index ec1828a24daa069536b54b7d3d653779ad704e78..df832f7db176bb54b4f18b99212d522ebdf6757c 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
@@ -405,14 +405,8 @@ bool InjectedScript::Scope::initialize()
bool InjectedScript::Scope::installCommandLineAPI()
{
- DCHECK(m_injectedScript && !m_context.IsEmpty() && m_global.IsEmpty());
- m_extensionPrivate = V8Debugger::scopeExtensionPrivate(m_debugger->isolate());
- v8::Local<v8::Object> global = m_context->Global();
- if (!global->SetPrivate(m_context, m_extensionPrivate, m_injectedScript->commandLineAPI()).FromMaybe(false)) {
- *m_errorString = "Internal error";
- return false;
- }
- m_global = global;
+ DCHECK(m_injectedScript && !m_context.IsEmpty() && m_installedAPI.IsEmpty());
+ m_installedAPI = V8Console::installCommandLineAPI(m_context, m_context->Global(), m_injectedScript->commandLineAPI());
return true;
}
@@ -443,11 +437,11 @@ void InjectedScript::Scope::pretendUserGesture()
void InjectedScript::Scope::cleanup()
{
- v8::Local<v8::Object> global;
- if (m_global.ToLocal(&global)) {
+ v8::Local<v8::Object> installedAPI;
+ if (m_installedAPI.ToLocal(&installedAPI)) {
DCHECK(!m_context.IsEmpty());
- global->DeletePrivate(m_context, m_extensionPrivate);
- m_global = v8::MaybeLocal<v8::Object>();
+ V8Console::clearCommandLineAPI(m_context, m_context->Global(), installedAPI);
+ m_installedAPI = v8::MaybeLocal<v8::Object>();
}
if (!m_context.IsEmpty()) {
m_context->Exit();

Powered by Google App Engine
This is Rietveld 408576698