Index: src/inspector/v8-debugger.cc |
diff --git a/src/inspector/v8-debugger.cc b/src/inspector/v8-debugger.cc |
index 1b4679569acb5988e65906526738d8764e6ca9a7..f23ef0e982a750aaeecdc2d82e602a5cf93290b6 100644 |
--- a/src/inspector/v8-debugger.cc |
+++ b/src/inspector/v8-debugger.cc |
@@ -576,12 +576,32 @@ void V8Debugger::handleV8DebugEvent( |
V8DebuggerAgentImpl* agent = |
m_inspector->enabledDebuggerAgentForGroup(getGroupId(eventContext)); |
- if (agent) { |
- v8::HandleScope scope(m_isolate); |
- if (m_ignoreScriptParsedEventsCounter == 0 && |
- (event == v8::AfterCompile || event == v8::CompileError)) { |
- v8::Local<v8::Context> context = debuggerContext(); |
- v8::Context::Scope contextScope(context); |
+ if (!agent) return; |
+ |
+ v8::HandleScope scope(m_isolate); |
+ if (event == v8::AfterCompile || event == v8::CompileError) { |
+ v8::Context::Scope contextScope(debuggerContext()); |
+ // Determine if it is a wasm script by checking whether the source url |
dgozman
2016/11/11 21:50:34
Why not expose isWasmScript or similar?
Clemens Hammacher
2016/11/16 11:36:28
Added "isWasm" method to script wrapper.
|
+ // starts with "wasm://". |
+ v8::Local<v8::Value> scriptMirror = |
+ callInternalGetterFunction(eventDetails.GetEventData(), "script"); |
+ DCHECK(scriptMirror->IsObject()); |
+ v8::Local<v8::Value> scriptWrapper = |
+ callInternalGetterFunction(scriptMirror.As<v8::Object>(), "value"); |
+ DCHECK(scriptWrapper->IsObject()); |
+ v8::Local<v8::Value> sourceUrl = callInternalGetterFunction( |
+ scriptWrapper.As<v8::Object>(), "nameOrSourceURL"); |
+ char sourceUrlStart[7]; |
titzer
2016/11/11 10:59:02
Can you factor this code out into a "startsWith" h
Clemens Hammacher
2016/11/16 11:36:28
Obsolete with the isWasm method.
|
+ int written = sourceUrl->IsString() |
+ ? sourceUrl.As<v8::String>()->WriteUtf8( |
+ sourceUrlStart, sizeof(sourceUrlStart)) |
+ : 0; |
+ bool isWasmScript = |
+ written == sizeof(sourceUrlStart) && |
+ !memcmp(sourceUrlStart, "wasm://", sizeof(sourceUrlStart)); |
+ if (isWasmScript) { |
+ agent->newWasmScript(scriptWrapper.As<v8::Object>()); |
+ } else if (m_ignoreScriptParsedEventsCounter == 0) { |
v8::Local<v8::Value> argv[] = {eventDetails.GetEventData()}; |
v8::Local<v8::Value> value = |
callDebuggerMethod("getAfterCompileScript", 1, argv).ToLocalChecked(); |
@@ -595,29 +615,28 @@ void V8Debugger::handleV8DebugEvent( |
agent->didParseSource( |
wrapUnique(new V8DebuggerScript(m_isolate, script, inLiveEditScope)), |
event == v8::AfterCompile); |
- } else if (event == v8::Exception) { |
- v8::Local<v8::Context> context = debuggerContext(); |
- v8::Local<v8::Object> eventData = eventDetails.GetEventData(); |
- v8::Local<v8::Value> exception = |
- callInternalGetterFunction(eventData, "exception"); |
- v8::Local<v8::Value> promise = |
- callInternalGetterFunction(eventData, "promise"); |
- bool isPromiseRejection = !promise.IsEmpty() && promise->IsObject(); |
- v8::Local<v8::Value> uncaught = |
- callInternalGetterFunction(eventData, "uncaught"); |
- bool isUncaught = uncaught->BooleanValue(context).FromJust(); |
- handleProgramBreak(eventContext, eventDetails.GetExecutionState(), |
- exception, v8::Local<v8::Array>(), isPromiseRejection, |
- isUncaught); |
- } else if (event == v8::Break) { |
- v8::Local<v8::Value> argv[] = {eventDetails.GetEventData()}; |
- v8::Local<v8::Value> hitBreakpoints = |
- callDebuggerMethod("getBreakpointNumbers", 1, argv).ToLocalChecked(); |
- DCHECK(hitBreakpoints->IsArray()); |
- handleProgramBreak(eventContext, eventDetails.GetExecutionState(), |
- v8::Local<v8::Value>(), |
- hitBreakpoints.As<v8::Array>()); |
} |
+ } else if (event == v8::Exception) { |
+ v8::Local<v8::Context> context = debuggerContext(); |
+ v8::Local<v8::Object> eventData = eventDetails.GetEventData(); |
+ v8::Local<v8::Value> exception = |
+ callInternalGetterFunction(eventData, "exception"); |
+ v8::Local<v8::Value> promise = |
+ callInternalGetterFunction(eventData, "promise"); |
+ bool isPromiseRejection = !promise.IsEmpty() && promise->IsObject(); |
+ v8::Local<v8::Value> uncaught = |
+ callInternalGetterFunction(eventData, "uncaught"); |
+ bool isUncaught = uncaught->BooleanValue(context).FromJust(); |
+ handleProgramBreak(eventContext, eventDetails.GetExecutionState(), |
+ exception, v8::Local<v8::Array>(), isPromiseRejection, |
+ isUncaught); |
+ } else if (event == v8::Break) { |
+ v8::Local<v8::Value> argv[] = {eventDetails.GetEventData()}; |
+ v8::Local<v8::Value> hitBreakpoints = |
+ callDebuggerMethod("getBreakpointNumbers", 1, argv).ToLocalChecked(); |
+ DCHECK(hitBreakpoints->IsArray()); |
+ handleProgramBreak(eventContext, eventDetails.GetExecutionState(), |
+ v8::Local<v8::Value>(), hitBreakpoints.As<v8::Array>()); |
} |
} |