Skip to content

Commit 3175391

Browse files
RReverserMylesBorins
authored andcommitted
test: fix scriptParsed event expectations
As per Node.js docs, vm.Script instance is not bound to any context. However, this test was expecting otherwise and depended on implementation details which are going to change. Refs: https://chromium-review.googlesource.com/c/v8/v8/+/1013581 Backport-PR-URL: #21668 PR-URL: #21079 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yang Guo <[email protected]>
1 parent 48ab7dc commit 3175391

File tree

1 file changed

+7
-27
lines changed

1 file changed

+7
-27
lines changed

‎test/sequential/test-inspector-scriptparsed-context.js‎

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,17 @@ const script = `
99
'use strict'
1010
const assert = require('assert');
1111
const vm = require('vm');
12-
const{kParsingContext } = process.binding('contextify');
1312
global.outer = true;
1413
global.inner = false;
1514
const context = vm.createContext({
1615
outer: false,
1716
inner: true
1817
});
18+
const script = new vm.Script("outer");
1919
debugger;
2020
21-
const scriptMain = new vm.Script("outer");
22-
debugger;
23-
24-
const scriptContext = new vm.Script("inner",{
25-
[kParsingContext]: context
26-
});
27-
debugger;
28-
29-
assert.strictEqual(scriptMain.runInThisContext(), true);
30-
assert.strictEqual(scriptMain.runInContext(context), false);
31-
assert.strictEqual(scriptContext.runInThisContext(), false);
32-
assert.strictEqual(scriptContext.runInContext(context), true);
21+
assert.strictEqual(script.runInThisContext(), true);
22+
assert.strictEqual(script.runInContext(context), false);
3323
debugger;
3424
3525
vm.runInContext('inner', context);
@@ -64,35 +54,25 @@ async function runTests(){
6454
awaitsession.waitForBreakOnLine(0,'[eval]');
6555

6656
awaitsession.send({'method': 'Runtime.enable'});
67-
consttopContext=awaitgetContext(session);
57+
awaitgetContext(session);
6858
awaitsession.send({'method': 'Debugger.resume'});
6959
constchildContext=awaitgetContext(session);
7060
awaitsession.waitForBreakOnLine(13,'[eval]');
7161

72-
console.error('[test]','Script associated with current context by default');
73-
awaitsession.send({'method': 'Debugger.resume'});
74-
awaitcheckScriptContext(session,topContext);
75-
awaitsession.waitForBreakOnLine(16,'[eval]');
76-
77-
console.error('[test]','Script associated with selected context');
78-
awaitsession.send({'method': 'Debugger.resume'});
79-
awaitcheckScriptContext(session,childContext);
80-
awaitsession.waitForBreakOnLine(21,'[eval]');
81-
8262
console.error('[test]','Script is unbound');
8363
awaitsession.send({'method': 'Debugger.resume'});
84-
awaitsession.waitForBreakOnLine(27,'[eval]');
64+
awaitsession.waitForBreakOnLine(17,'[eval]');
8565

8666
console.error('[test]','vm.runInContext associates script with context');
8767
awaitsession.send({'method': 'Debugger.resume'});
8868
awaitcheckScriptContext(session,childContext);
89-
awaitsession.waitForBreakOnLine(30,'[eval]');
69+
awaitsession.waitForBreakOnLine(20,'[eval]');
9070

9171
console.error('[test]','vm.runInNewContext associates script with context');
9272
awaitsession.send({'method': 'Debugger.resume'});
9373
constthirdContext=awaitgetContext(session);
9474
awaitcheckScriptContext(session,thirdContext);
95-
awaitsession.waitForBreakOnLine(33,'[eval]');
75+
awaitsession.waitForBreakOnLine(23,'[eval]');
9676

9777
console.error('[test]','vm.runInNewContext can contain debugger statements');
9878
awaitsession.send({'method': 'Debugger.resume'});

0 commit comments

Comments
(0)