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

Unified Diff: Source/bindings/v8/ScriptDebugServer.cpp

Issue 272613002: DevTools: implemented scriptFailedToParse protocol event (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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: Source/bindings/v8/ScriptDebugServer.cpp
diff --git a/Source/bindings/v8/ScriptDebugServer.cpp b/Source/bindings/v8/ScriptDebugServer.cpp
index 79d823845908fca39421452e02ddb2ba703e1985..69828b4618d98f37091bcd5ad6fdf333abc7032e 100644
--- a/Source/bindings/v8/ScriptDebugServer.cpp
+++ b/Source/bindings/v8/ScriptDebugServer.cpp
@@ -451,7 +451,7 @@ void ScriptDebugServer::handleV8DebugEvent(const v8::Debug::EventDetails& eventD
return;
}
- if (event != v8::Break && event != v8::Exception && event != v8::AfterCompile && event != v8::BeforeCompile)
+ if (event != v8::Break && event != v8::Exception && event != v8::AfterCompile && event != v8::BeforeCompile && event != v8::ScriptFailedToParse)
return;
v8::Handle<v8::Context> eventContext = eventDetails.GetEventContext();
@@ -498,6 +498,14 @@ void ScriptDebugServer::handleV8DebugEvent(const v8::Debug::EventDetails& eventD
if (executeSkipPauseRequest(skipRequest, eventDetails.GetExecutionState()))
return;
handleProgramBreak(eventDetails, v8::Handle<v8::Value>(), hitBreakpoints.As<v8::Array>());
+ } else if (event == v8::ScriptFailedToParse) {
vsevik 2014/06/27 12:35:14 Also the code is very similar with AfterCompile ha
vsevik 2014/06/27 12:35:14 Please rebaseline this (I think the event name cha
+ v8::Context::Scope contextScope(v8::Debug::GetDebugContext());
+ v8::Handle<v8::Function> getAfterCompileScript = v8::Local<v8::Function>::Cast(debuggerScript->Get(v8AtomicString(m_isolate, "getAfterCompileScript")));
+ v8::Handle<v8::Value> argv[] = { eventDetails.GetEventData() };
+ v8::Handle<v8::Value> value = V8ScriptRunner::callInternalFunction(getAfterCompileScript, debuggerScript, WTF_ARRAY_LENGTH(argv), argv, m_isolate);
+ ASSERT(value->IsObject());
+ v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value);
+ dispatchFailedToParseSource(listener, object);
}
}
}
@@ -521,6 +529,25 @@ void ScriptDebugServer::dispatchDidParseSource(ScriptDebugListener* listener, v8
listener->didParseSource(sourceID, script);
}
+void ScriptDebugServer::dispatchFailedToParseSource(ScriptDebugListener* listener, v8::Handle<v8::Object> object)
vsevik 2014/06/27 12:35:14 This one should be merged with the method above.
+{
+ v8::Handle<v8::Value> id = object->Get(v8AtomicString(m_isolate, "id"));
+ ASSERT(!id.IsEmpty() && id->IsInt32());
+ String sourceID = String::number(id->Int32Value());
+
+ ScriptDebugListener::Script script;
+ script.url = toCoreStringWithUndefinedOrNullCheck(object->Get(v8AtomicString(m_isolate, "name")));
+ script.source = toCoreStringWithUndefinedOrNullCheck(object->Get(v8AtomicString(m_isolate, "source")));
+ script.sourceMappingURL = toCoreStringWithUndefinedOrNullCheck(object->Get(v8AtomicString(m_isolate, "sourceMappingURL")));
+ script.startLine = object->Get(v8AtomicString(m_isolate, "startLine"))->ToInteger()->Value();
+ script.startColumn = object->Get(v8AtomicString(m_isolate, "startColumn"))->ToInteger()->Value();
+ script.endLine = object->Get(v8AtomicString(m_isolate, "endLine"))->ToInteger()->Value();
+ script.endColumn = object->Get(v8AtomicString(m_isolate, "endColumn"))->ToInteger()->Value();
+ script.isContentScript = object->Get(v8AtomicString(m_isolate, "isContentScript"))->ToBoolean()->Value();
+
+ listener->failedToParseSource(sourceID, script);
+}
+
void ScriptDebugServer::ensureDebuggerScriptCompiled()
{
if (!m_debuggerScript.isEmpty())

Powered by Google App Engine
This is Rietveld 408576698