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