| Index: Source/bindings/core/v8/ScriptDebugServer.cpp
|
| diff --git a/Source/bindings/core/v8/ScriptDebugServer.cpp b/Source/bindings/core/v8/ScriptDebugServer.cpp
|
| index 2a128e60664a9eef528195194e9bf10249fade3c..f886c501425eda38ce5f4b69f200c056a08ead19 100644
|
| --- a/Source/bindings/core/v8/ScriptDebugServer.cpp
|
| +++ b/Source/bindings/core/v8/ScriptDebugServer.cpp
|
| @@ -104,7 +104,7 @@
|
| ASSERT(!enabled());
|
| v8::HandleScope scope(m_isolate);
|
| v8::Debug::SetDebugEventListener(&ScriptDebugServer::v8DebugEventCallback, v8::External::New(m_isolate, this));
|
| - compileDebuggerScript();
|
| + ensureDebuggerScriptCompiled();
|
| }
|
|
|
| void ScriptDebugServer::disable()
|
| @@ -194,10 +194,7 @@
|
|
|
| void ScriptDebugServer::setBreakpointsActivated(bool activated)
|
| {
|
| - if (!enabled()) {
|
| - ASSERT_NOT_REACHED();
|
| - return;
|
| - }
|
| + ensureDebuggerScriptCompiled();
|
| v8::HandleScope scope(m_isolate);
|
| v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext();
|
| v8::Context::Scope contextScope(debuggerContext);
|
| @@ -212,7 +209,7 @@
|
|
|
| ScriptDebugServer::PauseOnExceptionsState ScriptDebugServer::pauseOnExceptionsState()
|
| {
|
| - ASSERT(enabled());
|
| + ensureDebuggerScriptCompiled();
|
| v8::HandleScope scope(m_isolate);
|
| v8::Context::Scope contextScope(v8::Debug::GetDebugContext());
|
|
|
| @@ -223,7 +220,7 @@
|
|
|
| void ScriptDebugServer::setPauseOnExceptionsState(PauseOnExceptionsState pauseOnExceptionsState)
|
| {
|
| - ASSERT(enabled());
|
| + ensureDebuggerScriptCompiled();
|
| v8::HandleScope scope(m_isolate);
|
| v8::Context::Scope contextScope(v8::Debug::GetDebugContext());
|
|
|
| @@ -316,7 +313,7 @@
|
|
|
| void ScriptDebugServer::clearStepping()
|
| {
|
| - ASSERT(enabled());
|
| + ensureDebuggerScriptCompiled();
|
| v8::HandleScope scope(m_isolate);
|
| v8::Context::Scope contextScope(v8::Debug::GetDebugContext());
|
|
|
| @@ -334,7 +331,7 @@
|
| v8::Isolate* m_isolate;
|
| };
|
|
|
| - ASSERT(enabled());
|
| + ensureDebuggerScriptCompiled();
|
| v8::HandleScope scope(m_isolate);
|
|
|
| OwnPtr<v8::Context::Scope> contextScope;
|
| @@ -678,12 +675,10 @@
|
| listener->didParseSource(sourceID, script, compileResult);
|
| }
|
|
|
| -void ScriptDebugServer::compileDebuggerScript()
|
| -{
|
| - if (!m_debuggerScript.IsEmpty()) {
|
| - ASSERT_NOT_REACHED();
|
| - return;
|
| - }
|
| +void ScriptDebugServer::ensureDebuggerScriptCompiled()
|
| +{
|
| + if (!m_debuggerScript.IsEmpty())
|
| + return;
|
|
|
| v8::HandleScope scope(m_isolate);
|
| v8::Context::Scope contextScope(v8::Debug::GetDebugContext());
|
| @@ -705,50 +700,41 @@
|
|
|
| v8::Local<v8::Value> ScriptDebugServer::functionScopes(v8::Local<v8::Function> function)
|
| {
|
| - if (!enabled()) {
|
| - ASSERT_NOT_REACHED();
|
| - return v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate));
|
| - }
|
| + ensureDebuggerScriptCompiled();
|
| +
|
| v8::Local<v8::Value> argv[] = { function };
|
| return callDebuggerMethod("getFunctionScopes", 1, argv).ToLocalChecked();
|
| }
|
|
|
| v8::Local<v8::Value> ScriptDebugServer::generatorObjectDetails(v8::Local<v8::Object>& object)
|
| {
|
| - if (!enabled()) {
|
| - ASSERT_NOT_REACHED();
|
| - return v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate));
|
| - }
|
| + ensureDebuggerScriptCompiled();
|
| +
|
| v8::Local<v8::Value> argv[] = { object };
|
| return callDebuggerMethod("getGeneratorObjectDetails", 1, argv).ToLocalChecked();
|
| }
|
|
|
| v8::Local<v8::Value> ScriptDebugServer::collectionEntries(v8::Local<v8::Object>& object)
|
| {
|
| - if (!enabled()) {
|
| - ASSERT_NOT_REACHED();
|
| - return v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate));
|
| - }
|
| + ensureDebuggerScriptCompiled();
|
| +
|
| v8::Local<v8::Value> argv[] = { object };
|
| return callDebuggerMethod("getCollectionEntries", 1, argv).ToLocalChecked();
|
| }
|
|
|
| v8::Local<v8::Value> ScriptDebugServer::getInternalProperties(v8::Local<v8::Object>& object)
|
| {
|
| - if (!enabled()) {
|
| - // FIXME: provide a way to collect internal properties without enabling debugger. See crbug.com/485451
|
| + if (m_debuggerScript.IsEmpty())
|
| return v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate));
|
| - }
|
| +
|
| v8::Local<v8::Value> argv[] = { object };
|
| return callDebuggerMethod("getInternalProperties", 1, argv).ToLocalChecked();
|
| }
|
|
|
| v8::MaybeLocal<v8::Value> ScriptDebugServer::setFunctionVariableValue(v8::Local<v8::Value> functionValue, int scopeNumber, const String& variableName, v8::Local<v8::Value> newValue)
|
| {
|
| - if (m_debuggerScript.IsEmpty()) {
|
| - ASSERT_NOT_REACHED();
|
| + if (m_debuggerScript.IsEmpty())
|
| return m_isolate->ThrowException(v8::String::NewFromUtf8(m_isolate, "Debugging is not enabled.", v8::NewStringType::kNormal).ToLocalChecked());
|
| - }
|
|
|
| v8::Local<v8::Value> argv[] = {
|
| functionValue,
|
|
|