Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ca1942c

Browse filesBrowse files
ericrannaudaduh95
authored andcommitted
test: testcase demonstrating issue 59541
Check that we lose the execution flow in the outer context, upon resolving a promise created in in the inner context. PR-URL: #59801 Fixes: #59541 Refs: https://issues.chromium.org/issues/441679231 Refs: https://groups.google.com/g/v8-dev/c/YIeRg8CUNS8/m/rEQdFuNZAAAJ Refs: https://tc39.es/ecma262/#sec-newpromiseresolvethenablejob Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 34c686b commit ca1942c
Copy full SHA for ca1942c

File tree

Expand file treeCollapse file tree

1 file changed

+34
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+34
-0
lines changed
Open diff view settings
Collapse file
+34Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Flags: --experimental-vm-modules
2+
'use strict';
3+
4+
// https://github.com/nodejs/node/issues/59541
5+
//
6+
// Promises created in a context using microtaskMode: "aferEvaluate" (meaning it
7+
// has its own microtask queue), when resolved in the surrounding context, will
8+
// schedule a task back onto the inner context queue.
9+
10+
const common = require('../common');
11+
const vm = require('vm');
12+
13+
const microtaskMode = 'afterEvaluate';
14+
15+
(async () => {
16+
const mustNotCall1 = common.mustNotCall();
17+
const mustNotCall2 = common.mustNotCall();
18+
19+
const inner = {};
20+
21+
const context = vm.createContext({ inner }, { microtaskMode });
22+
23+
const module = new vm.SourceTextModule(
24+
'inner.promise = Promise.resolve();',
25+
{ context },
26+
);
27+
28+
await module.link(mustNotCall1);
29+
await module.evaluate();
30+
31+
// This is Issue 59541, the next statement is not executed, of course
32+
// it should be.
33+
mustNotCall2();
34+
})().then(common.mustNotCall());

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.