| Index: third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp
|
| diff --git a/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp b/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp
|
| index 6222e7debd1973e95219f2a519e8fbcfb77e170c..c3321606a687619205b5c67b5ea465346a669984 100644
|
| --- a/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp
|
| +++ b/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp
|
| @@ -31,15 +31,13 @@
|
| #include "platform/v8_inspector/JavaScriptCallFrame.h"
|
|
|
| #include "platform/v8_inspector/V8StringUtil.h"
|
| -#include "platform/v8_inspector/public/V8DebuggerClient.h"
|
|
|
| #include <v8-debug.h>
|
|
|
| namespace blink {
|
|
|
| -JavaScriptCallFrame::JavaScriptCallFrame(V8DebuggerClient* client, v8::Local<v8::Context> debuggerContext, v8::Local<v8::Object> callFrame)
|
| - : m_client(client)
|
| - , m_isolate(debuggerContext->GetIsolate())
|
| +JavaScriptCallFrame::JavaScriptCallFrame(v8::Local<v8::Context> debuggerContext, v8::Local<v8::Object> callFrame)
|
| + : m_isolate(debuggerContext->GetIsolate())
|
| , m_debuggerContext(m_isolate, debuggerContext)
|
| , m_callFrame(m_isolate, callFrame)
|
| {
|
| @@ -53,21 +51,21 @@ PassOwnPtr<JavaScriptCallFrame> JavaScriptCallFrame::caller()
|
| {
|
| v8::HandleScope handleScope(m_isolate);
|
| v8::Local<v8::Context> debuggerContext = v8::Local<v8::Context>::New(m_isolate, m_debuggerContext);
|
| - v8::Context::Scope contextScope(debuggerContext);
|
| v8::Local<v8::Value> callerFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame)->Get(toV8StringInternalized(m_isolate, "caller"));
|
| if (callerFrame.IsEmpty() || !callerFrame->IsObject())
|
| return 0;
|
| - return JavaScriptCallFrame::create(m_client, debuggerContext, v8::Local<v8::Object>::Cast(callerFrame));
|
| + return JavaScriptCallFrame::create(debuggerContext, v8::Local<v8::Object>::Cast(callerFrame));
|
| }
|
|
|
| int JavaScriptCallFrame::callV8FunctionReturnInt(const char* name) const
|
| {
|
| v8::HandleScope handleScope(m_isolate);
|
| - v8::Context::Scope contextScope(v8::Local<v8::Context>::New(m_isolate, m_debuggerContext));
|
| + v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
|
| + v8::Local<v8::Context> context = v8::Local<v8::Context>::New(m_isolate, m_debuggerContext);
|
| v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame);
|
| v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, name)));
|
| v8::Local<v8::Value> result;
|
| - if (!m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocal(&result) || !result->IsInt32())
|
| + if (!func->Call(context, callFrame, 0, nullptr).ToLocal(&result) || !result->IsInt32())
|
| return 0;
|
| return result.As<v8::Int32>()->Value();
|
| }
|
| @@ -75,11 +73,12 @@ int JavaScriptCallFrame::callV8FunctionReturnInt(const char* name) const
|
| String16 JavaScriptCallFrame::callV8FunctionReturnString(const char* name) const
|
| {
|
| v8::HandleScope handleScope(m_isolate);
|
| - v8::Context::Scope contextScope(v8::Local<v8::Context>::New(m_isolate, m_debuggerContext));
|
| + v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
|
| + v8::Local<v8::Context> context = v8::Local<v8::Context>::New(m_isolate, m_debuggerContext);
|
| v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame);
|
| v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, name)));
|
| v8::Local<v8::Value> result;
|
| - if (!m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocal(&result))
|
| + if (!func->Call(context, callFrame, 0, nullptr).ToLocal(&result))
|
| return String16();
|
| return toProtocolStringWithTypeCheck(result);
|
| }
|
| @@ -121,9 +120,10 @@ int JavaScriptCallFrame::functionColumn() const
|
|
|
| v8::Local<v8::Value> JavaScriptCallFrame::scopeChain() const
|
| {
|
| + v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
|
| v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame);
|
| v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, "scopeChain")));
|
| - v8::Local<v8::Array> scopeChain = v8::Local<v8::Array>::Cast(m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocalChecked());
|
| + v8::Local<v8::Array> scopeChain = v8::Local<v8::Array>::Cast(func->Call(m_isolate->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked());
|
| v8::Local<v8::Array> result = v8::Array::New(m_isolate, scopeChain->Length());
|
| for (uint32_t i = 0; i < scopeChain->Length(); i++)
|
| result->Set(i, scopeChain->Get(i));
|
| @@ -132,17 +132,19 @@ v8::Local<v8::Value> JavaScriptCallFrame::scopeChain() const
|
|
|
| int JavaScriptCallFrame::scopeType(int scopeIndex) const
|
| {
|
| + v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
|
| v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame);
|
| v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, "scopeType")));
|
| - v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocalChecked());
|
| + v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(func->Call(m_isolate->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked());
|
| return scopeType->Get(scopeIndex)->Int32Value();
|
| }
|
|
|
| v8::Local<v8::String> JavaScriptCallFrame::scopeName(int scopeIndex) const
|
| {
|
| + v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
|
| v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame);
|
| v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, "scopeName")));
|
| - v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocalChecked());
|
| + v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(func->Call(m_isolate->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked());
|
| return scopeType->Get(scopeIndex)->ToString();
|
| }
|
|
|
| @@ -158,9 +160,10 @@ v8::Local<v8::Value> JavaScriptCallFrame::scopeEndLocation(int scopeIndex) const
|
|
|
| v8::Local<v8::Value> JavaScriptCallFrame::callScopeLocationFunction(const char* name, int scopeIndex) const
|
| {
|
| + v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
|
| v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame);
|
| v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, name)));
|
| - v8::Local<v8::Array> locations = v8::Local<v8::Array>::Cast(m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocalChecked());
|
| + v8::Local<v8::Array> locations = v8::Local<v8::Array>::Cast(func->Call(m_isolate->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked());
|
| return locations->Get(scopeIndex);
|
| }
|
|
|
| @@ -177,7 +180,6 @@ String16 JavaScriptCallFrame::stepInPositions() const
|
| bool JavaScriptCallFrame::isAtReturn() const
|
| {
|
| v8::HandleScope handleScope(m_isolate);
|
| - v8::Context::Scope contextScope(v8::Local<v8::Context>::New(m_isolate, m_debuggerContext));
|
| v8::Local<v8::Value> result = v8::Local<v8::Object>::New(m_isolate, m_callFrame)->Get(toV8StringInternalized(m_isolate, "isAtReturn"));
|
| if (result.IsEmpty() || !result->IsBoolean())
|
| return false;
|
| @@ -191,6 +193,7 @@ v8::Local<v8::Value> JavaScriptCallFrame::returnValue() const
|
|
|
| v8::Local<v8::Value> JavaScriptCallFrame::evaluateWithExceptionDetails(v8::Local<v8::Value> expression, v8::Local<v8::Value> scopeExtension)
|
| {
|
| + v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kRunMicrotasks);
|
| v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame);
|
| v8::Local<v8::Function> evalFunction = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, "evaluate")));
|
| v8::Local<v8::Value> argv[] = {
|
| @@ -200,7 +203,7 @@ v8::Local<v8::Value> JavaScriptCallFrame::evaluateWithExceptionDetails(v8::Local
|
| v8::TryCatch tryCatch(m_isolate);
|
| v8::Local<v8::Object> wrappedResult = v8::Object::New(m_isolate);
|
| v8::Local<v8::Value> result;
|
| - if (m_client->callInternalFunction(evalFunction, callFrame, WTF_ARRAY_LENGTH(argv), argv).ToLocal(&result)) {
|
| + if (evalFunction->Call(m_isolate->GetCurrentContext(), callFrame, WTF_ARRAY_LENGTH(argv), argv).ToLocal(&result)) {
|
| wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "result"), result);
|
| wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "exceptionDetails"), v8::Undefined(m_isolate));
|
| } else {
|
| @@ -212,16 +215,18 @@ v8::Local<v8::Value> JavaScriptCallFrame::evaluateWithExceptionDetails(v8::Local
|
|
|
| v8::MaybeLocal<v8::Value> JavaScriptCallFrame::restart()
|
| {
|
| + v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
|
| v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame);
|
| v8::Local<v8::Function> restartFunction = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, "restart")));
|
| v8::Debug::SetLiveEditEnabled(m_isolate, true);
|
| - v8::MaybeLocal<v8::Value> result = m_client->callInternalFunction(restartFunction, callFrame, 0, nullptr);
|
| + v8::MaybeLocal<v8::Value> result = restartFunction->Call(m_isolate->GetCurrentContext(), callFrame, 0, nullptr);
|
| v8::Debug::SetLiveEditEnabled(m_isolate, false);
|
| return result;
|
| }
|
|
|
| v8::MaybeLocal<v8::Value> JavaScriptCallFrame::setVariableValue(int scopeNumber, v8::Local<v8::Value> variableName, v8::Local<v8::Value> newValue)
|
| {
|
| + v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
|
| v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame);
|
| v8::Local<v8::Function> setVariableValueFunction = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, "setVariableValue")));
|
| v8::Local<v8::Value> argv[] = {
|
| @@ -229,7 +234,7 @@ v8::MaybeLocal<v8::Value> JavaScriptCallFrame::setVariableValue(int scopeNumber,
|
| variableName,
|
| newValue
|
| };
|
| - return m_client->callInternalFunction(setVariableValueFunction, callFrame, WTF_ARRAY_LENGTH(argv), argv);
|
| + return setVariableValueFunction->Call(m_isolate->GetCurrentContext(), callFrame, WTF_ARRAY_LENGTH(argv), argv);
|
| }
|
|
|
| v8::Local<v8::Object> JavaScriptCallFrame::createExceptionDetails(v8::Isolate* isolate, v8::Local<v8::Message> message)
|
|
|