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

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: rebased Created 4 years, 6 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 81629e7ac6e5028af1149ee6954469873a9075d2..868fdeabb4a10bbbd26e5c896eed010b25383bb0 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_commandLineAPIScope.get());
+ m_commandLineAPIScope.reset(new V8Console::CommandLineAPIScope(m_context, m_injectedScript->commandLineAPI(), m_context->Global()));
return true;
}
@@ -443,12 +437,7 @@ void InjectedScript::Scope::pretendUserGesture()
void InjectedScript::Scope::cleanup()
{
- v8::Local<v8::Object> global;
- if (m_global.ToLocal(&global)) {
- DCHECK(!m_context.IsEmpty());
- global->DeletePrivate(m_context, m_extensionPrivate);
- m_global = v8::MaybeLocal<v8::Object>();
- }
+ m_commandLineAPIScope.reset();
if (!m_context.IsEmpty()) {
m_context->Exit();
m_context.Clear();

Powered by Google App Engine
This is Rietveld 408576698