Chromium Code Reviews| Index: src/inspector/v8-debugger.cc |
| diff --git a/src/inspector/v8-debugger.cc b/src/inspector/v8-debugger.cc |
| index 780ba8a3dc8ca283d8ef09437ffeacf56e49fd7e..86fec65ce9dceca0c6d6f803fba23cefa20ec221 100644 |
| --- a/src/inspector/v8-debugger.cc |
| +++ b/src/inspector/v8-debugger.cc |
| @@ -574,12 +574,25 @@ 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 |
| + // 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::Boolean> isWasmScript = |
| + callInternalGetterFunction(scriptWrapper.As<v8::Object>(), "isWasm") |
| + .As<v8::Boolean>(); |
| + if (isWasmScript->Value()) { |
| + agent->newWasmScript(scriptWrapper.As<v8::Object>()); |
|
dgozman
2016/11/16 19:00:10
I think we should use v8::DebugInterface::Script i
Clemens Hammacher
2016/11/16 20:31:30
Done.
|
| + } else if (m_ignoreScriptParsedEventsCounter == 0) { |
| v8::Local<v8::Value> argv[] = {eventDetails.GetEventData()}; |
| v8::Local<v8::Value> value = |
| callDebuggerMethod("getAfterCompileScript", 1, argv).ToLocalChecked(); |
| @@ -593,29 +606,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>()); |
| } |
| } |