@@ -10,27 +10,17 @@ const script = `
10
10
'use strict';
11
11
const assert = require('assert');
12
12
const vm = require('vm');
13
- const { kParsingContext } = process.binding('contextify');
14
13
global.outer = true;
15
14
global.inner = false;
16
15
const context = vm.createContext({
17
16
outer: false,
18
17
inner: true
19
18
});
19
+ const script = new vm.Script("outer");
20
20
debugger;
21
21
22
- const scriptMain = new vm.Script("outer");
23
- debugger;
24
-
25
- const scriptContext = new vm.Script("inner", {
26
- [kParsingContext]: context
27
- });
28
- debugger;
29
-
30
- assert.strictEqual(scriptMain.runInThisContext(), true);
31
- assert.strictEqual(scriptMain.runInContext(context), false);
32
- assert.strictEqual(scriptContext.runInThisContext(), false);
33
- assert.strictEqual(scriptContext.runInContext(context), true);
22
+ assert.strictEqual(script.runInThisContext(), true);
23
+ assert.strictEqual(script.runInContext(context), false);
34
24
debugger;
35
25
36
26
vm.runInContext('inner', context);
@@ -65,35 +55,25 @@ async function runTests() {
65
55
await session . waitForBreakOnLine ( 0 , '[eval]' ) ;
66
56
67
57
await session . send ( { 'method' : 'Runtime.enable' } ) ;
68
- const topContext = await getContext ( session ) ;
58
+ await getContext ( session ) ;
69
59
await session . send ( { 'method' : 'Debugger.resume' } ) ;
70
60
const childContext = await getContext ( session ) ;
71
61
await session . waitForBreakOnLine ( 13 , '[eval]' ) ;
72
62
73
- console . error ( '[test]' , 'Script associated with current context by default' ) ;
74
- await session . send ( { 'method' : 'Debugger.resume' } ) ;
75
- await checkScriptContext ( session , topContext ) ;
76
- await session . waitForBreakOnLine ( 16 , '[eval]' ) ;
77
-
78
- console . error ( '[test]' , 'Script associated with selected context' ) ;
79
- await session . send ( { 'method' : 'Debugger.resume' } ) ;
80
- await checkScriptContext ( session , childContext ) ;
81
- await session . waitForBreakOnLine ( 21 , '[eval]' ) ;
82
-
83
63
console . error ( '[test]' , 'Script is unbound' ) ;
84
64
await session . send ( { 'method' : 'Debugger.resume' } ) ;
85
- await session . waitForBreakOnLine ( 27 , '[eval]' ) ;
65
+ await session . waitForBreakOnLine ( 17 , '[eval]' ) ;
86
66
87
67
console . error ( '[test]' , 'vm.runInContext associates script with context' ) ;
88
68
await session . send ( { 'method' : 'Debugger.resume' } ) ;
89
69
await checkScriptContext ( session , childContext ) ;
90
- await session . waitForBreakOnLine ( 30 , '[eval]' ) ;
70
+ await session . waitForBreakOnLine ( 20 , '[eval]' ) ;
91
71
92
72
console . error ( '[test]' , 'vm.runInNewContext associates script with context' ) ;
93
73
await session . send ( { 'method' : 'Debugger.resume' } ) ;
94
74
const thirdContext = await getContext ( session ) ;
95
75
await checkScriptContext ( session , thirdContext ) ;
96
- await session . waitForBreakOnLine ( 33 , '[eval]' ) ;
76
+ await session . waitForBreakOnLine ( 23 , '[eval]' ) ;
97
77
98
78
console . error ( '[test]' , 'vm.runInNewContext can contain debugger statements' ) ;
99
79
await session . send ( { 'method' : 'Debugger.resume' } ) ;
0 commit comments