| Index: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp
|
| diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp
|
| index 0557f89c378f05eef1906406d5b0cdd60b8b6686..0d499fde17cb72da9ca386e5a5d60c6f79a39be2 100644
|
| --- a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp
|
| +++ b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp
|
| @@ -62,7 +62,7 @@ v8::MaybeLocal<v8::Value> V8DebuggerImpl::callDebuggerMethod(const char* functio
|
| v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate);
|
| v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(debuggerScript->Get(v8InternalizedString(functionName)));
|
| ASSERT(m_isolate->InContext());
|
| - return m_client->callInternalFunction(function, debuggerScript, argc, argv);
|
| + return function->Call(m_isolate->GetCurrentContext(), debuggerScript, argc, argv);
|
| }
|
|
|
| PassOwnPtr<V8Debugger> V8Debugger::create(v8::Isolate* isolate, V8DebuggerClient* client)
|
| @@ -194,7 +194,7 @@ void V8DebuggerImpl::getCompiledScripts(int contextGroupId, protocol::Vector<V8D
|
| v8::Local<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(debuggerScript->Get(v8InternalizedString("getScripts")));
|
| v8::Local<v8::Value> argv[] = { v8::Integer::New(m_isolate, contextGroupId) };
|
| v8::Local<v8::Value> value;
|
| - if (!m_client->callInternalFunction(getScriptsFunction, debuggerScript, WTF_ARRAY_LENGTH(argv), argv).ToLocal(&value))
|
| + if (!getScriptsFunction->Call(debuggerContext(), debuggerScript, WTF_ARRAY_LENGTH(argv), argv).ToLocal(&value))
|
| return;
|
| ASSERT(value->IsArray());
|
| v8::Local<v8::Array> scriptsArray = v8::Local<v8::Array>::Cast(value);
|
| @@ -469,7 +469,7 @@ PassOwnPtr<JavaScriptCallFrame> V8DebuggerImpl::wrapCallFrames()
|
| ASSERT(!currentCallFrameV8.IsEmpty());
|
| if (!currentCallFrameV8->IsObject())
|
| return nullptr;
|
| - return JavaScriptCallFrame::create(m_client, debuggerContext(), v8::Local<v8::Object>::Cast(currentCallFrameV8));
|
| + return JavaScriptCallFrame::create(debuggerContext(), v8::Local<v8::Object>::Cast(currentCallFrameV8));
|
| }
|
|
|
| v8::Local<v8::Object> V8DebuggerImpl::currentCallFrames()
|
| @@ -489,7 +489,7 @@ v8::Local<v8::Object> V8DebuggerImpl::currentCallFrames()
|
| v8::Local<v8::FunctionTemplate> wrapperTemplate = v8::Local<v8::FunctionTemplate>::New(m_isolate, m_callFrameWrapperTemplate);
|
| v8::Local<v8::Context> context = m_pausedContext.IsEmpty() ? m_isolate->GetCurrentContext() : m_pausedContext;
|
| v8::Context::Scope scope(context);
|
| - v8::Local<v8::Object> wrapper = V8JavaScriptCallFrame::wrap(m_client, wrapperTemplate, context, currentCallFrame.release());
|
| + v8::Local<v8::Object> wrapper = V8JavaScriptCallFrame::wrap(wrapperTemplate, context, currentCallFrame.release());
|
| return wrapper;
|
| }
|
|
|
| @@ -510,7 +510,7 @@ PassOwnPtr<JavaScriptCallFrame> V8DebuggerImpl::callFrameNoScopes(int index)
|
| ASSERT(!currentCallFrameV8.IsEmpty());
|
| if (!currentCallFrameV8->IsObject())
|
| return nullptr;
|
| - return JavaScriptCallFrame::create(m_client, debuggerContext(), v8::Local<v8::Object>::Cast(currentCallFrameV8));
|
| + return JavaScriptCallFrame::create(debuggerContext(), v8::Local<v8::Object>::Cast(currentCallFrameV8));
|
| }
|
|
|
| static V8DebuggerImpl* toV8DebuggerImpl(v8::Local<v8::Value> data)
|
| @@ -588,7 +588,7 @@ v8::Local<v8::Value> V8DebuggerImpl::callInternalGetterFunction(v8::Local<v8::Ob
|
| {
|
| v8::Local<v8::Value> getterValue = object->Get(v8InternalizedString(functionName));
|
| ASSERT(!getterValue.IsEmpty() && getterValue->IsFunction());
|
| - return m_client->callInternalFunction(v8::Local<v8::Function>::Cast(getterValue), object, 0, 0).ToLocalChecked();
|
| + return v8::Local<v8::Function>::Cast(getterValue)->Call(m_isolate->GetCurrentContext(), object, 0, 0).ToLocalChecked();
|
| }
|
|
|
| void V8DebuggerImpl::handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails)
|
| @@ -697,8 +697,8 @@ void V8DebuggerImpl::compileDebuggerScript()
|
| v8::Context::Scope contextScope(debuggerContext());
|
|
|
| v8::Local<v8::String> scriptValue = v8::String::NewFromUtf8(m_isolate, DebuggerScript_js, v8::NewStringType::kInternalized, sizeof(DebuggerScript_js)).ToLocalChecked();
|
| - v8::Local<v8::Value> value;
|
| - if (!m_client->compileAndRunInternalScript(scriptValue).ToLocal(&value))
|
| + v8::Local<v8::Value> value = compileAndRunInternalScript(debuggerContext(), scriptValue);
|
| + if (value.IsEmpty())
|
| return;
|
| ASSERT(value->IsObject());
|
| m_debuggerScript.Reset(m_isolate, value.As<v8::Object>());
|
| @@ -767,7 +767,40 @@ bool V8DebuggerImpl::isPaused()
|
| return !m_pausedContext.IsEmpty();
|
| }
|
|
|
| -v8::Local<v8::Script> V8DebuggerImpl::compileInternalScript(v8::Local<v8::Context>, v8::Local<v8::String> code, const String& fileName)
|
| +int V8DebuggerImpl::willExecuteScript(v8::Local<v8::Context> context, int scriptId)
|
| +{
|
| + int groupId = getGroupId(context);
|
| + if (!groupId)
|
| + return 0;
|
| + V8DebuggerAgentImpl* agent = m_agentsMap.get(groupId);
|
| + if (!agent)
|
| + return 0;
|
| + agent->willExecuteScript(scriptId);
|
| + return groupId;
|
| +}
|
| +
|
| +void V8DebuggerImpl::didExecuteScript(int groupId)
|
| +{
|
| + if (!groupId)
|
| + return;
|
| + V8DebuggerAgentImpl* agent = m_agentsMap.get(groupId);
|
| + if (agent)
|
| + agent->didExecuteScript();
|
| +}
|
| +
|
| +v8::Local<v8::Value> V8DebuggerImpl::compileAndRunInternalScript(v8::Local<v8::Context> context, v8::Local<v8::String> source)
|
| +{
|
| + v8::Local<v8::Script> script = compileInternalScript(context, source, String());
|
| + if (script.IsEmpty())
|
| + return v8::Local<v8::Value>();
|
| + v8::MicrotasksScope microtasksScope(m_isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
|
| + v8::Local<v8::Value> result;
|
| + if (!script->Run(context).ToLocal(&result))
|
| + return v8::Local<v8::Value>();
|
| + return result;
|
| +}
|
| +
|
| +v8::Local<v8::Script> V8DebuggerImpl::compileInternalScript(v8::Local<v8::Context> context, v8::Local<v8::String> code, const String& fileName)
|
| {
|
| // NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at
|
| // 1, whereas v8 starts at 0.
|
| @@ -782,7 +815,7 @@ v8::Local<v8::Script> V8DebuggerImpl::compileInternalScript(v8::Local<v8::Contex
|
| v8::True(m_isolate)); // opaqueresource
|
| v8::ScriptCompiler::Source source(code, origin);
|
| v8::Local<v8::Script> script;
|
| - if (!v8::ScriptCompiler::Compile(m_isolate->GetCurrentContext(), &source, v8::ScriptCompiler::kNoCompileOptions).ToLocal(&script))
|
| + if (!v8::ScriptCompiler::Compile(context, &source, v8::ScriptCompiler::kNoCompileOptions).ToLocal(&script))
|
| return v8::Local<v8::Script>();
|
| return script;
|
| }
|
|
|