Merge pull request #1853 from leobalter/dyn-import-part3

Add more cases for dynamic imports
This commit is contained in:
Leo Balter 2018-10-15 14:36:01 -04:00 committed by GitHub
commit 061a8ea63a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
217 changed files with 10910 additions and 489 deletions

View File

@ -1,31 +0,0 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/module-code/dynamic-import/catch/nested-with-import-catch-
name: nested with
esid: sec-import-call-runtime-semantics-evaluation
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
features: [dynamic-import]
flags: [async, noStrict]
---*/
with ({}) {
/*{ import }*/.catch(error => {
/*{ body }*/
}).then($DONE, $DONE);
}

View File

@ -1,30 +0,0 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/module-code/dynamic-import/usage/nested-with-import-then-
name: nested with
esid: sec-import-call-runtime-semantics-evaluation
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
features: [dynamic-import]
flags: [async, noStrict]
---*/
with ({}) {
/*{ import }*/.then(imported => {
/*{ body }*/
}).then($DONE, $DONE).catch($DONE);
}

View File

@ -0,0 +1,18 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: import() from a ascript code can load a file with module code
template: default
---*/
//- setup
// This is still valid in script code, and should not be valid for module code
// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames
var smoosh; function smoosh() {}
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(imported.default, 42);
assert.sameValue(imported.x, 'Test262');
assert.sameValue(imported.z, 42);

View File

@ -0,0 +1,22 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
import() from a module code can load a file with script code, but the target
is resolved into a Module Record
info: |
Modules
Static Semantics: Early Errors
ModuleBody : ModuleItemList
- It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries.
- It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList.
template: catch
flags: [module]
---*/
//- import
import('./script-code_FIXTURE.js')
//- body
assert.sameValue(error.name, 'SyntaxError');

View File

@ -0,0 +1,81 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2018 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/module-code/dynamic-import/ns/await-
name: value from await resolving
esid: sec-finishdynamicimport
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
features: [dynamic-import]
flags: [async]
---*/
async function fn() {
const ns = await /*{ import }*/;
/*{ body }*/
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,79 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2018 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/module-code/dynamic-import/ns/promise-then-
name: value from promise then
esid: sec-finishdynamicimport
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
features: [dynamic-import]
flags: [async]
---*/
/*{ import }*/.then(ns => {
/*{ body }*/
}).then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,29 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: Module namespace objects have a Symbol.toStringTag
template: namespace
info: |
@@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: false }.
features: [Symbol.toStringTag]
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(ns[Symbol.toStringTag], 'Module');
// propertyHelper.js is not appropriate for this test because it assumes that
// the object exposes the ordinary object's implementation of [[Get]], [[Set]],
// [[Delete]], and [[OwnPropertyKeys]], which the module namespace exotic
// object does not.
var desc = Object.getOwnPropertyDescriptor(ns, Symbol.toStringTag);
assert.sameValue(desc.enumerable, false, 'reports as non-enumerable');
assert.sameValue(desc.writable, false, 'reports as non-writable');
assert.sameValue(desc.configurable, false, 'reports as non-configurable');

View File

@ -0,0 +1,114 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-defineownproperty-p-desc
desc: >
The [[DefineOwnProperty]] internal method returns `true` if no change is
requested, and `false` otherwise.
features: [Symbol.iterator, Reflect, Symbol, Symbol.toStringTag]
template: namespace
---*/
//- setup
var sym = Symbol('test262');
const exported = ['local1', 'renamed', 'indirect'];
//- import
import('./define-own-property_FIXTURE.js')
//- body
// Non-existant properties.
for (const key of ['local2', 0, sym, Symbol.iterator]) {
assert.sameValue(
Reflect.defineProperty(ns, key, {}),
false,
'Reflect.defineProperty: ' + key.toString()
);
assert.throws(TypeError, function() {
Object.defineProperty(ns, key, {});
}, 'Object.defineProperty: ' + key.toString());
}
// Own properties. No change requested.
for (const key of ([...exported, Symbol.toStringTag])) {
assert.sameValue(
Reflect.defineProperty(ns, key, {}),
true,
`No change requested, Reflect.defineProperty: ${key.toString()}`
);
assert.sameValue(
Object.defineProperty(ns, key, {}),
ns,
`No change requested, Object.defineProperty: ${key.toString()}`
);
}
assert.sameValue(
Reflect.defineProperty(ns, 'indirect',
{writable: true, enumerable: true, configurable: false}),
true,
'Reflect.defineProperty: indirect'
);
assert.sameValue(
Object.defineProperty(ns, 'indirect',
{writable: true, enumerable: true, configurable: false}),
ns,
'Object.defineProperty: indirect'
);
assert.sameValue(
Reflect.defineProperty(ns, Symbol.toStringTag,
{value: "Module", writable: false, enumerable: false,
configurable: false}),
true,
'Reflect.defineProperty: Symbol.toStringTag'
);
assert.sameValue(
Object.defineProperty(ns, Symbol.toStringTag,
{value: "Module", writable: false, enumerable: false,
configurable: false}),
ns,
'Object.defineProperty: Symbol.toStringTag'
);
// Own properties. Change requested.
for (const key of ([...exported, Symbol.toStringTag])) {
assert.sameValue(
Reflect.defineProperty(ns, key, {value: 123}),
false,
`Change requested, Reflect.defineProperty: ${key.toString()}`
);
assert.throws(TypeError, function() {
Object.defineProperty(ns, key, {value: 123});
}, `Change requested, Object.defineProperty: ${key.toString()}`);
}
assert.sameValue(
Reflect.defineProperty(ns, 'indirect',
{writable: true, enumerable: true, configurable: true}),
false,
'Reflect.defineProperty: indirect'
);
assert.throws(TypeError, function() {
Object.defineProperty(ns, 'indirect',
{writable: true, enumerable: true, configurable: true});
}, 'Object.defineProperty: indirect');
assert.sameValue(
Reflect.defineProperty(ns, Symbol.toStringTag,
{value: "module", writable: false, enumerable: false,
configurable: false}),
false,
'Reflect.defineProperty: Symbol.toStringTag'
);
assert.throws(TypeError, function() {
Object.defineProperty(ns, Symbol.toStringTag,
{value: "module", writable: false, enumerable: false,
configurable: false});
}, 'Object.defineProperty: Symbol.toStringTag');

View File

@ -0,0 +1,47 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-delete-p
desc: >
The [[Delete]] behavior for a key that describes an initialized exported
binding on non strict mode
info: |
[...]
2. If Type(P) is Symbol, then
a. Return ? OrdinaryDelete(O, P).
3. Let exports be O.[[Exports]].
4. If P is an element of exports, return false.
5. Return true.
template: namespace
flags: [noStrict]
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(delete ns.default, false, 'delete: default');
assert.sameValue(
Reflect.deleteProperty(ns, 'default'), false, 'Reflect.deleteProperty: default'
);
assert.sameValue(ns.default, 42, 'binding unmodified: default');
assert.sameValue(delete ns.local1, false, 'delete: local1');
assert.sameValue(
Reflect.deleteProperty(ns, 'local1'), false, 'Reflect.deleteProperty: local1'
);
assert.sameValue(ns.local1, 'Test262', 'binding unmodified: local1');
assert.sameValue(delete ns.renamed, false, 'delete: renamed');
assert.sameValue(
Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed'
);
assert.sameValue(ns.renamed, 'TC39', 'binding unmodified: renamed');
assert.sameValue(delete ns.indirect, false, 'delete: indirect');
assert.sameValue(
Reflect.deleteProperty(ns, 'indirect'),
false,
'Reflect.deleteProperty: indirect'
);
assert.sameValue(ns.indirect, 'Test262', 'binding unmodified: indirect');

View File

@ -0,0 +1,55 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-delete-p
desc: >
The [[Delete]] behavior for a key that describes an initialized exported
binding on strict mode
info: |
[...]
2. If Type(P) is Symbol, then
a. Return ? OrdinaryDelete(O, P).
3. Let exports be O.[[Exports]].
4. If P is an element of exports, return false.
5. Return true.
template: namespace
flags: [onlyStrict]
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
assert.throws(TypeError, function() {
delete ns.default;
}, 'delete: default');
assert.sameValue(
Reflect.deleteProperty(ns, 'default'), false, 'Reflect.deleteProperty: default'
);
assert.sameValue(ns.default, 42, 'binding unmodified: default');
assert.throws(TypeError, function() {
delete ns.local1;
}, 'delete: local1');
assert.sameValue(
Reflect.deleteProperty(ns, 'local1'), false, 'Reflect.deleteProperty: local1'
);
assert.sameValue(ns.local1, 'Test262', 'binding unmodified: local1');
assert.throws(TypeError, function() {
delete ns.renamed;
}, 'delete: renamed');
assert.sameValue(
Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed'
);
assert.sameValue(ns.renamed, 'TC39', 'binding unmodified: renamed');
assert.throws(TypeError, function() {
delete ns.indirect;
}, 'delete: indirect');
assert.sameValue(
Reflect.deleteProperty(ns, 'indirect'),
false,
'Reflect.deleteProperty: indirect'
);
assert.sameValue(ns.indirect, 'Test262', 'binding unmodified: indirect');

View File

@ -0,0 +1,37 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-delete-p
desc: >
The [[Delete]] behavior for a key that does not describe an exported binding
info: |
[...]
2. If Type(P) is Symbol, then
a. Return ? OrdinaryDelete(O, P).
3. Let exports be O.[[Exports]].
4. If P is an element of exports, return false.
5. Return true.
template: namespace
flags: [noStrict]
---*/
//- import
import('./empty_FIXTURE.js')
//- body
assert(delete ns.undef, 'delete: undef');
assert(Reflect.deleteProperty(ns, 'undef'), 'Reflect.deleteProperty: undef');
assert(delete ns.default, 'delete: default');
assert(
Reflect.deleteProperty(ns, 'default'), 'Reflect.deleteProperty: default'
);
assert.sameValue(delete ns[Symbol.toStringTag], false, 'delete: Symbol.toStringTag');
assert.sameValue(
Reflect.deleteProperty(ns, Symbol.toStringTag), false,
'Reflect.deleteProperty: Symbol.toStringTag'
);
var sym = Symbol('test262');
assert(delete ns[sym], 'delete: symbol');
assert(Reflect.deleteProperty(ns, sym), 'Reflect.deleteProperty: symbol');

View File

@ -0,0 +1,37 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-delete-p
desc: >
The [[Delete]] behavior for a key that does not describe an exported binding
info: |
[...]
2. If Type(P) is Symbol, then
a. Return ? OrdinaryDelete(O, P).
3. Let exports be O.[[Exports]].
4. If P is an element of exports, return false.
5. Return true.
template: namespace
flags: [onlyStrict]
---*/
//- import
import('./empty_FIXTURE.js')
//- body
assert(delete ns.undef, 'delete: undef');
assert(Reflect.deleteProperty(ns, 'undef'), 'Reflect.deleteProperty: undef');
assert(delete ns.default, 'delete: default');
assert(
Reflect.deleteProperty(ns, 'default'), 'Reflect.deleteProperty: default'
);
assert.sameValue(
Reflect.deleteProperty(ns, Symbol.toStringTag), false,
'Reflect.deleteProperty: Symbol.toStringTag'
);
assert.throws(TypeError, function() { delete ns[Symbol.toStringTag]; }, 'delete: Symbol.toStringTag');
var sym = Symbol('test262');
assert(delete ns[sym], 'delete: symbol');
assert(Reflect.deleteProperty(ns, sym), 'Reflect.deleteProperty: symbol');

View File

@ -0,0 +1,12 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: Module namespace objects are not extensible.
template: namespace
includes: [propertyHelper.js]
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(Object.isExtensible(ns), false);

View File

@ -0,0 +1,60 @@
// Copyright (C) 2018 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
Direct Default exports are included in an imported module namespace object when
a namespace object is created.
esid: sec-module-namespace-exotic-objects-get-p-receiver
info: |
[...]
6. Let binding be ! m.ResolveExport(P, « »).
7. Assert: binding is a ResolvedBinding Record.
8. Let targetModule be binding.[[Module]].
9. Assert: targetModule is not undefined.
10. If binding.[[BindingName]] is "*namespace*", then
11. Return ? GetModuleNamespace(targetModule).
Runtime Semantics: GetModuleNamespace
[...]
3. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames,
i. Let resolution be ? module.ResolveExport(name, « », « »).
ii. If resolution is null, throw a SyntaxError exception.
iii. If resolution is not "ambiguous", append name to
unambiguousNames.
d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames).
[...]
features: [export-star-as-namespace-from-module]
template: namespace
---*/
//- import
import('./get-nested-namespace-dflt-skip-prod_FIXTURE.js')
//- body
var desc = Object.getOwnPropertyDescriptor(ns, 'productionNS2');
assert.sameValue(desc.enumerable, true, 'ns.productionNS2: is enumerable');
assert.sameValue(desc.writable, true, 'ns.productionNS2: is writable');
assert.sameValue(desc.configurable, false, 'ns.productionNS2: is non-configurable');
var keys = Object.keys(ns.productionNS2);
assert.sameValue(keys.length, 2);
assert.sameValue(keys[0], 'default');
assert.sameValue(keys[1], 'productionOther');
desc = Object.getOwnPropertyDescriptor(ns.productionNS2, 'productionOther');
assert.sameValue(desc.value, null, 'ns.productionNS2.productionOther: value is null');
assert.sameValue(desc.enumerable, true, 'ns.productionNS2.productionOther: is enumerable');
assert.sameValue(desc.writable, true, 'ns.productionNS2.productionOther: is writable');
assert.sameValue(desc.configurable, false, 'ns.productionNS2.productionOther: is non-configurable');
desc = Object.getOwnPropertyDescriptor(ns.productionNS2, 'default');
assert.sameValue(desc.value, 42, 'ns.productionNS2.default value is 42');
assert.sameValue(desc.enumerable, true, 'ns.productionNS2.default is enumerable');
assert.sameValue(desc.writable, true, 'ns.productionNS2.default is writable');
assert.sameValue(desc.configurable, false, 'ns.productionNS2.default is non-configurable');

View File

@ -0,0 +1,61 @@
// Copyright (C) 2018 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
Inirect Default exports are included in an imported module namespace object when
a namespace object is created.
esid: sec-module-namespace-exotic-objects-get-p-receiver
info: |
[...]
6. Let binding be ! m.ResolveExport(P, « »).
7. Assert: binding is a ResolvedBinding Record.
8. Let targetModule be binding.[[Module]].
9. Assert: targetModule is not undefined.
10. If binding.[[BindingName]] is "*namespace*", then
11. Return ? GetModuleNamespace(targetModule).
Runtime Semantics: GetModuleNamespace
[...]
3. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames,
i. Let resolution be ? module.ResolveExport(name, « », « »).
ii. If resolution is null, throw a SyntaxError exception.
iii. If resolution is not "ambiguous", append name to
unambiguousNames.
d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames).
[...]
flags: [module]
features: [export-star-as-namespace-from-module]
template: namespace
---*/
//- import
import('./get-nested-namespace-dflt-skip-named_FIXTURE.js')
//- body
var desc = Object.getOwnPropertyDescriptor(ns, 'namedNS2');
assert.sameValue(desc.enumerable, true, 'ns.namedNS2: is enumerable');
assert.sameValue(desc.writable, true, 'ns.namedNS2: is writable');
assert.sameValue(desc.configurable, false, 'ns.namedNS2: is non-configurable');
var keys = Object.keys(ns.namedNS2);
assert.sameValue(keys.length, 2);
assert.sameValue(keys[0], 'default');
assert.sameValue(keys[1], 'namedOther');
desc = Object.getOwnPropertyDescriptor(ns.namedNS2, 'namedOther');
assert.sameValue(desc.value, null, 'ns.namedNS2.namedOther value is null');
assert.sameValue(desc.enumerable, true, 'ns.namedNS2.namedOther: is enumerable');
assert.sameValue(desc.writable, true, 'ns.namedNS2.namedOther: is writable');
assert.sameValue(desc.configurable, false, 'ns.namedNS2.namedOther: is non-configurable');
desc = Object.getOwnPropertyDescriptor(ns.namedNS2, 'default');
assert.sameValue(desc.value, 42, 'ns.namedNS2.default value is 42');
assert.sameValue(desc.enumerable, true, 'ns.namedNS2.default is enumerable');
assert.sameValue(desc.writable, true, 'ns.namedNS2.default is writable');
assert.sameValue(desc.configurable, false, 'ns.namedNS2.default is non-configurable');

View File

@ -0,0 +1,58 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
Module namespace object reports properties for all ExportEntries of all
dependencies.
esid: sec-moduledeclarationinstantiation
info: |
[...]
12. For each ImportEntry Record in in module.[[ImportEntries]], do
a. Let importedModule be ? HostResolveImportedModule(module,
in.[[ModuleRequest]]).
b. If in.[[ImportName]] is "*", then
i. Let namespace be ? GetModuleNamespace(importedModule).
[...]
Runtime Semantics: GetModuleNamespace
3. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames,
i. Let resolution be ? module.ResolveExport(name, « », « »).
ii. If resolution is null, throw a SyntaxError exception.
iii. If resolution is not "ambiguous", append name to
unambiguousNames.
d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames).
features: [export-star-as-namespace-from-module]
template: namespace
---*/
//- setup
function hasOwnProperty(obj, property) {
return Object.prototype.hasOwnProperty.call(obj, property);
}
//- import
import('./get-nested-namespace-props-nrml-1_FIXTURE.js')
//- body
// Export entries defined by a re-exported as exportns module
assert(hasOwnProperty(ns.exportns, 'starAsVarDecl'), 'starssVarDecl');
assert(hasOwnProperty(ns.exportns, 'starAsLetDecl'), 'starSsLetDecl');
assert(hasOwnProperty(ns.exportns, 'starAsConstDecl'), 'starSsConstDecl');
assert(hasOwnProperty(ns.exportns, 'starAsFuncDecl'), 'starAsFuncDecl');
assert(hasOwnProperty(ns.exportns, 'starAsGenDecl'), 'starAsGenDecl');
assert(hasOwnProperty(ns.exportns, 'starAsClassDecl'), 'starAsClassDecl');
assert(hasOwnProperty(ns.exportns, 'starAsBindingId'), 'starAsBindingId');
assert(hasOwnProperty(ns.exportns, 'starIdName'), 'starIdName');
assert(hasOwnProperty(ns.exportns, 'starAsIndirectIdName'), 'starAsIndirectIdName');
assert(hasOwnProperty(ns.exportns, 'starAsIndirectIdName2'), 'starAsIndirectIdName2');
assert(hasOwnProperty(ns.exportns, 'namespaceBinding'), 'namespaceBinding');
// Bindings that were not exported from any module
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedVar'), false, 'nonExportedVar');
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedLet'), false, 'nonExportedLet');
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedConst'), false, 'nonExportedConst');
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedFunc'), false, 'nonExportedFunc');
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedGen'), false, 'nonExportedGen');
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedClass'), false, 'nonExportedClass');

View File

@ -0,0 +1,58 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-getownproperty-p
desc: >
Behavior of the [[GetOwnProperty]] internal method with a string argument
describing an initialized binding
info: |
1. If Type(P) is Symbol, return OrdinaryGetOwnProperty(O, P).
2. Let exports be the value of O's [[Exports]] internal slot.
3. If P is not an element of exports, return undefined.
4. Let value be ? O.[[Get]](P, O).
5. Return PropertyDescriptor{[[Value]]: value, [[Writable]]: true,
[[Enumerable]]: true, [[Configurable]]: false }.
template: namespace
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
var desc;
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, 'local1'), true
);
desc = Object.getOwnPropertyDescriptor(ns, 'local1');
assert.sameValue(desc.value, 'Test262');
assert.sameValue(desc.enumerable, true, 'local1 enumerable');
assert.sameValue(desc.writable, true, 'local1 writable');
assert.sameValue(desc.configurable, false, 'local1 configurable');
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, 'renamed'), true
);
desc = Object.getOwnPropertyDescriptor(ns, 'renamed');
assert.sameValue(desc.value, 'TC39');
assert.sameValue(desc.enumerable, true, 'renamed enumerable');
assert.sameValue(desc.writable, true, 'renamed writable');
assert.sameValue(desc.configurable, false, 'renamed configurable');
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, 'indirect'), true
);
desc = Object.getOwnPropertyDescriptor(ns, 'indirect');
assert.sameValue(desc.value, 'Test262');
assert.sameValue(desc.enumerable, true, 'indirect enumerable');
assert.sameValue(desc.writable, true, 'indirect writable');
assert.sameValue(desc.configurable, false, 'indirect configurable');
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, 'default'), true
);
desc = Object.getOwnPropertyDescriptor(ns, 'default');
assert.sameValue(desc.value, 42);
assert.sameValue(desc.enumerable, true, 'default enumerable');
assert.sameValue(desc.writable, true, 'default writable');
assert.sameValue(desc.configurable, false, 'default configurable');

View File

@ -0,0 +1,51 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-getownproperty-p
desc: >
Behavior of the [[GetOwnProperty]] internal method with a string argument
describing a binding that cannot be found
info: |
1. If Type(P) is Symbol, return OrdinaryGetOwnProperty(O, P).
2. Let exports be the value of O's [[Exports]] internal slot.
3. If P is not an element of exports, return undefined.
template: namespace
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
var desc;
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, 'local2'),
false,
'hasOwnProperty: local2'
);
desc = Object.getOwnPropertyDescriptor(ns, 'local2');
assert.sameValue(desc, undefined, 'property descriptor for "local2"');
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, 'toStringTag'),
false,
'hasOwnProperty: toStringTag'
);
desc = Object.getOwnPropertyDescriptor(ns, 'toStringTag');
assert.sameValue(desc, undefined, 'property descriptor for "toStringTag"');
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, 'iterator'),
false,
'hasOwnProperty: iterator'
);
desc = Object.getOwnPropertyDescriptor(ns, 'iterator');
assert.sameValue(desc, undefined, 'property descriptor for "iterator"');
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, '__proto__'),
false,
'hasOwnProperty: __proto__'
);
desc = Object.getOwnPropertyDescriptor(ns, '__proto__');
assert.sameValue(desc, undefined, 'property descriptor for "__proto__"');

View File

@ -0,0 +1,31 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-getownproperty-p
desc: >
Behavior of the [[GetOwnProperty]] internal method with a Symbol argument
features: [Symbol, Symbol.toStringTag]
template: namespace
---*/
//- setup
var notFound = Symbol('test262');
//- import
import('./module-code_FIXTURE.js')
//- body
var desc;
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, Symbol.toStringTag), true
);
desc = Object.getOwnPropertyDescriptor(ns, Symbol.toStringTag);
assert.sameValue(desc.value, ns[Symbol.toStringTag]);
assert.sameValue(desc.enumerable, false, 'Symbol.toStringTag enumerable');
assert.sameValue(desc.writable, false, 'Symbol.toStringTag writable');
assert.sameValue(desc.configurable, false, 'Symbol.toStringTag configurable');
assert.sameValue(Object.prototype.hasOwnProperty.call(ns, notFound), false);
desc = Object.getOwnPropertyDescriptor(ns, notFound);
assert.sameValue(desc, undefined);

View File

@ -0,0 +1,22 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-get-p-receiver
desc: >
Behavior of the [[Get]] internal method with a string argument for exported
initialized bindings.
info: |
[...]
12. Let targetEnvRec be targetEnv's EnvironmentRecord.
13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
template: namespace
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(ns.local1, 'Test262');
assert.sameValue(ns.renamed, 'TC39');
assert.sameValue(ns.indirect, 'Test262');
assert.sameValue(ns.default, 42);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-get-p-receiver
desc: >
Behavior of the [[Get]] internal method with a string argument for
non-exported bindings
info: |
[...]
3. Let exports be the value of O's [[Exports]] internal slot.
4. If P is not an element of exports, return undefined.
template: namespace
---*/
//- setup
var local2; // not used
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(ns.local2, undefined, 'key: local2');
assert.sameValue(ns.toStringTag, undefined, 'key: toStringTag');
assert.sameValue(ns.iterator, undefined, 'key: iterator');
assert.sameValue(ns.__proto__, undefined, 'key: __proto__');

View File

@ -0,0 +1,20 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-get-p-receiver
desc: >
Behavior of the [[Get]] internal method with a symbol argument that can be
found
info: |
[...]
2. If Type(P) is Symbol, then
a. Return ? OrdinaryGet(O, P, Receiver).
features: [Symbol.toStringTag]
template: namespace
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(typeof ns[Symbol.toStringTag], 'string');

View File

@ -0,0 +1,20 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-get-p-receiver
desc: >
Behavior of the [[Get]] internal method with a symbol argument that cannot
be found
info: |
[...]
2. If Type(P) is Symbol, then
a. Return ? OrdinaryGet(O, P, Receiver).
features: [Symbol]
template: namespace
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(ns[Symbol('test262')], undefined, 'Symbol: test262');

View File

@ -0,0 +1,29 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-hasproperty-p
desc: >
Behavior of the [[HasProperty]] internal method with a string argument for
exported initialized bindings.
info: |
[...]
2. Let exports be the value of O's [[Exports]] internal slot.
3. If P is an element of exports, return true.
template: namespace
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
assert('local1' in ns, 'in: local1');
assert(Reflect.has(ns, 'local1'), 'Reflect.has: local1');
assert('renamed' in ns, 'in: renamed');
assert(Reflect.has(ns, 'renamed'), 'Reflect.has: renamed');
assert('indirect' in ns, 'in: indirect');
assert(Reflect.has(ns, 'indirect'), 'Reflect.has: indirect');
assert('default' in ns, 'in: default');
assert(Reflect.has(ns, 'default'), 'Reflect.has: default');

View File

@ -0,0 +1,37 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-hasproperty-p
desc: >
Behavior of the [[HasProperty]] internal method with a string argument for
non-exported bindings
info: |
[...]
2. Let exports be the value of O's [[Exports]] internal slot.
3. If P is an element of exports, return true.
4. Return false.
template: namespace
---*/
//- setup
var local2; // not used
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue('local2' in ns, false, 'in: local2');
assert.sameValue(Reflect.has(ns, 'local2'), false, 'Reflect.has: local2');
assert.sameValue('toStringTag' in ns, false, 'in: toStringTag');
assert.sameValue(
Reflect.has(ns, 'toStringTag'), false, 'Reflect.has: toStringTag'
);
assert.sameValue('iterator' in ns, false, 'in: iterator');
assert.sameValue(Reflect.has(ns, 'iterator'), false, 'Reflect.has: iterator');
assert.sameValue('__proto__' in ns, false, 'in: __proto__');
assert.sameValue(
Reflect.has(ns, '__proto__'), false, 'Reflect.has: __proto__'
);

View File

@ -0,0 +1,19 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-hasproperty-p
desc: >
Behavior of the [[HasProperty]] internal method with a symbol argument that
can be found
info: |
1. If Type(P) is Symbol, return OrdinaryHasProperty(O, P).
features: [Symbol.toStringTag]
template: namespace
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
assert(Symbol.toStringTag in ns, 'in: Symbol.toStringTag');
assert(Reflect.has(ns, Symbol.toStringTag), 'Reflect.has: Symbol.toStringTag');

View File

@ -0,0 +1,22 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-hasproperty-p
desc: >
Behavior of the [[HasProperty]] internal method with a symbol argument that
cannot be found
info: |
1. If Type(P) is Symbol, return OrdinaryHasProperty(O, P).
features: [Symbol]
template: namespace
---*/
//- setup
var sym = Symbol('test262');
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(sym in ns, false, 'in');
assert.sameValue(Reflect.has(ns, sym), false, 'Reflect.has');

View File

@ -0,0 +1,13 @@
// Copyright (C) 2016 Kevin Gibbons. All rights reserved.
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: Module namespace objects lack a Symbol.toStringTag
template: namespace
features: [Symbol.iterator]
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(Object.prototype.hasOwnProperty.call(ns, Symbol.iterator), false);

View File

@ -0,0 +1,64 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-ownpropertykeys
desc: >
The [[OwnPropertyKeys]] internal method reflects the sorted order
info: |
1. Let exports be a copy of the value of O's [[Exports]] internal slot.
2. Let symbolKeys be ! OrdinaryOwnPropertyKeys(O).
3. Append all the entries of symbolKeys to the end of exports.
4. Return exports.
features: [Symbol.toStringTag]
template: namespace
---*/
//- import
import('./own-keys-sort_FIXTURE.js')
//- body
var stringKeys = Object.getOwnPropertyNames(ns);
assert.sameValue(stringKeys.length, 16);
assert.sameValue(stringKeys[0], '$', 'stringKeys[0] === "$"');
assert.sameValue(stringKeys[1], '$$', 'stringKeys[1] === "$$"');
assert.sameValue(stringKeys[2], 'A', 'stringKeys[2] === "A"');
assert.sameValue(stringKeys[3], 'Z', 'stringKeys[3] === "Z"');
assert.sameValue(stringKeys[4], '_', 'stringKeys[4] === "_"');
assert.sameValue(stringKeys[5], '__', 'stringKeys[5] === "__"');
assert.sameValue(stringKeys[6], 'a', 'stringKeys[6] === "a"');
assert.sameValue(stringKeys[7], 'aa', 'stringKeys[7] === "aa"');
assert.sameValue(stringKeys[8], 'az', 'stringKeys[8] === "az"');
assert.sameValue(stringKeys[9], 'default', 'stringKeys[9] === "default"');
assert.sameValue(stringKeys[10], 'z', 'stringKeys[10] === "z"');
assert.sameValue(stringKeys[11], 'za', 'stringKeys[11] === "za"');
assert.sameValue(stringKeys[12], 'zz', 'stringKeys[12] === "zz"');
assert.sameValue(stringKeys[13], '\u03bb', 'stringKeys[13] === "\u03bb"');
assert.sameValue(stringKeys[14], '\u03bc', 'stringKeys[14] === "\u03bc"');
assert.sameValue(stringKeys[15], '\u03c0', 'stringKeys[15] === "\u03c0"');
var allKeys = Reflect.ownKeys(ns);
assert(
allKeys.length >= 17,
'at least as many keys as defined by the module and the specification'
);
assert.sameValue(allKeys[0], '$', 'allKeys[0] === "$"');
assert.sameValue(allKeys[1], '$$', 'allKeys[1] === "$$"');
assert.sameValue(allKeys[2], 'A', 'allKeys[2] === "A"');
assert.sameValue(allKeys[3], 'Z', 'allKeys[3] === "Z"');
assert.sameValue(allKeys[4], '_', 'allKeys[4] === "_"');
assert.sameValue(allKeys[5], '__', 'allKeys[5] === "__"');
assert.sameValue(allKeys[6], 'a', 'allKeys[6] === "a"');
assert.sameValue(allKeys[7], 'aa', 'allKeys[7] === "aa"');
assert.sameValue(allKeys[8], 'az', 'allKeys[8] === "az"');
assert.sameValue(allKeys[9], 'default', 'allKeys[9] === "default"');
assert.sameValue(allKeys[10], 'z', 'allKeys[10] === "z"');
assert.sameValue(allKeys[11], 'za', 'allKeys[11] === "za"');
assert.sameValue(allKeys[12], 'zz', 'allKeys[12] === "zz"');
assert.sameValue(allKeys[13], '\u03bb', 'allKeys[13] === "\u03bb"');
assert.sameValue(allKeys[14], '\u03bc', 'allKeys[14] === "\u03bc"');
assert.sameValue(allKeys[15], '\u03c0', 'allKeys[15] === "\u03c0"');
assert(
allKeys.indexOf(Symbol.toStringTag) > 15,
'keys array includes Symbol.toStringTag'
);

View File

@ -0,0 +1,16 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-preventextensions
desc: The [[PreventExtensions]] internal method returns `true`
template: namespace
---*/
//- import
import('./empty_FIXTURE.js')
//- body
// This invocation should not throw an exception
Object.preventExtensions(ns);
assert.sameValue(Reflect.preventExtensions(ns), true);

View File

@ -0,0 +1,13 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-preventextensions
desc: The [[PreventExtensions]] internal method returns `true`
template: namespace
---*/
//- import
import('./empty_FIXTURE.js')
//- body
assert.sameValue(Reflect.preventExtensions(ns), true);

View File

@ -0,0 +1,41 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: imported object properties descriptors
template: namespace
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
// propertyHelper.js is not appropriate for this test because it assumes that
// the object exposes the ordinary object's implementation of [[Get]], [[Set]],
// [[Delete]], and [[OwnPropertyKeys]], which the module namespace exotic
// object does not.
var desc = Object.getOwnPropertyDescriptor(ns, 'default');
assert.sameValue(desc.value, 42, 'default: value is 42');
assert.sameValue(desc.enumerable, true, 'default: is enumerable');
assert.sameValue(desc.writable, true, 'default: is writable');
assert.sameValue(desc.configurable, false, 'default: is non-configurable');
desc = Object.getOwnPropertyDescriptor(ns, 'local1');
assert.sameValue(desc.value, 'Test262', 'local1: value is "Test262"');
assert.sameValue(desc.enumerable, true, 'local1: is enumerable');
assert.sameValue(desc.writable, true, 'local1: is writable');
assert.sameValue(desc.configurable, false, 'local1: is non-configurable');
desc = Object.getOwnPropertyDescriptor(ns, 'renamed');
assert.sameValue(desc.value, 'TC39', 'renamed: value is TC39"');
assert.sameValue(desc.enumerable, true, 'renamed: is enumerable');
assert.sameValue(desc.writable, true, 'renamed: is writable');
assert.sameValue(desc.configurable, false, 'renamed: is non-configurable');
desc = Object.getOwnPropertyDescriptor(ns, 'indirect');
assert.sameValue(desc.value, 'Test262', 'indirect: value is Test262"');
assert.sameValue(desc.enumerable, true, 'indirect: is enumerable');
assert.sameValue(desc.writable, true, 'indirect: is writable');
assert.sameValue(desc.configurable, false, 'indirect: is non-configurable');

View File

@ -0,0 +1,12 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: Module namespace object prototype is null
template: namespace
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(ns instanceof Object, false);
assert.sameValue(Object.getPrototypeOf(ns), null, 'prototype is null');

View File

@ -0,0 +1,43 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-set-p-v-receiver
desc: The [[Set]] internal method consistently returns `false`, No Strict Mode
info: |
1. Return false.
features: [Symbol, Symbol.toStringTag]
template: namespace
flags: [noStrict]
---*/
//- setup
var sym = Symbol('test262');
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(Reflect.set(ns, 'local1'), false, 'Reflect.set: local1');
assert.sameValue(ns.local1 = null, null, 'AssignmentExpression: local1');
assert.sameValue(Reflect.set(ns, 'local2'), false, 'Reflect.set: local2');
assert.sameValue(ns.local2 = null, null, 'AssignmentExpression: local2');
assert.sameValue(Reflect.set(ns, 'renamed'), false, 'Reflect.set: renamed');
assert.sameValue(ns.renamed = null, null, 'AssignmentExpression: renamed');
assert.sameValue(Reflect.set(ns, 'indirect'), false, 'Reflect.set: indirect');
assert.sameValue(ns.indirect = null, null, 'AssignmentExpression: indirect');
assert.sameValue(Reflect.set(ns, 'default'), false, 'Reflect.set: default');
assert.sameValue(ns.default = null, null, 'AssignmentExpression: default');
assert.sameValue(
Reflect.set(ns, Symbol.toStringTag, null),
false,
'Reflect.set: Symbol.toStringTag'
);
assert.sameValue(ns[Symbol.toStringTag] = null, null, 'AssignmentExpression: Symbol.toStringTag');
assert.sameValue(Reflect.set(ns, sym), false, 'Reflect.set: sym');
assert.sameValue(ns[sym] = null, null, 'AssignmentExpression: sym');

View File

@ -0,0 +1,16 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-setprototypeof-v
desc: >
The [[SetPrototypeOf]] internal method returns `true` if
passed `null`
template: namespace
---*/
//- import
import('./empty_FIXTURE.js')
//- body
assert.sameValue(typeof Object.setPrototypeOf, 'function');
assert.sameValue(ns, Object.setPrototypeOf(ns, null));

View File

@ -0,0 +1,19 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-setprototypeof
desc: The [[SetPrototypeOf]] internal method returns `false`
template: namespace
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
var newProto = {};
assert.sameValue(typeof Object.setPrototypeOf, 'function');
assert.throws(TypeError, function() {
Object.setPrototypeOf(ns, newProto);
});

View File

@ -0,0 +1,36 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-set-p-v-receiver
desc: >
The [[Set]] internal method consistently returns `false` even setting
the same value - No Strict Mode
info: |
1. Return false.
features: [Symbol, Symbol.toStringTag]
template: namespace
flags: [noStrict]
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(Reflect.set(ns, 'local1', 'Test262'), false, 'Reflect.set: local1');
assert.sameValue(ns.local1 = 'Test262', 'Test262', 'AssignmentExpression: local1');
assert.sameValue(Reflect.set(ns, 'renamed', 'TC39'), false, 'Reflect.set: renamed');
assert.sameValue(ns.renamed = 'TC39', 'TC39', 'AssignmentExpression: renamed');
assert.sameValue(Reflect.set(ns, 'indirect', 'Test262'), false, 'Reflect.set: indirect');
assert.sameValue(ns.indirect = 'Test262', 'Test262', 'AssignmentExpression: indirect');
assert.sameValue(Reflect.set(ns, 'default', 42), false, 'Reflect.set: default');
assert.sameValue(ns.default = 42, 42, 'AssignmentExpression: default');
assert.sameValue(
Reflect.set(ns, Symbol.toStringTag, ns[Symbol.toStringTag]),
false,
'Reflect.set: Symbol.toStringTag'
);
assert.sameValue(ns[Symbol.toStringTag] = ns[Symbol.toStringTag], 'Module', 'AssignmentExpression: Symbol.toStringTag');

View File

@ -0,0 +1,46 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-set-p-v-receiver
desc: >
The [[Set]] internal method consistently returns `false` even setting
the same value - Strict Mode
info: |
1. Return false.
features: [Symbol, Symbol.toStringTag]
template: namespace
flags: [onlyStrict]
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(Reflect.set(ns, 'local1', 'Test262'), false, 'Reflect.set: local1');
assert.throws(TypeError, function() {
ns.local1 = 'Test262';
}, 'AssignmentExpression: local1');
assert.sameValue(Reflect.set(ns, 'renamed', 'TC39'), false, 'Reflect.set: renamed');
assert.throws(TypeError, function() {
ns.renamed = 'TC39';
}, 'AssignmentExpression: renamed');
assert.sameValue(Reflect.set(ns, 'indirect', 'Test262'), false, 'Reflect.set: indirect');
assert.throws(TypeError, function() {
ns.indirect = 'Test262';
}, 'AssignmentExpression: indirect');
assert.sameValue(Reflect.set(ns, 'default', 42), false, 'Reflect.set: default');
assert.throws(TypeError, function() {
ns.default = 42;
}, 'AssignmentExpression: default');
assert.sameValue(
Reflect.set(ns, Symbol.toStringTag, ns[Symbol.toStringTag]),
false,
'Reflect.set: Symbol.toStringTag'
);
assert.throws(TypeError, function() {
ns[Symbol.toStringTag] = ns[Symbol.toStringTag];
}, 'AssignmentExpression: Symbol.toStringTag');

View File

@ -0,0 +1,57 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-set-p-v-receiver
desc: The [[Set]] internal method consistently returns `false`, Strict Mode
info: |
1. Return false.
features: [Symbol, Symbol.toStringTag]
template: namespace
flags: [onlyStrict]
---*/
//- setup
var sym = Symbol('test262');
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(Reflect.set(ns, 'local1'), false, 'Reflect.set: local1');
assert.throws(TypeError, function() {
ns.local1 = null;
}, 'AssignmentExpression: local1');
assert.sameValue(Reflect.set(ns, 'local2'), false, 'Reflect.set: local2');
assert.throws(TypeError, function() {
ns.local2 = null;
}, 'AssignmentExpression: local2');
assert.sameValue(Reflect.set(ns, 'renamed'), false, 'Reflect.set: renamed');
assert.throws(TypeError, function() {
ns.renamed = null;
}, 'AssignmentExpression: renamed');
assert.sameValue(Reflect.set(ns, 'indirect'), false, 'Reflect.set: indirect');
assert.throws(TypeError, function() {
ns.indirect = null;
}, 'AssignmentExpression: indirect');
assert.sameValue(Reflect.set(ns, 'default'), false, 'Reflect.set: default');
assert.throws(TypeError, function() {
ns.default = null;
}, 'AssignmentExpression: default');
assert.sameValue(
Reflect.set(ns, Symbol.toStringTag, null),
false,
'Reflect.set: Symbol.toStringTag'
);
assert.throws(TypeError, function() {
ns[Symbol.toStringTag] = null;
}, 'AssignmentExpression: Symbol.toStringTag');
assert.sameValue(Reflect.set(ns, sym), false, 'Reflect.set: sym');
assert.throws(TypeError, function() {
ns[sym] = null;
}, 'AssignmentExpression: sym');

View File

@ -2,7 +2,7 @@
// Copyright (C) 2018 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: Dynamic import() returns a Promise object.
desc: Dynamic import() returns a thenable object.
template: default
---*/

View File

@ -11,4 +11,4 @@ template: syntax/valid
var smoosh; function smoosh() {}
//- import
import('./script-code-valid.js')
import('./empty_FIXTURE.js')

View File

@ -0,0 +1,36 @@
// Copyright (C) 2018 Rick Waldron. All rights reserved.
// Copyright (C) 2018 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
Abrupt from ToString(specifier) rejects the promise
esid: sec-moduleevaluation
info: |
Import Calls
Runtime Semantics: Evaluation
ImportCall : import(AssignmentExpression)
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Let argRef be the result of evaluating AssignmentExpression.
3. Let specifier be ? GetValue(argRef).
4. Let promiseCapability be ! NewPromiseCapability(%Promise%).
5. Let specifierString be ToString(specifier).
6. IfAbruptRejectPromise(specifierString, promiseCapability).
7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
8. Return promiseCapability.[[Promise]].
template: catch
---*/
//- setup
const obj = {
toString() {
throw 'custom error';
}
};
//- import
import(obj)
//- body
assert.sameValue(error, 'custom error');

View File

@ -0,0 +1,38 @@
// Copyright (C) 2018 Rick Waldron. All rights reserved.
// Copyright (C) 2018 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
ToString value of specifier
esid: sec-moduleevaluation
info: |
Import Calls
Runtime Semantics: Evaluation
ImportCall : import(AssignmentExpression)
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Let argRef be the result of evaluating AssignmentExpression.
3. Let specifier be ? GetValue(argRef).
4. Let promiseCapability be ! NewPromiseCapability(%Promise%).
5. Let specifierString be ToString(specifier).
6. IfAbruptRejectPromise(specifierString, promiseCapability).
7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
8. Return promiseCapability.[[Promise]].
template: default
---*/
//- setup
const obj = {
toString() {
return './module-code_FIXTURE.js';
}
};
//- import
import(obj)
//- body
assert.sameValue(imported.default, 42);
assert.sameValue(imported.x, 'Test262');
assert.sameValue(imported.z, 42);

View File

@ -0,0 +1,37 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Return Abrupt from the GetValue evaluation on the given AssignmentExpression
esid: sec-import-call-runtime-semantics-evaluation
info: |
Import Calls
Runtime Semantics: Evaluation
ImportCall : import(AssignmentExpression)
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Let argRef be the result of evaluating AssignmentExpression.
3. Let specifier be ? GetValue(argRef).
4. Let promiseCapability be ! NewPromiseCapability(%Promise%).
5. Let specifierString be ToString(specifier).
6. IfAbruptRejectPromise(specifierString, promiseCapability).
7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
8. Return promiseCapability.[[Promise]].
features: [dynamic-import]
---*/
const obj = {
get err() {
throw new Test262Error('catpure this on evaluation')
}
}
assert.throws(Test262Error, function() {
import(obj.err);
}, 'Custom Error getting property value');
assert.throws(ReferenceError, function() {
import(refErr);
}, 'bad reference');

View File

@ -0,0 +1,42 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/eval-script-code-target.case
// - src/dynamic-import/catch/nested-arrow.template
/*---
description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested arrow)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, module, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Modules
Static Semantics: Early Errors
ModuleBody : ModuleItemList
- It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries.
- It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList.
---*/
let f = () => {
import('./script-code_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'SyntaxError');
}).then($DONE, $DONE);
};
f();

View File

@ -0,0 +1,55 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-arrow.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested arrow)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import(AssignmentExpression)
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Let argRef be the result of evaluating AssignmentExpression.
3. Let specifier be ? GetValue(argRef).
4. Let promiseCapability be ! NewPromiseCapability(%Promise%).
5. Let specifierString be ToString(specifier).
6. IfAbruptRejectPromise(specifierString, promiseCapability).
7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
8. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
let f = () => {
import(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
};
f();

View File

@ -0,0 +1,42 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/eval-script-code-target.case
// - src/dynamic-import/catch/nested-async-function-await.template
/*---
description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested in async function, awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, module, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Modules
Static Semantics: Early Errors
ModuleBody : ModuleItemList
- It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries.
- It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList.
---*/
async function f() {
await import('./script-code_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'SyntaxError');
}).then($DONE, $DONE);
}
f();

View File

@ -0,0 +1,55 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-async-function-await.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested in async function, awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import(AssignmentExpression)
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Let argRef be the result of evaluating AssignmentExpression.
3. Let specifier be ? GetValue(argRef).
4. Let promiseCapability be ! NewPromiseCapability(%Promise%).
5. Let specifierString be ToString(specifier).
6. IfAbruptRejectPromise(specifierString, promiseCapability).
7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
8. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
async function f() {
await import(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
}
f();

View File

@ -0,0 +1,43 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/eval-script-code-target.case
// - src/dynamic-import/catch/nested-async-function.template
/*---
description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested in async function)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, module, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Modules
Static Semantics: Early Errors
ModuleBody : ModuleItemList
- It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries.
- It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList.
---*/
async function f() {
import('./script-code_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'SyntaxError');
}).then($DONE, $DONE);
}
f();

View File

@ -0,0 +1,42 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/eval-script-code-target.case
// - src/dynamic-import/catch/nested-async-function-return-await.template
/*---
description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested in async function, returns awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, module, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Modules
Static Semantics: Early Errors
ModuleBody : ModuleItemList
- It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries.
- It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList.
---*/
async function f() {
return await import('./script-code_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'SyntaxError');
}).then($DONE, $DONE);
}
f();

View File

@ -0,0 +1,55 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-async-function-return-await.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested in async function, returns awaited)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import(AssignmentExpression)
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Let argRef be the result of evaluating AssignmentExpression.
3. Let specifier be ? GetValue(argRef).
4. Let promiseCapability be ! NewPromiseCapability(%Promise%).
5. Let specifierString be ToString(specifier).
6. IfAbruptRejectPromise(specifierString, promiseCapability).
7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
8. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
async function f() {
return await import(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
}
f();

View File

@ -0,0 +1,56 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-async-function.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested in async function)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import(AssignmentExpression)
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Let argRef be the result of evaluating AssignmentExpression.
3. Let specifier be ? GetValue(argRef).
4. Let promiseCapability be ! NewPromiseCapability(%Promise%).
5. Let specifierString be ToString(specifier).
6. IfAbruptRejectPromise(specifierString, promiseCapability).
7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
8. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
async function f() {
import(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
}
f();

View File

@ -0,0 +1,40 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/eval-script-code-target.case
// - src/dynamic-import/catch/nested-block.template
/*---
description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested block)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, module, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Modules
Static Semantics: Early Errors
ModuleBody : ModuleItemList
- It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries.
- It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList.
---*/
{
import('./script-code_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'SyntaxError');
}).then($DONE, $DONE);
};

View File

@ -0,0 +1,53 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-block.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested block)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import(AssignmentExpression)
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Let argRef be the result of evaluating AssignmentExpression.
3. Let specifier be ? GetValue(argRef).
4. Let promiseCapability be ! NewPromiseCapability(%Promise%).
5. Let specifierString be ToString(specifier).
6. IfAbruptRejectPromise(specifierString, promiseCapability).
7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
8. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
{
import(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
};

View File

@ -0,0 +1,40 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/eval-script-code-target.case
// - src/dynamic-import/catch/nested-block-labeled.template
/*---
description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested block syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, module, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Modules
Static Semantics: Early Errors
ModuleBody : ModuleItemList
- It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries.
- It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList.
---*/
label: {
import('./script-code_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'SyntaxError');
}).then($DONE, $DONE);
};

View File

@ -0,0 +1,53 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-block-labeled.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested block syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import(AssignmentExpression)
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Let argRef be the result of evaluating AssignmentExpression.
3. Let specifier be ? GetValue(argRef).
4. Let promiseCapability be ! NewPromiseCapability(%Promise%).
5. Let specifierString be ToString(specifier).
6. IfAbruptRejectPromise(specifierString, promiseCapability).
7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
8. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
label: {
import(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
};

View File

@ -0,0 +1,40 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/eval-script-code-target.case
// - src/dynamic-import/catch/nested-do-while.template
/*---
description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested do while syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, module, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Modules
Static Semantics: Early Errors
ModuleBody : ModuleItemList
- It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries.
- It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList.
---*/
do {
import('./script-code_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'SyntaxError');
}).then($DONE, $DONE);
} while (false);

View File

@ -0,0 +1,53 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-do-while.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested do while syntax)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import(AssignmentExpression)
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Let argRef be the result of evaluating AssignmentExpression.
3. Let specifier be ? GetValue(argRef).
4. Let promiseCapability be ! NewPromiseCapability(%Promise%).
5. Let specifierString be ToString(specifier).
6. IfAbruptRejectPromise(specifierString, promiseCapability).
7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
8. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
do {
import(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
} while (false);

View File

@ -0,0 +1,42 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/eval-script-code-target.case
// - src/dynamic-import/catch/nested-else.template
/*---
description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested else)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, module, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Modules
Static Semantics: Early Errors
ModuleBody : ModuleItemList
- It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries.
- It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList.
---*/
if (false) {
} else {
import('./script-code_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'SyntaxError');
}).then($DONE, $DONE);
}

View File

@ -0,0 +1,55 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-else.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested else)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import(AssignmentExpression)
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Let argRef be the result of evaluating AssignmentExpression.
3. Let specifier be ? GetValue(argRef).
4. Let promiseCapability be ! NewPromiseCapability(%Promise%).
5. Let specifierString be ToString(specifier).
6. IfAbruptRejectPromise(specifierString, promiseCapability).
7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
8. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
if (false) {
} else {
import(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
}

View File

@ -0,0 +1,41 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/eval-script-code-target.case
// - src/dynamic-import/catch/nested-function.template
/*---
description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested function)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, module, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Modules
Static Semantics: Early Errors
ModuleBody : ModuleItemList
- It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries.
- It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList.
---*/
function f() {
import('./script-code_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'SyntaxError');
}).then($DONE, $DONE);
}
f();

View File

@ -0,0 +1,54 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-function.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested function)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import(AssignmentExpression)
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Let argRef be the result of evaluating AssignmentExpression.
3. Let specifier be ? GetValue(argRef).
4. Let promiseCapability be ! NewPromiseCapability(%Promise%).
5. Let specifierString be ToString(specifier).
6. IfAbruptRejectPromise(specifierString, promiseCapability).
7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
8. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
function f() {
import(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
}
f();

View File

@ -0,0 +1,40 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/eval-script-code-target.case
// - src/dynamic-import/catch/nested-if.template
/*---
description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested if)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, module, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Modules
Static Semantics: Early Errors
ModuleBody : ModuleItemList
- It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries.
- It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList.
---*/
if (true) {
import('./script-code_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'SyntaxError');
}).then($DONE, $DONE);
}

View File

@ -0,0 +1,53 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-if.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested if)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import(AssignmentExpression)
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Let argRef be the result of evaluating AssignmentExpression.
3. Let specifier be ? GetValue(argRef).
4. Let promiseCapability be ! NewPromiseCapability(%Promise%).
5. Let specifierString be ToString(specifier).
6. IfAbruptRejectPromise(specifierString, promiseCapability).
7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
8. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
if (true) {
import(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
}

View File

@ -0,0 +1,42 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/eval-script-code-target.case
// - src/dynamic-import/catch/nested-while.template
/*---
description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested while)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, module, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Modules
Static Semantics: Early Errors
ModuleBody : ModuleItemList
- It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries.
- It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList.
---*/
let x = 0;
while (!x) {
x++;
import('./script-code_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'SyntaxError');
}).then($DONE, $DONE);
};

View File

@ -0,0 +1,55 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/nested-while.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (nested while)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import(AssignmentExpression)
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Let argRef be the result of evaluating AssignmentExpression.
3. Let specifier be ? GetValue(argRef).
4. Let promiseCapability be ! NewPromiseCapability(%Promise%).
5. Let specifierString be ToString(specifier).
6. IfAbruptRejectPromise(specifierString, promiseCapability).
7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
8. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
let x = 0;
while (!x) {
x++;
import(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);
};

View File

@ -1,39 +0,0 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case
// - src/dynamic-import/catch/nested-with.template
/*---
description: Abrupt completion during module evaluation precludes further evaluation (nested with)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, async, noStrict]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
[...]
6. For each String required that is an element of
module.[[RequestedModules]] do,
a. Let requiredModule be ? HostResolveImportedModule(module, required).
b. Perform ? requiredModule.ModuleEvaluation().
---*/
with ({}) {
import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'TypeError');
}).then($DONE, $DONE);
}

View File

@ -1,39 +0,0 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/eval-rqstd-abrupt-urierror.case
// - src/dynamic-import/catch/nested-with.template
/*---
description: Abrupt completion during module evaluation precludes further evaluation (nested with)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, async, noStrict]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
[...]
6. For each String required that is an element of
module.[[RequestedModules]] do,
a. Let requiredModule be ? HostResolveImportedModule(module, required).
b. Perform ? requiredModule.ModuleEvaluation().
---*/
with ({}) {
import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'URIError');
}).then($DONE, $DONE);
}

View File

@ -1,36 +0,0 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/file-does-not-exist.case
// - src/dynamic-import/catch/nested-with.template
/*---
description: Non existent file can't resolve to a Script or Module Record (nested with)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, async, noStrict]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule,
specifier does not exist or cannot be created, an exception must be thrown.
---*/
with ({}) {
import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => {
assert.notSameValue(typeof error, 'undefined');
}).then($DONE, $DONE);
}

View File

@ -1,60 +0,0 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/instn-iee-err-ambiguous-import.case
// - src/dynamic-import/catch/nested-with.template
/*---
description: IndirectExportEntries validation - ambiguous imported bindings (nested with)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, async, noStrict]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
[...]
9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »).
b. If resolution is null or resolution is "ambiguous", throw a
SyntaxError exception.
[...]
15.2.1.16.3 ResolveExport
[...]
9. Let starResolution be null.
10. For each ExportEntry Record e in module.[[StarExportEntries]], do
a. Let importedModule be ? HostResolveImportedModule(module,
e.[[ModuleRequest]]).
b. Let resolution be ? importedModule.ResolveExport(exportName,
resolveSet, exportStarSet).
c. If resolution is "ambiguous", return "ambiguous".
d. If resolution is not null, then
i. If starResolution is null, let starResolution be resolution.
ii. Else,
1. Assert: there is more than one * import that includes the
requested name.
2. If resolution.[[Module]] and starResolution.[[Module]] are
not the same Module Record or
SameValue(resolution.[[BindingName]],
starResolution.[[BindingName]]) is false, return "ambiguous".
---*/
with ({}) {
import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'SyntaxError');
}).then($DONE, $DONE);
}

View File

@ -1,49 +0,0 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/instn-iee-err-circular.case
// - src/dynamic-import/catch/nested-with.template
/*---
description: IndirectExportEntries validation - circular imported bindings (nested with)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, async, noStrict]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
[...]
9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »).
b. If resolution is null or resolution is "ambiguous", throw a
SyntaxError exception.
[...]
15.2.1.16.3 ResolveExport
[...]
2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do:
a. If module and r.[[Module]] are the same Module Record and
SameValue(exportName, r.[[ExportName]]) is true, then
i. Assert: this is a circular import request.
ii. Return null.
---*/
with ({}) {
import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'SyntaxError');
}).then($DONE, $DONE);
}

View File

@ -0,0 +1,7 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
// This is still valid in script code and strict and non strict modes
// This is valid as module code
// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames
var smoosh; function smoosh() {}

View File

@ -0,0 +1,38 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/eval-script-code-target.case
// - src/dynamic-import/catch/top-level.template
/*---
description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (top level)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, module, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Modules
Static Semantics: Early Errors
ModuleBody : ModuleItemList
- It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries.
- It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList.
---*/
import('./script-code_FIXTURE.js').catch(error => {
assert.sameValue(error.name, 'SyntaxError');
}).then($DONE, $DONE);

View File

@ -0,0 +1,51 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/specifier-tostring-abrupt-rejects.case
// - src/dynamic-import/catch/top-level.template
/*---
description: Abrupt from ToString(specifier) rejects the promise (top level)
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
flags: [generated, async]
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
Import Calls
Runtime Semantics: Evaluation
ImportCall : import(AssignmentExpression)
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Let argRef be the result of evaluating AssignmentExpression.
3. Let specifier be ? GetValue(argRef).
4. Let promiseCapability be ! NewPromiseCapability(%Promise%).
5. Let specifierString be ToString(specifier).
6. IfAbruptRejectPromise(specifierString, promiseCapability).
7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
8. Return promiseCapability.[[Promise]].
---*/
const obj = {
toString() {
throw 'custom error';
}
};
import(obj).catch(error => {
assert.sameValue(error, 'custom error');
}).then($DONE, $DONE);

View File

@ -0,0 +1,4 @@
// Copyright (C) 2018 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
export var x = 1;

View File

@ -0,0 +1,98 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-Symbol-toStringTag.case
// - src/dynamic-import/namespace/await.template
/*---
description: Module namespace objects have a Symbol.toStringTag (value from await resolving)
esid: sec-finishdynamicimport
features: [Symbol.toStringTag, dynamic-import]
flags: [generated, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
@@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: false }.
---*/
async function fn() {
const ns = await import('./module-code_FIXTURE.js');
assert.sameValue(ns[Symbol.toStringTag], 'Module');
// propertyHelper.js is not appropriate for this test because it assumes that
// the object exposes the ordinary object's implementation of [[Get]], [[Set]],
// [[Delete]], and [[OwnPropertyKeys]], which the module namespace exotic
// object does not.
var desc = Object.getOwnPropertyDescriptor(ns, Symbol.toStringTag);
assert.sameValue(desc.enumerable, false, 'reports as non-enumerable');
assert.sameValue(desc.writable, false, 'reports as non-writable');
assert.sameValue(desc.configurable, false, 'reports as non-configurable');
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,177 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-define-own-property.case
// - src/dynamic-import/namespace/await.template
/*---
description: The [[DefineOwnProperty]] internal method returns `true` if no change is requested, and `false` otherwise. (value from await resolving)
esid: sec-finishdynamicimport
features: [Symbol.iterator, Reflect, Symbol, Symbol.toStringTag, dynamic-import]
flags: [generated, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
---*/
var sym = Symbol('test262');
const exported = ['local1', 'renamed', 'indirect'];
async function fn() {
const ns = await import('./define-own-property_FIXTURE.js');
// Non-existant properties.
for (const key of ['local2', 0, sym, Symbol.iterator]) {
assert.sameValue(
Reflect.defineProperty(ns, key, {}),
false,
'Reflect.defineProperty: ' + key.toString()
);
assert.throws(TypeError, function() {
Object.defineProperty(ns, key, {});
}, 'Object.defineProperty: ' + key.toString());
}
// Own properties. No change requested.
for (const key of ([...exported, Symbol.toStringTag])) {
assert.sameValue(
Reflect.defineProperty(ns, key, {}),
true,
`No change requested, Reflect.defineProperty: ${key.toString()}`
);
assert.sameValue(
Object.defineProperty(ns, key, {}),
ns,
`No change requested, Object.defineProperty: ${key.toString()}`
);
}
assert.sameValue(
Reflect.defineProperty(ns, 'indirect',
{writable: true, enumerable: true, configurable: false}),
true,
'Reflect.defineProperty: indirect'
);
assert.sameValue(
Object.defineProperty(ns, 'indirect',
{writable: true, enumerable: true, configurable: false}),
ns,
'Object.defineProperty: indirect'
);
assert.sameValue(
Reflect.defineProperty(ns, Symbol.toStringTag,
{value: "Module", writable: false, enumerable: false,
configurable: false}),
true,
'Reflect.defineProperty: Symbol.toStringTag'
);
assert.sameValue(
Object.defineProperty(ns, Symbol.toStringTag,
{value: "Module", writable: false, enumerable: false,
configurable: false}),
ns,
'Object.defineProperty: Symbol.toStringTag'
);
// Own properties. Change requested.
for (const key of ([...exported, Symbol.toStringTag])) {
assert.sameValue(
Reflect.defineProperty(ns, key, {value: 123}),
false,
`Change requested, Reflect.defineProperty: ${key.toString()}`
);
assert.throws(TypeError, function() {
Object.defineProperty(ns, key, {value: 123});
}, `Change requested, Object.defineProperty: ${key.toString()}`);
}
assert.sameValue(
Reflect.defineProperty(ns, 'indirect',
{writable: true, enumerable: true, configurable: true}),
false,
'Reflect.defineProperty: indirect'
);
assert.throws(TypeError, function() {
Object.defineProperty(ns, 'indirect',
{writable: true, enumerable: true, configurable: true});
}, 'Object.defineProperty: indirect');
assert.sameValue(
Reflect.defineProperty(ns, Symbol.toStringTag,
{value: "module", writable: false, enumerable: false,
configurable: false}),
false,
'Reflect.defineProperty: Symbol.toStringTag'
);
assert.throws(TypeError, function() {
Object.defineProperty(ns, Symbol.toStringTag,
{value: "module", writable: false, enumerable: false,
configurable: false});
}, 'Object.defineProperty: Symbol.toStringTag');
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,112 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-delete-exported-init-no-strict.case
// - src/dynamic-import/namespace/await.template
/*---
description: The [[Delete]] behavior for a key that describes an initialized exported binding on non strict mode (value from await resolving)
esid: sec-finishdynamicimport
features: [dynamic-import]
flags: [generated, noStrict, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
[...]
2. If Type(P) is Symbol, then
a. Return ? OrdinaryDelete(O, P).
3. Let exports be O.[[Exports]].
4. If P is an element of exports, return false.
5. Return true.
---*/
async function fn() {
const ns = await import('./module-code_FIXTURE.js');
assert.sameValue(delete ns.default, false, 'delete: default');
assert.sameValue(
Reflect.deleteProperty(ns, 'default'), false, 'Reflect.deleteProperty: default'
);
assert.sameValue(ns.default, 42, 'binding unmodified: default');
assert.sameValue(delete ns.local1, false, 'delete: local1');
assert.sameValue(
Reflect.deleteProperty(ns, 'local1'), false, 'Reflect.deleteProperty: local1'
);
assert.sameValue(ns.local1, 'Test262', 'binding unmodified: local1');
assert.sameValue(delete ns.renamed, false, 'delete: renamed');
assert.sameValue(
Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed'
);
assert.sameValue(ns.renamed, 'TC39', 'binding unmodified: renamed');
assert.sameValue(delete ns.indirect, false, 'delete: indirect');
assert.sameValue(
Reflect.deleteProperty(ns, 'indirect'),
false,
'Reflect.deleteProperty: indirect'
);
assert.sameValue(ns.indirect, 'Test262', 'binding unmodified: indirect');
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,120 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-delete-exported-init-strict.case
// - src/dynamic-import/namespace/await.template
/*---
description: The [[Delete]] behavior for a key that describes an initialized exported binding on strict mode (value from await resolving)
esid: sec-finishdynamicimport
features: [dynamic-import]
flags: [generated, onlyStrict, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
[...]
2. If Type(P) is Symbol, then
a. Return ? OrdinaryDelete(O, P).
3. Let exports be O.[[Exports]].
4. If P is an element of exports, return false.
5. Return true.
---*/
async function fn() {
const ns = await import('./module-code_FIXTURE.js');
assert.throws(TypeError, function() {
delete ns.default;
}, 'delete: default');
assert.sameValue(
Reflect.deleteProperty(ns, 'default'), false, 'Reflect.deleteProperty: default'
);
assert.sameValue(ns.default, 42, 'binding unmodified: default');
assert.throws(TypeError, function() {
delete ns.local1;
}, 'delete: local1');
assert.sameValue(
Reflect.deleteProperty(ns, 'local1'), false, 'Reflect.deleteProperty: local1'
);
assert.sameValue(ns.local1, 'Test262', 'binding unmodified: local1');
assert.throws(TypeError, function() {
delete ns.renamed;
}, 'delete: renamed');
assert.sameValue(
Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed'
);
assert.sameValue(ns.renamed, 'TC39', 'binding unmodified: renamed');
assert.throws(TypeError, function() {
delete ns.indirect;
}, 'delete: indirect');
assert.sameValue(
Reflect.deleteProperty(ns, 'indirect'),
false,
'Reflect.deleteProperty: indirect'
);
assert.sameValue(ns.indirect, 'Test262', 'binding unmodified: indirect');
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,104 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-delete-non-exported-no-strict.case
// - src/dynamic-import/namespace/await.template
/*---
description: The [[Delete]] behavior for a key that does not describe an exported binding (value from await resolving)
esid: sec-finishdynamicimport
features: [dynamic-import]
flags: [generated, noStrict, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
[...]
2. If Type(P) is Symbol, then
a. Return ? OrdinaryDelete(O, P).
3. Let exports be O.[[Exports]].
4. If P is an element of exports, return false.
5. Return true.
---*/
async function fn() {
const ns = await import('./empty_FIXTURE.js');
assert(delete ns.undef, 'delete: undef');
assert(Reflect.deleteProperty(ns, 'undef'), 'Reflect.deleteProperty: undef');
assert(delete ns.default, 'delete: default');
assert(
Reflect.deleteProperty(ns, 'default'), 'Reflect.deleteProperty: default'
);
assert.sameValue(delete ns[Symbol.toStringTag], false, 'delete: Symbol.toStringTag');
assert.sameValue(
Reflect.deleteProperty(ns, Symbol.toStringTag), false,
'Reflect.deleteProperty: Symbol.toStringTag'
);
var sym = Symbol('test262');
assert(delete ns[sym], 'delete: symbol');
assert(Reflect.deleteProperty(ns, sym), 'Reflect.deleteProperty: symbol');
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,104 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-delete-non-exported-strict.case
// - src/dynamic-import/namespace/await.template
/*---
description: The [[Delete]] behavior for a key that does not describe an exported binding (value from await resolving)
esid: sec-finishdynamicimport
features: [dynamic-import]
flags: [generated, onlyStrict, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
[...]
2. If Type(P) is Symbol, then
a. Return ? OrdinaryDelete(O, P).
3. Let exports be O.[[Exports]].
4. If P is an element of exports, return false.
5. Return true.
---*/
async function fn() {
const ns = await import('./empty_FIXTURE.js');
assert(delete ns.undef, 'delete: undef');
assert(Reflect.deleteProperty(ns, 'undef'), 'Reflect.deleteProperty: undef');
assert(delete ns.default, 'delete: default');
assert(
Reflect.deleteProperty(ns, 'default'), 'Reflect.deleteProperty: default'
);
assert.sameValue(
Reflect.deleteProperty(ns, Symbol.toStringTag), false,
'Reflect.deleteProperty: Symbol.toStringTag'
);
assert.throws(TypeError, function() { delete ns[Symbol.toStringTag]; }, 'delete: Symbol.toStringTag');
var sym = Symbol('test262');
assert(delete ns[sym], 'delete: symbol');
assert(Reflect.deleteProperty(ns, sym), 'Reflect.deleteProperty: symbol');
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,81 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-extensible.case
// - src/dynamic-import/namespace/await.template
/*---
description: Module namespace objects are not extensible. (value from await resolving)
esid: sec-finishdynamicimport
features: [dynamic-import]
flags: [generated, async]
includes: [propertyHelper.js]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
---*/
async function fn() {
const ns = await import('./module-code_FIXTURE.js');
assert.sameValue(Object.isExtensible(ns), false);
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,126 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-get-nested-namespace-dflt-direct.case
// - src/dynamic-import/namespace/await.template
/*---
description: Direct Default exports are included in an imported module namespace object when a namespace object is created. (value from await resolving)
esid: sec-finishdynamicimport
features: [export-star-as-namespace-from-module, dynamic-import]
flags: [generated, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
[...]
6. Let binding be ! m.ResolveExport(P, « »).
7. Assert: binding is a ResolvedBinding Record.
8. Let targetModule be binding.[[Module]].
9. Assert: targetModule is not undefined.
10. If binding.[[BindingName]] is "*namespace*", then
11. Return ? GetModuleNamespace(targetModule).
Runtime Semantics: GetModuleNamespace
[...]
3. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames,
i. Let resolution be ? module.ResolveExport(name, « », « »).
ii. If resolution is null, throw a SyntaxError exception.
iii. If resolution is not "ambiguous", append name to
unambiguousNames.
d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames).
[...]
---*/
async function fn() {
const ns = await import('./get-nested-namespace-dflt-skip-prod_FIXTURE.js');
var desc = Object.getOwnPropertyDescriptor(ns, 'productionNS2');
assert.sameValue(desc.enumerable, true, 'ns.productionNS2: is enumerable');
assert.sameValue(desc.writable, true, 'ns.productionNS2: is writable');
assert.sameValue(desc.configurable, false, 'ns.productionNS2: is non-configurable');
var keys = Object.keys(ns.productionNS2);
assert.sameValue(keys.length, 2);
assert.sameValue(keys[0], 'default');
assert.sameValue(keys[1], 'productionOther');
desc = Object.getOwnPropertyDescriptor(ns.productionNS2, 'productionOther');
assert.sameValue(desc.value, null, 'ns.productionNS2.productionOther: value is null');
assert.sameValue(desc.enumerable, true, 'ns.productionNS2.productionOther: is enumerable');
assert.sameValue(desc.writable, true, 'ns.productionNS2.productionOther: is writable');
assert.sameValue(desc.configurable, false, 'ns.productionNS2.productionOther: is non-configurable');
desc = Object.getOwnPropertyDescriptor(ns.productionNS2, 'default');
assert.sameValue(desc.value, 42, 'ns.productionNS2.default value is 42');
assert.sameValue(desc.enumerable, true, 'ns.productionNS2.default is enumerable');
assert.sameValue(desc.writable, true, 'ns.productionNS2.default is writable');
assert.sameValue(desc.configurable, false, 'ns.productionNS2.default is non-configurable');
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,126 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-get-nested-namespace-dflt-indirect.case
// - src/dynamic-import/namespace/await.template
/*---
description: Inirect Default exports are included in an imported module namespace object when a namespace object is created. (value from await resolving)
esid: sec-finishdynamicimport
features: [export-star-as-namespace-from-module, dynamic-import]
flags: [generated, module, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
[...]
6. Let binding be ! m.ResolveExport(P, « »).
7. Assert: binding is a ResolvedBinding Record.
8. Let targetModule be binding.[[Module]].
9. Assert: targetModule is not undefined.
10. If binding.[[BindingName]] is "*namespace*", then
11. Return ? GetModuleNamespace(targetModule).
Runtime Semantics: GetModuleNamespace
[...]
3. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames,
i. Let resolution be ? module.ResolveExport(name, « », « »).
ii. If resolution is null, throw a SyntaxError exception.
iii. If resolution is not "ambiguous", append name to
unambiguousNames.
d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames).
[...]
---*/
async function fn() {
const ns = await import('./get-nested-namespace-dflt-skip-named_FIXTURE.js');
var desc = Object.getOwnPropertyDescriptor(ns, 'namedNS2');
assert.sameValue(desc.enumerable, true, 'ns.namedNS2: is enumerable');
assert.sameValue(desc.writable, true, 'ns.namedNS2: is writable');
assert.sameValue(desc.configurable, false, 'ns.namedNS2: is non-configurable');
var keys = Object.keys(ns.namedNS2);
assert.sameValue(keys.length, 2);
assert.sameValue(keys[0], 'default');
assert.sameValue(keys[1], 'namedOther');
desc = Object.getOwnPropertyDescriptor(ns.namedNS2, 'namedOther');
assert.sameValue(desc.value, null, 'ns.namedNS2.namedOther value is null');
assert.sameValue(desc.enumerable, true, 'ns.namedNS2.namedOther: is enumerable');
assert.sameValue(desc.writable, true, 'ns.namedNS2.namedOther: is writable');
assert.sameValue(desc.configurable, false, 'ns.namedNS2.namedOther: is non-configurable');
desc = Object.getOwnPropertyDescriptor(ns.namedNS2, 'default');
assert.sameValue(desc.value, 42, 'ns.namedNS2.default value is 42');
assert.sameValue(desc.enumerable, true, 'ns.namedNS2.default is enumerable');
assert.sameValue(desc.writable, true, 'ns.namedNS2.default is writable');
assert.sameValue(desc.configurable, false, 'ns.namedNS2.default is non-configurable');
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,123 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-get-nested-namespace-props-nrml.case
// - src/dynamic-import/namespace/await.template
/*---
description: Module namespace object reports properties for all ExportEntries of all dependencies. (value from await resolving)
esid: sec-finishdynamicimport
features: [export-star-as-namespace-from-module, dynamic-import]
flags: [generated, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
[...]
12. For each ImportEntry Record in in module.[[ImportEntries]], do
a. Let importedModule be ? HostResolveImportedModule(module,
in.[[ModuleRequest]]).
b. If in.[[ImportName]] is "*", then
i. Let namespace be ? GetModuleNamespace(importedModule).
[...]
Runtime Semantics: GetModuleNamespace
3. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames,
i. Let resolution be ? module.ResolveExport(name, « », « »).
ii. If resolution is null, throw a SyntaxError exception.
iii. If resolution is not "ambiguous", append name to
unambiguousNames.
d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames).
---*/
function hasOwnProperty(obj, property) {
return Object.prototype.hasOwnProperty.call(obj, property);
}
async function fn() {
const ns = await import('./get-nested-namespace-props-nrml-1_FIXTURE.js');
// Export entries defined by a re-exported as exportns module
assert(hasOwnProperty(ns.exportns, 'starAsVarDecl'), 'starssVarDecl');
assert(hasOwnProperty(ns.exportns, 'starAsLetDecl'), 'starSsLetDecl');
assert(hasOwnProperty(ns.exportns, 'starAsConstDecl'), 'starSsConstDecl');
assert(hasOwnProperty(ns.exportns, 'starAsFuncDecl'), 'starAsFuncDecl');
assert(hasOwnProperty(ns.exportns, 'starAsGenDecl'), 'starAsGenDecl');
assert(hasOwnProperty(ns.exportns, 'starAsClassDecl'), 'starAsClassDecl');
assert(hasOwnProperty(ns.exportns, 'starAsBindingId'), 'starAsBindingId');
assert(hasOwnProperty(ns.exportns, 'starIdName'), 'starIdName');
assert(hasOwnProperty(ns.exportns, 'starAsIndirectIdName'), 'starAsIndirectIdName');
assert(hasOwnProperty(ns.exportns, 'starAsIndirectIdName2'), 'starAsIndirectIdName2');
assert(hasOwnProperty(ns.exportns, 'namespaceBinding'), 'namespaceBinding');
// Bindings that were not exported from any module
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedVar'), false, 'nonExportedVar');
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedLet'), false, 'nonExportedLet');
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedConst'), false, 'nonExportedConst');
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedFunc'), false, 'nonExportedFunc');
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedGen'), false, 'nonExportedGen');
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedClass'), false, 'nonExportedClass');
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,124 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-get-own-property-str-found-init.case
// - src/dynamic-import/namespace/await.template
/*---
description: Behavior of the [[GetOwnProperty]] internal method with a string argument describing an initialized binding (value from await resolving)
esid: sec-finishdynamicimport
features: [dynamic-import]
flags: [generated, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
1. If Type(P) is Symbol, return OrdinaryGetOwnProperty(O, P).
2. Let exports be the value of O's [[Exports]] internal slot.
3. If P is not an element of exports, return undefined.
4. Let value be ? O.[[Get]](P, O).
5. Return PropertyDescriptor{[[Value]]: value, [[Writable]]: true,
[[Enumerable]]: true, [[Configurable]]: false }.
---*/
async function fn() {
const ns = await import('./module-code_FIXTURE.js');
var desc;
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, 'local1'), true
);
desc = Object.getOwnPropertyDescriptor(ns, 'local1');
assert.sameValue(desc.value, 'Test262');
assert.sameValue(desc.enumerable, true, 'local1 enumerable');
assert.sameValue(desc.writable, true, 'local1 writable');
assert.sameValue(desc.configurable, false, 'local1 configurable');
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, 'renamed'), true
);
desc = Object.getOwnPropertyDescriptor(ns, 'renamed');
assert.sameValue(desc.value, 'TC39');
assert.sameValue(desc.enumerable, true, 'renamed enumerable');
assert.sameValue(desc.writable, true, 'renamed writable');
assert.sameValue(desc.configurable, false, 'renamed configurable');
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, 'indirect'), true
);
desc = Object.getOwnPropertyDescriptor(ns, 'indirect');
assert.sameValue(desc.value, 'Test262');
assert.sameValue(desc.enumerable, true, 'indirect enumerable');
assert.sameValue(desc.writable, true, 'indirect writable');
assert.sameValue(desc.configurable, false, 'indirect configurable');
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, 'default'), true
);
desc = Object.getOwnPropertyDescriptor(ns, 'default');
assert.sameValue(desc.value, 42);
assert.sameValue(desc.enumerable, true, 'default enumerable');
assert.sameValue(desc.writable, true, 'default writable');
assert.sameValue(desc.configurable, false, 'default configurable');
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,117 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-get-own-property-str-not-found.case
// - src/dynamic-import/namespace/await.template
/*---
description: Behavior of the [[GetOwnProperty]] internal method with a string argument describing a binding that cannot be found (value from await resolving)
esid: sec-finishdynamicimport
features: [dynamic-import]
flags: [generated, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
1. If Type(P) is Symbol, return OrdinaryGetOwnProperty(O, P).
2. Let exports be the value of O's [[Exports]] internal slot.
3. If P is not an element of exports, return undefined.
---*/
async function fn() {
const ns = await import('./module-code_FIXTURE.js');
var desc;
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, 'local2'),
false,
'hasOwnProperty: local2'
);
desc = Object.getOwnPropertyDescriptor(ns, 'local2');
assert.sameValue(desc, undefined, 'property descriptor for "local2"');
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, 'toStringTag'),
false,
'hasOwnProperty: toStringTag'
);
desc = Object.getOwnPropertyDescriptor(ns, 'toStringTag');
assert.sameValue(desc, undefined, 'property descriptor for "toStringTag"');
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, 'iterator'),
false,
'hasOwnProperty: iterator'
);
desc = Object.getOwnPropertyDescriptor(ns, 'iterator');
assert.sameValue(desc, undefined, 'property descriptor for "iterator"');
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, '__proto__'),
false,
'hasOwnProperty: __proto__'
);
desc = Object.getOwnPropertyDescriptor(ns, '__proto__');
assert.sameValue(desc, undefined, 'property descriptor for "__proto__"');
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,95 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-get-own-property-sym.case
// - src/dynamic-import/namespace/await.template
/*---
description: Behavior of the [[GetOwnProperty]] internal method with a Symbol argument (value from await resolving)
esid: sec-finishdynamicimport
features: [Symbol, Symbol.toStringTag, dynamic-import]
flags: [generated, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
---*/
var notFound = Symbol('test262');
async function fn() {
const ns = await import('./module-code_FIXTURE.js');
var desc;
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, Symbol.toStringTag), true
);
desc = Object.getOwnPropertyDescriptor(ns, Symbol.toStringTag);
assert.sameValue(desc.value, ns[Symbol.toStringTag]);
assert.sameValue(desc.enumerable, false, 'Symbol.toStringTag enumerable');
assert.sameValue(desc.writable, false, 'Symbol.toStringTag writable');
assert.sameValue(desc.configurable, false, 'Symbol.toStringTag configurable');
assert.sameValue(Object.prototype.hasOwnProperty.call(ns, notFound), false);
desc = Object.getOwnPropertyDescriptor(ns, notFound);
assert.sameValue(desc, undefined);
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,88 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-get-str-found.case
// - src/dynamic-import/namespace/await.template
/*---
description: Behavior of the [[Get]] internal method with a string argument for exported initialized bindings. (value from await resolving)
esid: sec-finishdynamicimport
features: [dynamic-import]
flags: [generated, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
[...]
12. Let targetEnvRec be targetEnv's EnvironmentRecord.
13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
---*/
async function fn() {
const ns = await import('./module-code_FIXTURE.js');
assert.sameValue(ns.local1, 'Test262');
assert.sameValue(ns.renamed, 'TC39');
assert.sameValue(ns.indirect, 'Test262');
assert.sameValue(ns.default, 42);
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,90 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-get-str-not-found.case
// - src/dynamic-import/namespace/await.template
/*---
description: Behavior of the [[Get]] internal method with a string argument for non-exported bindings (value from await resolving)
esid: sec-finishdynamicimport
features: [dynamic-import]
flags: [generated, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
[...]
3. Let exports be the value of O's [[Exports]] internal slot.
4. If P is not an element of exports, return undefined.
---*/
var local2; // not used
async function fn() {
const ns = await import('./module-code_FIXTURE.js');
assert.sameValue(ns.local2, undefined, 'key: local2');
assert.sameValue(ns.toStringTag, undefined, 'key: toStringTag');
assert.sameValue(ns.iterator, undefined, 'key: iterator');
assert.sameValue(ns.__proto__, undefined, 'key: __proto__');
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,85 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-get-sym-found.case
// - src/dynamic-import/namespace/await.template
/*---
description: Behavior of the [[Get]] internal method with a symbol argument that can be found (value from await resolving)
esid: sec-finishdynamicimport
features: [Symbol.toStringTag, dynamic-import]
flags: [generated, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
[...]
2. If Type(P) is Symbol, then
a. Return ? OrdinaryGet(O, P, Receiver).
---*/
async function fn() {
const ns = await import('./module-code_FIXTURE.js');
assert.sameValue(typeof ns[Symbol.toStringTag], 'string');
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,85 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-get-sym-not-found.case
// - src/dynamic-import/namespace/await.template
/*---
description: Behavior of the [[Get]] internal method with a symbol argument that cannot be found (value from await resolving)
esid: sec-finishdynamicimport
features: [Symbol, dynamic-import]
flags: [generated, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
[...]
2. If Type(P) is Symbol, then
a. Return ? OrdinaryGet(O, P, Receiver).
---*/
async function fn() {
const ns = await import('./module-code_FIXTURE.js');
assert.sameValue(ns[Symbol('test262')], undefined, 'Symbol: test262');
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,95 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-has-property-str-found-init.case
// - src/dynamic-import/namespace/await.template
/*---
description: Behavior of the [[HasProperty]] internal method with a string argument for exported initialized bindings. (value from await resolving)
esid: sec-finishdynamicimport
features: [dynamic-import]
flags: [generated, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
[...]
2. Let exports be the value of O's [[Exports]] internal slot.
3. If P is an element of exports, return true.
---*/
async function fn() {
const ns = await import('./module-code_FIXTURE.js');
assert('local1' in ns, 'in: local1');
assert(Reflect.has(ns, 'local1'), 'Reflect.has: local1');
assert('renamed' in ns, 'in: renamed');
assert(Reflect.has(ns, 'renamed'), 'Reflect.has: renamed');
assert('indirect' in ns, 'in: indirect');
assert(Reflect.has(ns, 'indirect'), 'Reflect.has: indirect');
assert('default' in ns, 'in: default');
assert(Reflect.has(ns, 'default'), 'Reflect.has: default');
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,102 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-has-property-str-not-found.case
// - src/dynamic-import/namespace/await.template
/*---
description: Behavior of the [[HasProperty]] internal method with a string argument for non-exported bindings (value from await resolving)
esid: sec-finishdynamicimport
features: [dynamic-import]
flags: [generated, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
[...]
2. Let exports be the value of O's [[Exports]] internal slot.
3. If P is an element of exports, return true.
4. Return false.
---*/
var local2; // not used
async function fn() {
const ns = await import('./module-code_FIXTURE.js');
assert.sameValue('local2' in ns, false, 'in: local2');
assert.sameValue(Reflect.has(ns, 'local2'), false, 'Reflect.has: local2');
assert.sameValue('toStringTag' in ns, false, 'in: toStringTag');
assert.sameValue(
Reflect.has(ns, 'toStringTag'), false, 'Reflect.has: toStringTag'
);
assert.sameValue('iterator' in ns, false, 'in: iterator');
assert.sameValue(Reflect.has(ns, 'iterator'), false, 'Reflect.has: iterator');
assert.sameValue('__proto__' in ns, false, 'in: __proto__');
assert.sameValue(
Reflect.has(ns, '__proto__'), false, 'Reflect.has: __proto__'
);
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,84 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-has-property-sym-found.case
// - src/dynamic-import/namespace/await.template
/*---
description: Behavior of the [[HasProperty]] internal method with a symbol argument that can be found (value from await resolving)
esid: sec-finishdynamicimport
features: [Symbol.toStringTag, dynamic-import]
flags: [generated, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
1. If Type(P) is Symbol, return OrdinaryHasProperty(O, P).
---*/
async function fn() {
const ns = await import('./module-code_FIXTURE.js');
assert(Symbol.toStringTag in ns, 'in: Symbol.toStringTag');
assert(Reflect.has(ns, Symbol.toStringTag), 'Reflect.has: Symbol.toStringTag');
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,86 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-has-property-sym-not-found.case
// - src/dynamic-import/namespace/await.template
/*---
description: Behavior of the [[HasProperty]] internal method with a symbol argument that cannot be found (value from await resolving)
esid: sec-finishdynamicimport
features: [Symbol, dynamic-import]
flags: [generated, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
1. If Type(P) is Symbol, return OrdinaryHasProperty(O, P).
---*/
var sym = Symbol('test262');
async function fn() {
const ns = await import('./module-code_FIXTURE.js');
assert.sameValue(sym in ns, false, 'in');
assert.sameValue(Reflect.has(ns, sym), false, 'Reflect.has');
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,80 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-no-iterator.case
// - src/dynamic-import/namespace/await.template
/*---
description: Module namespace objects lack a Symbol.toStringTag (value from await resolving)
esid: sec-finishdynamicimport
features: [Symbol.iterator, dynamic-import]
flags: [generated, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
---*/
async function fn() {
const ns = await import('./module-code_FIXTURE.js');
assert.sameValue(Object.prototype.hasOwnProperty.call(ns, Symbol.iterator), false);
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,130 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-own-property-keys-sort.case
// - src/dynamic-import/namespace/await.template
/*---
description: The [[OwnPropertyKeys]] internal method reflects the sorted order (value from await resolving)
esid: sec-finishdynamicimport
features: [Symbol.toStringTag, dynamic-import]
flags: [generated, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
1. Let exports be a copy of the value of O's [[Exports]] internal slot.
2. Let symbolKeys be ! OrdinaryOwnPropertyKeys(O).
3. Append all the entries of symbolKeys to the end of exports.
4. Return exports.
---*/
async function fn() {
const ns = await import('./own-keys-sort_FIXTURE.js');
var stringKeys = Object.getOwnPropertyNames(ns);
assert.sameValue(stringKeys.length, 16);
assert.sameValue(stringKeys[0], '$', 'stringKeys[0] === "$"');
assert.sameValue(stringKeys[1], '$$', 'stringKeys[1] === "$$"');
assert.sameValue(stringKeys[2], 'A', 'stringKeys[2] === "A"');
assert.sameValue(stringKeys[3], 'Z', 'stringKeys[3] === "Z"');
assert.sameValue(stringKeys[4], '_', 'stringKeys[4] === "_"');
assert.sameValue(stringKeys[5], '__', 'stringKeys[5] === "__"');
assert.sameValue(stringKeys[6], 'a', 'stringKeys[6] === "a"');
assert.sameValue(stringKeys[7], 'aa', 'stringKeys[7] === "aa"');
assert.sameValue(stringKeys[8], 'az', 'stringKeys[8] === "az"');
assert.sameValue(stringKeys[9], 'default', 'stringKeys[9] === "default"');
assert.sameValue(stringKeys[10], 'z', 'stringKeys[10] === "z"');
assert.sameValue(stringKeys[11], 'za', 'stringKeys[11] === "za"');
assert.sameValue(stringKeys[12], 'zz', 'stringKeys[12] === "zz"');
assert.sameValue(stringKeys[13], '\u03bb', 'stringKeys[13] === "\u03bb"');
assert.sameValue(stringKeys[14], '\u03bc', 'stringKeys[14] === "\u03bc"');
assert.sameValue(stringKeys[15], '\u03c0', 'stringKeys[15] === "\u03c0"');
var allKeys = Reflect.ownKeys(ns);
assert(
allKeys.length >= 17,
'at least as many keys as defined by the module and the specification'
);
assert.sameValue(allKeys[0], '$', 'allKeys[0] === "$"');
assert.sameValue(allKeys[1], '$$', 'allKeys[1] === "$$"');
assert.sameValue(allKeys[2], 'A', 'allKeys[2] === "A"');
assert.sameValue(allKeys[3], 'Z', 'allKeys[3] === "Z"');
assert.sameValue(allKeys[4], '_', 'allKeys[4] === "_"');
assert.sameValue(allKeys[5], '__', 'allKeys[5] === "__"');
assert.sameValue(allKeys[6], 'a', 'allKeys[6] === "a"');
assert.sameValue(allKeys[7], 'aa', 'allKeys[7] === "aa"');
assert.sameValue(allKeys[8], 'az', 'allKeys[8] === "az"');
assert.sameValue(allKeys[9], 'default', 'allKeys[9] === "default"');
assert.sameValue(allKeys[10], 'z', 'allKeys[10] === "z"');
assert.sameValue(allKeys[11], 'za', 'allKeys[11] === "za"');
assert.sameValue(allKeys[12], 'zz', 'allKeys[12] === "zz"');
assert.sameValue(allKeys[13], '\u03bb', 'allKeys[13] === "\u03bb"');
assert.sameValue(allKeys[14], '\u03bc', 'allKeys[14] === "\u03bc"');
assert.sameValue(allKeys[15], '\u03c0', 'allKeys[15] === "\u03c0"');
assert(
allKeys.indexOf(Symbol.toStringTag) > 15,
'keys array includes Symbol.toStringTag'
);
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,83 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-prevent-extensions-object.case
// - src/dynamic-import/namespace/await.template
/*---
description: The [[PreventExtensions]] internal method returns `true` (value from await resolving)
esid: sec-finishdynamicimport
features: [dynamic-import]
flags: [generated, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
---*/
async function fn() {
const ns = await import('./empty_FIXTURE.js');
// This invocation should not throw an exception
Object.preventExtensions(ns);
assert.sameValue(Reflect.preventExtensions(ns), true);
}
fn().then($DONE, $DONE).catch($DONE);

View File

@ -0,0 +1,80 @@
// This file was procedurally generated from the following sources:
// - src/dynamic-import/ns-prevent-extensions-reflect.case
// - src/dynamic-import/namespace/await.template
/*---
description: The [[PreventExtensions]] internal method returns `true` (value from await resolving)
esid: sec-finishdynamicimport
features: [dynamic-import]
flags: [generated, async]
info: |
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
1. If completion is an abrupt completion, ...
2. Otherwise,
...
d. Let namespace be GetModuleNamespace(moduleRecord).
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
Runtime Semantics: GetModuleNamespace ( module )
...
3. Let namespace be module.[[Namespace]].
4. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames, do
i. Let resolution be ? module.ResolveExport(name, « »).
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
5. Return namespace.
ModuleNamespaceCreate ( module, exports )
...
4. Let M be a newly created object.
5. Set M's essential internal methods to the definitions specified in 9.4.6.
7. Let sortedExports be a new List containing the same values as the list exports where the
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
using undefined as comparefn.
8. Set M.[[Exports]] to sortedExports.
9. Create own properties of M corresponding to the definitions in 26.3.
10. Set module.[[Namespace]] to M.
11. Return M.
26.3 Module Namespace Objects
A Module Namespace Object is a module namespace exotic object that provides runtime
property-based access to a module's exported bindings. There is no constructor function for
Module Namespace Objects. Instead, such an object is created for each module that is imported
by an ImportDeclaration that includes a NameSpaceImport.
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
following own property:
26.3.1 @@toStringTag
The initial value of the @@toStringTag property is the String value "Module".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
Module Namespace Exotic Objects
A module namespace object is an exotic object that exposes the bindings exported from an
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
own properties of a module namespace exotic object and the binding names exported by the
Module. The exported bindings include any bindings that are indirectly exported using export *
export items. Each String-valued own property key is the StringValue of the corresponding
exported binding name. These are the only String-keyed properties of a module namespace exotic
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
[[Configurable]]: false }. Module namespace objects are not extensible.
---*/
async function fn() {
const ns = await import('./empty_FIXTURE.js');
assert.sameValue(Reflect.preventExtensions(ns), true);
}
fn().then($DONE, $DONE).catch($DONE);

Some files were not shown because too many files have changed in this diff Show More