[V8] Removed debugger V8::PromiseEvent
We decided to remove related devtools experiment. BUG=chromium:526811 LOG=Y R=yangguo@chromium.org Review URL: https://codereview.chromium.org/1833563002 Cr-Commit-Position: refs/heads/master@{#35275}
This commit is contained in:
parent
dc226e6160
commit
725672512a
@ -18,13 +18,11 @@ enum DebugEvent {
|
||||
Exception = 2,
|
||||
NewFunction = 3,
|
||||
BeforeCompile = 4,
|
||||
AfterCompile = 5,
|
||||
AfterCompile = 5,
|
||||
CompileError = 6,
|
||||
PromiseEvent = 7,
|
||||
AsyncTaskEvent = 8,
|
||||
AsyncTaskEvent = 7,
|
||||
};
|
||||
|
||||
|
||||
class V8_EXPORT Debug {
|
||||
public:
|
||||
/**
|
||||
|
@ -1708,13 +1708,6 @@ MaybeHandle<Object> Debug::MakeCompileEvent(Handle<Script> script,
|
||||
}
|
||||
|
||||
|
||||
MaybeHandle<Object> Debug::MakePromiseEvent(Handle<JSObject> event_data) {
|
||||
// Create the promise event object.
|
||||
Handle<Object> argv[] = { event_data };
|
||||
return CallFunction("MakePromiseEvent", arraysize(argv), argv);
|
||||
}
|
||||
|
||||
|
||||
MaybeHandle<Object> Debug::MakeAsyncTaskEvent(Handle<JSObject> task_event) {
|
||||
// Create the async task event object.
|
||||
Handle<Object> argv[] = { task_event };
|
||||
@ -1845,25 +1838,6 @@ void Debug::OnAfterCompile(Handle<Script> script) {
|
||||
}
|
||||
|
||||
|
||||
void Debug::OnPromiseEvent(Handle<JSObject> data) {
|
||||
if (in_debug_scope() || ignore_events()) return;
|
||||
|
||||
HandleScope scope(isolate_);
|
||||
DebugScope debug_scope(this);
|
||||
if (debug_scope.failed()) return;
|
||||
|
||||
// Create the script collected state object.
|
||||
Handle<Object> event_data;
|
||||
// Bail out and don't call debugger if exception.
|
||||
if (!MakePromiseEvent(data).ToHandle(&event_data)) return;
|
||||
|
||||
// Process debug event.
|
||||
ProcessDebugEvent(v8::PromiseEvent,
|
||||
Handle<JSObject>::cast(event_data),
|
||||
true);
|
||||
}
|
||||
|
||||
|
||||
void Debug::OnAsyncTaskEvent(Handle<JSObject> data) {
|
||||
if (in_debug_scope() || ignore_events()) return;
|
||||
|
||||
@ -2013,7 +1987,6 @@ void Debug::NotifyMessageHandler(v8::DebugEvent event,
|
||||
case v8::NewFunction:
|
||||
case v8::BeforeCompile:
|
||||
case v8::CompileError:
|
||||
case v8::PromiseEvent:
|
||||
case v8::AsyncTaskEvent:
|
||||
break;
|
||||
case v8::Exception:
|
||||
|
@ -417,7 +417,6 @@ class Debug {
|
||||
void OnCompileError(Handle<Script> script);
|
||||
void OnBeforeCompile(Handle<Script> script);
|
||||
void OnAfterCompile(Handle<Script> script);
|
||||
void OnPromiseEvent(Handle<JSObject> data);
|
||||
void OnAsyncTaskEvent(Handle<JSObject> data);
|
||||
|
||||
// API facing.
|
||||
@ -580,8 +579,6 @@ class Debug {
|
||||
Handle<Object> promise);
|
||||
MUST_USE_RESULT MaybeHandle<Object> MakeCompileEvent(
|
||||
Handle<Script> script, v8::DebugEvent type);
|
||||
MUST_USE_RESULT MaybeHandle<Object> MakePromiseEvent(
|
||||
Handle<JSObject> promise_event);
|
||||
MUST_USE_RESULT MaybeHandle<Object> MakeAsyncTaskEvent(
|
||||
Handle<JSObject> task_event);
|
||||
|
||||
|
@ -51,8 +51,7 @@ Debug.DebugEvent = { Break: 1,
|
||||
BeforeCompile: 4,
|
||||
AfterCompile: 5,
|
||||
CompileError: 6,
|
||||
PromiseEvent: 7,
|
||||
AsyncTaskEvent: 8 };
|
||||
AsyncTaskEvent: 7 };
|
||||
|
||||
// Types of exceptions that can be broken upon.
|
||||
Debug.ExceptionBreak = { Caught : 0,
|
||||
@ -1141,39 +1140,6 @@ function MakeScriptObject_(script, include_source) {
|
||||
}
|
||||
|
||||
|
||||
function MakePromiseEvent(event_data) {
|
||||
return new PromiseEvent(event_data);
|
||||
}
|
||||
|
||||
|
||||
function PromiseEvent(event_data) {
|
||||
this.promise_ = event_data.promise;
|
||||
this.parentPromise_ = event_data.parentPromise;
|
||||
this.status_ = event_data.status;
|
||||
this.value_ = event_data.value;
|
||||
}
|
||||
|
||||
|
||||
PromiseEvent.prototype.promise = function() {
|
||||
return MakeMirror(this.promise_);
|
||||
}
|
||||
|
||||
|
||||
PromiseEvent.prototype.parentPromise = function() {
|
||||
return MakeMirror(this.parentPromise_);
|
||||
}
|
||||
|
||||
|
||||
PromiseEvent.prototype.status = function() {
|
||||
return this.status_;
|
||||
}
|
||||
|
||||
|
||||
PromiseEvent.prototype.value = function() {
|
||||
return MakeMirror(this.value_);
|
||||
}
|
||||
|
||||
|
||||
function MakeAsyncTaskEvent(event_data) {
|
||||
return new AsyncTaskEvent(event_data);
|
||||
}
|
||||
@ -2517,7 +2483,6 @@ utils.InstallFunctions(utils, DONT_ENUM, [
|
||||
"MakeExceptionEvent", MakeExceptionEvent,
|
||||
"MakeBreakEvent", MakeBreakEvent,
|
||||
"MakeCompileEvent", MakeCompileEvent,
|
||||
"MakePromiseEvent", MakePromiseEvent,
|
||||
"MakeAsyncTaskEvent", MakeAsyncTaskEvent,
|
||||
"IsBreakPointTriggered", IsBreakPointTriggered,
|
||||
"UpdateScriptBreakPoints", UpdateScriptBreakPoints,
|
||||
|
@ -89,9 +89,6 @@ function PromiseSet(promise, status, value, onResolve, onReject) {
|
||||
SET_PRIVATE(promise, promiseValueSymbol, value);
|
||||
SET_PRIVATE(promise, promiseOnResolveSymbol, onResolve);
|
||||
SET_PRIVATE(promise, promiseOnRejectSymbol, onReject);
|
||||
if (DEBUG_IS_ACTIVE) {
|
||||
%DebugPromiseEvent({ promise: promise, status: status, value: value });
|
||||
}
|
||||
return promise;
|
||||
}
|
||||
|
||||
@ -306,9 +303,6 @@ function PromiseThen(onResolve, onReject) {
|
||||
}
|
||||
// Mark this promise as having handler.
|
||||
SET_PRIVATE(this, promiseHasHandlerSymbol, true);
|
||||
if (DEBUG_IS_ACTIVE) {
|
||||
%DebugPromiseEvent({ promise: deferred.promise, parentPromise: this });
|
||||
}
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
|
@ -1635,15 +1635,6 @@ RUNTIME_FUNCTION(Runtime_DebugPopPromise) {
|
||||
}
|
||||
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_DebugPromiseEvent) {
|
||||
DCHECK(args.length() == 1);
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, data, 0);
|
||||
isolate->debug()->OnPromiseEvent(data);
|
||||
return isolate->heap()->undefined_value();
|
||||
}
|
||||
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_DebugAsyncTaskEvent) {
|
||||
DCHECK(args.length() == 1);
|
||||
HandleScope scope(isolate);
|
||||
|
@ -190,7 +190,6 @@ namespace internal {
|
||||
F(DebugPrepareStepInIfStepping, 1, 1) \
|
||||
F(DebugPushPromise, 2, 1) \
|
||||
F(DebugPopPromise, 0, 1) \
|
||||
F(DebugPromiseEvent, 1, 1) \
|
||||
F(DebugAsyncTaskEvent, 1, 1) \
|
||||
F(DebugIsActive, 0, 1) \
|
||||
F(DebugBreakInOptimizedCode, 0, 1)
|
||||
|
@ -1,122 +0,0 @@
|
||||
// Copyright 2014 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --allow-natives-syntax --expose-debug-as debug
|
||||
|
||||
Debug = debug.Debug;
|
||||
|
||||
var eventsExpected = 16;
|
||||
var exception = null;
|
||||
var result = [];
|
||||
|
||||
function updatePromise(promise, parentPromise, status, value) {
|
||||
var i;
|
||||
for (i = 0; i < result.length; ++i) {
|
||||
if (result[i].promise === promise) {
|
||||
result[i].parentPromise = parentPromise || result[i].parentPromise;
|
||||
result[i].status = status || result[i].status;
|
||||
result[i].value = value || result[i].value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assertTrue(i < result.length);
|
||||
}
|
||||
|
||||
function listener(event, exec_state, event_data, data) {
|
||||
if (event != Debug.DebugEvent.PromiseEvent) return;
|
||||
try {
|
||||
eventsExpected--;
|
||||
assertTrue(event_data.promise().isPromise());
|
||||
if (event_data.status() === 0) {
|
||||
// New promise.
|
||||
assertEquals("pending", event_data.promise().status());
|
||||
result.push({ promise: event_data.promise().value(), status: 0 });
|
||||
assertTrue(exec_state.frame(0).sourceLineText().indexOf("// event") > 0);
|
||||
} else if (event_data.status() !== undefined) {
|
||||
// Resolve/reject promise.
|
||||
updatePromise(event_data.promise().value(),
|
||||
undefined,
|
||||
event_data.status(),
|
||||
event_data.value().value());
|
||||
} else {
|
||||
// Chain promises.
|
||||
assertTrue(event_data.parentPromise().isPromise());
|
||||
updatePromise(event_data.promise().value(),
|
||||
event_data.parentPromise().value());
|
||||
assertTrue(exec_state.frame(0).sourceLineText().indexOf("// event") > 0);
|
||||
}
|
||||
} catch (e) {
|
||||
print(e + e.stack)
|
||||
exception = e;
|
||||
}
|
||||
}
|
||||
|
||||
Debug.setListener(listener);
|
||||
|
||||
function resolver(resolve, reject) { resolve(); }
|
||||
|
||||
var p1 = new Promise(resolver); // event
|
||||
var p2 = p1.then().then(); // event
|
||||
var p3 = new Promise(function(resolve, reject) { // event
|
||||
reject("rejected");
|
||||
});
|
||||
var p4 = p3.then(); // event
|
||||
var p5 = p1.then(); // event
|
||||
|
||||
function assertAsync(b, s) {
|
||||
if (b) {
|
||||
print(s, "succeeded");
|
||||
} else {
|
||||
%AbortJS(s + " FAILED!");
|
||||
}
|
||||
}
|
||||
|
||||
function testDone(iteration) {
|
||||
function checkResult() {
|
||||
if (eventsExpected === 0) {
|
||||
assertAsync(result.length === 6, "result.length");
|
||||
|
||||
assertAsync(result[0].promise === p1, "result[0].promise");
|
||||
assertAsync(result[0].parentPromise === undefined,
|
||||
"result[0].parentPromise");
|
||||
assertAsync(result[0].status === 1, "result[0].status");
|
||||
assertAsync(result[0].value === undefined, "result[0].value");
|
||||
|
||||
assertAsync(result[1].parentPromise === p1,
|
||||
"result[1].parentPromise");
|
||||
assertAsync(result[1].status === 1, "result[1].status");
|
||||
|
||||
assertAsync(result[2].promise === p2, "result[2].promise");
|
||||
|
||||
assertAsync(result[3].promise === p3, "result[3].promise");
|
||||
assertAsync(result[3].parentPromise === undefined,
|
||||
"result[3].parentPromise");
|
||||
assertAsync(result[3].status === -1, "result[3].status");
|
||||
assertAsync(result[3].value === "rejected", "result[3].value");
|
||||
|
||||
assertAsync(result[4].promise === p4, "result[4].promise");
|
||||
assertAsync(result[4].parentPromise === p3,
|
||||
"result[4].parentPromise");
|
||||
assertAsync(result[4].status === -1, "result[4].status");
|
||||
assertAsync(result[4].value === "rejected", "result[4].value");
|
||||
|
||||
assertAsync(result[5].promise === p5, "result[5].promise");
|
||||
assertAsync(result[5].parentPromise === p1,
|
||||
"result[5].parentPromise");
|
||||
assertAsync(result[5].status === 1, "result[5].status");
|
||||
|
||||
assertAsync(exception === null, "exception === null");
|
||||
Debug.setListener(null);
|
||||
} else if (iteration > 10) {
|
||||
%AbortJS("Not all events were received!");
|
||||
} else {
|
||||
testDone(iteration + 1);
|
||||
}
|
||||
}
|
||||
|
||||
var iteration = iteration || 0;
|
||||
%EnqueueMicrotask(checkResult);
|
||||
}
|
||||
|
||||
testDone();
|
@ -1,32 +0,0 @@
|
||||
// Copyright 2014 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --expose-debug-as debug --allow-natives-syntax
|
||||
|
||||
// Test debug events when we listen to all exceptions and
|
||||
// there is a catch handler for the exception thrown in a Promise.
|
||||
// We expect a normal Exception debug event to be triggered.
|
||||
|
||||
Debug = debug.Debug;
|
||||
|
||||
var events = [];
|
||||
|
||||
function listener(event, exec_state, event_data, data) {
|
||||
if (event == Debug.DebugEvent.PromiseEvent) events.push(event_data.status());
|
||||
}
|
||||
|
||||
Debug.setListener(listener);
|
||||
|
||||
var p = new Promise(function(resolve, reject) {
|
||||
do {
|
||||
try {
|
||||
throw new Error("reject");
|
||||
} finally {
|
||||
break; // No rethrow.
|
||||
}
|
||||
} while (false);
|
||||
resolve();
|
||||
});
|
||||
|
||||
assertEquals([0 /* create */, 1 /* resolve */], events);
|
@ -1,29 +0,0 @@
|
||||
// Copyright 2014 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --expose-debug-as debug --allow-natives-syntax
|
||||
|
||||
// Test debug events when we listen to all exceptions and
|
||||
// there is a catch handler for the exception thrown in a Promise.
|
||||
// We expect a normal Exception debug event to be triggered.
|
||||
|
||||
Debug = debug.Debug;
|
||||
|
||||
var events = [];
|
||||
|
||||
function listener(event, exec_state, event_data, data) {
|
||||
if (event == Debug.DebugEvent.PromiseEvent) events.push(event_data.status());
|
||||
}
|
||||
|
||||
Debug.setListener(listener);
|
||||
|
||||
var p = new Promise(function (resolve, reject) {
|
||||
try {
|
||||
throw new Error("reject");
|
||||
} catch (e) {
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
|
||||
assertEquals([0 /* create */, 1 /* resolve */], events);
|
@ -1,30 +0,0 @@
|
||||
// Copyright 2014 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --expose-debug-as debug --allow-natives-syntax
|
||||
|
||||
// Test debug events when we listen to all exceptions and
|
||||
// there is a catch handler for the exception thrown in a Promise.
|
||||
// We expect a normal Exception debug event to be triggered.
|
||||
|
||||
Debug = debug.Debug;
|
||||
|
||||
var events = [];
|
||||
|
||||
function listener(event, exec_state, event_data, data) {
|
||||
if (event == Debug.DebugEvent.PromiseEvent) events.push(event_data.status());
|
||||
}
|
||||
|
||||
Debug.setListener(listener);
|
||||
|
||||
var p = new Promise(function(resolve, reject) {
|
||||
try {
|
||||
throw new Error("reject");
|
||||
} finally {
|
||||
// Implicit rethrow.
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
|
||||
assertEquals([0 /* create */, -1 /* rethrown */], events);
|
Loading…
Reference in New Issue
Block a user