40245b75a4
This CL replaces most of Isolate::GetEnteredContext with GetEnteredOrMicrotaskContext, as it should be more relevant. Here is a brief overview of the series of changes. https://docs.google.com/document/d/1MY_xlsYS7E6_qbwwY66-FH3JkAYeTHBlF5qVBrBpWyY/edit#heading=h.fx2rezbyzz5c Bug: v8:8124 Change-Id: I27355e325a92094240c25b672d1219f3214a9da0 Reviewed-on: https://chromium-review.googlesource.com/c/1297654 Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Taiju Tsuiki <tzik@chromium.org> Cr-Commit-Position: refs/heads/master@{#57470}
60 lines
2.5 KiB
JavaScript
60 lines
2.5 KiB
JavaScript
// Copyright 2017 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.
|
|
|
|
InspectorTest.log('Tests that all sessions get exception notifications.');
|
|
|
|
function connect(contextGroup, num) {
|
|
var session = contextGroup.connect();
|
|
var exceptionId;
|
|
session.Protocol.Runtime.onExceptionThrown(message => {
|
|
InspectorTest.log('From session ' + num);
|
|
InspectorTest.logMessage(message);
|
|
exceptionId = message.params.exceptionDetails.exceptionId;
|
|
});
|
|
session.Protocol.Runtime.onExceptionRevoked(message => {
|
|
InspectorTest.log('From session ' + num);
|
|
InspectorTest.logMessage(message);
|
|
InspectorTest.log('id matching: ' + (message.params.exceptionId === exceptionId));
|
|
});
|
|
return session;
|
|
}
|
|
|
|
(async function test() {
|
|
var contextGroup = new InspectorTest.ContextGroup();
|
|
var session1 = connect(contextGroup, 1);
|
|
var session2 = connect(contextGroup, 2);
|
|
await session1.Protocol.Runtime.enable();
|
|
await session2.Protocol.Runtime.enable();
|
|
|
|
InspectorTest.log('Throwing in 2');
|
|
await session2.Protocol.Runtime.evaluate({expression: 'throw "error1";'});
|
|
|
|
InspectorTest.log('Throwing in 1');
|
|
await session1.Protocol.Runtime.evaluate({expression: 'throw "error2";'});
|
|
|
|
InspectorTest.log('Throwing in setTimeout 1');
|
|
await session1.Protocol.Runtime.evaluate({expression: 'setTimeout(() => { throw "error3"; }, 0)'});
|
|
await InspectorTest.waitForPendingTasks();
|
|
|
|
InspectorTest.log('Throwing in setTimeout 2');
|
|
await session2.Protocol.Runtime.evaluate({expression: 'setTimeout(() => { throw "error4"; }, 0)'});
|
|
await InspectorTest.waitForPendingTasks();
|
|
|
|
InspectorTest.log('Rejecting in 2');
|
|
await session2.Protocol.Runtime.evaluate({expression: 'var p2; setTimeout(() => { p2 = Promise.reject("error5") }, 0)'});
|
|
await InspectorTest.waitForPendingTasks();
|
|
InspectorTest.log('Revoking in 2');
|
|
await session2.Protocol.Runtime.evaluate({expression: 'setTimeout(() => { p2.catch(()=>{}) }, 0);'});
|
|
await InspectorTest.waitForPendingTasks();
|
|
|
|
InspectorTest.log('Rejecting in 1');
|
|
await session1.Protocol.Runtime.evaluate({expression: 'var p1; setTimeout(() => { p1 = Promise.reject("error6")} , 0)'});
|
|
await InspectorTest.waitForPendingTasks();
|
|
InspectorTest.log('Revoking in 1');
|
|
await session1.Protocol.Runtime.evaluate({expression: 'setTimeout(() => { p1.catch(()=>{}) }, 0);'});
|
|
await InspectorTest.waitForPendingTasks();
|
|
|
|
InspectorTest.completeTest();
|
|
})();
|