Skip to content
Snippets Groups Projects
Commit 292fd0c9 authored by Leo Balter's avatar Leo Balter Committed by Rick Waldron
Browse files

fix test in module/script modes

parent 7f69f1c6
No related branches found
No related tags found
No related merge requests found
......@@ -11,8 +11,11 @@ info: |
a. Let requiredModule be ? HostResolveImportedModule(module, required).
b. Perform ? requiredModule.ModuleEvaluation().
[...]
This test is meant to be flagged as module code, it should not initially
run as script code or the result will not be the same.
includes: [fnGlobalObject.js]
flags: [async]
flags: [async, module]
features: [dynamic-import]
---*/
......
// Copyright (C) 2018 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Script is evaluated exactly once after loaded by import
esid: sec-hostimportmoduledynamically
info: |
Success path
The completion value of any subsequent call to HostResolveImportedModule after
FinishDynamicImport has completed, given the arguments referencingScriptOrModule
and specifier, must be a module which has already been evaluated, i.e. whose
Evaluate concrete method has already been called and returned a normal completion.
This test is meant to __not__ be flagged as module code, it should not initially
run as module code or the result will not be the same.
includes: [fnGlobalObject.js]
flags: [async]
features: [dynamic-import]
---*/
var global = fnGlobalObject();
if (typeof global.evaluated === 'undefined') {
global.evaluated = 0;
}
global.evaluated++;
Promise.all([
import('./eval-self-once-script.js'),
import('./eval-self-once-script.js'),
]).then(async () => {
// Use await to serialize imports
await import('./eval-self-once-script.js');
await import('./eval-self-once-script.js');
assert.sameValue(global.evaluated, 2, 'global property was defined and incremented only once');
}).then($DONE, $DONE);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment