Skip to content

Commit

Permalink
Fixes for import-defer tests
Browse files Browse the repository at this point in the history
  * Add deepEqual.js include where needed
  * Add module flag where needed
  * Fix some typos
  * In evaluation-ignore-set, add a try block to catch typeerrors from assignment

Need the bug URL (OOPS!).

Reviewed by NOBODY (OOPS!).

Explanation of why this fixes the bug (OOPS!).

* test/language/import/import-defer/deferred-namespace-object/dep-defer-ns_FIXTURE.js:
* test/language/import/import-defer/deferred-namespace-object/identity.js:
* test/language/import/import-defer/deferred-namespace-object/object-properties.js:
* test/language/import/import-defer/errors/get-other-while-dep-evaluating/main.js:
* test/language/import/import-defer/errors/get-other-while-evaluating/main.js:
* test/language/import/import-defer/errors/get-self-while-defer-evaluating/main.js:
* test/language/import/import-defer/errors/get-self-while-evaluating.js:
* test/language/import/import-defer/errors/module-throws/defer-import-after-evaluation.js:
* test/language/import/import-defer/errors/module-throws/third-party-evaluation-after-defer-import.js:
* test/language/import/import-defer/errors/module-throws/trigger-evaluation.js:
* test/language/import/import-defer/errors/resolution-error/import-defer-of-syntax-error-fails.js:
* test/language/import/import-defer/errors/syntax-error/import-defer-of-syntax-error-fails.js:
* test/language/import/import-defer/evaluation-sync/evaluation-ignore-get-symbol.js:
* test/language/import/import-defer/evaluation-sync/evaluation-ignore-getPrototypeOf.js:
* test/language/import/import-defer/evaluation-sync/evaluation-ignore-isExtensible.js:
* test/language/import/import-defer/evaluation-sync/evaluation-ignore-preventExtensions.js:
* test/language/import/import-defer/evaluation-sync/evaluation-ignore-set.js:
* test/language/import/import-defer/evaluation-sync/evaluation-ignore-setPrototypeOf.js:
* test/language/import/import-defer/evaluation-sync/evaluation-trigger-get-string.js:
* test/language/import/import-defer/evaluation-sync/import-defer-does-not-evaluate.js:
* test/language/import/import-defer/evaluation-sync/module-imported-defer-and-eager.js:
* test/language/import/import-defer/syntax/import-attributes.js:
* test/language/import/import-defer/syntax/valid-default-binding-named-defer.js:
* test/language/import/import-defer/syntax/valid-defer-namespace.js:
  • Loading branch information
takikawa authored and nicolo-ribaudo committed Oct 28, 2024
1 parent fda523d commit 620655a
Show file tree
Hide file tree
Showing 24 changed files with 48 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

import defer * as depDeferredNamespace from "./dep.js";
import defer * as depDeferredNamespace from "./dep_FIXTURE.js";

export { depDeferredNamespace };
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ info: |
1. ...
1. Return _M_.
flags: [module]
features: [import-defer]
---*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ info: |
[[IsExtensible]] ( )
1. Return false.
flags: [module]
features: [import-defer]
includes: [propertyHelper.js]
includes: [propertyHelper.js, deepEqual.js]
---*/

import defer * as ns from "./dep_FIXTURE.js";
Expand All @@ -30,8 +31,8 @@ assert(Reflect.isExtensible(ns) === false, "Deferred namespaces are not extensib
assert(Reflect.preventExtensions(ns) === true, "Deferred namespaces can made non-extensible");

assert(Reflect.getPrototypeOf(ns) === null, "Deferred namespaces have a null prototype");
asserts(Reflect.setPrototypeOf(ns, {}) === false, "Deferred namespaces' prototype cannot be changed");
asserts(Reflect.setPrototypeOf(ns, null) === true, "Deferred namespaces' prototype can be 'set' to null");
assert(Reflect.setPrototypeOf(ns, {}) === false, "Deferred namespaces' prototype cannot be changed");
assert(Reflect.setPrototypeOf(ns, null) === true, "Deferred namespaces' prototype can be 'set' to null");

assert.throws(TypeError, () => Reflect.apply(ns, null, []), "Deferred namespaces are not callable");
assert.throws(TypeError, () => Reflect.construct(ns, null, []), "Deferred namespaces are not constructable");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ info: |
1. Return *false*.
1. Return *true*.
flags: [module]
features: [import-defer]
---*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ info: |
1. Return *false*.
1. Return *true*.
flags: [module]
features: [import-defer]
---*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ info: |
1. Return *false*.
1. Return *true*.
flags: [module]
features: [import-defer]
---*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ info: |
1. Return *false*.
1. Return *true*.
flags: [module]
features: [import-defer]
---*/

import defer * self from "./get-self-while-evaluating.js";
import defer * as self from "./get-self-while-evaluating.js";

assert.throws(TypeError, () => self.foo);
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ info: |
1. Return ThrowCompletion(_promise_.[[PromiseResult]]).
1. ...
flags: [module]
features: [import-defer, top-level-await]
---*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ info: |
1. Return ThrowCompletion(_promise_.[[PromiseResult]]).
1. ...
flags: [module]
features: [import-defer, top-level-await]
---*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ info: |
1. Return ThrowCompletion(_promise_.[[PromiseResult]]).
1. ...
flags: [module]
features: [import-defer]
---*/

import defer * as ns "./throws_FIXTURE.js";
import defer * as ns from "./throws_FIXTURE.js";

assert.throws(URIError, () => ns.foo, "Evaluation errors are thrown when evaluating");
assert.throws(URIError, () => ns.foo, "Evaluation errors are thrown for already evaluated modules");
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ info: |
LoadRequestedModules ([ _hostDefined_ ])
- just notice that it does not check if the module is deferred
flags: [module]
features: [import-defer]
negative:
phase: resolution
type: SyntaxErrpr
type: SyntaxError
---*/

import defer * as ns "./resolution-error_FIXTURE.js";
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ info: |
LoadRequestedModules ([ _hostDefined_ ])
- just notice that it does not check if the module is deferred
flags: [module]
features: [import-defer]
negative:
phase: resolution
type: SyntaxErrpr
type: SyntaxError
---*/

import defer * as ns "./syntax-error_FIXTURE.js";
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ info: |
1. If _O_.[[Deferred]] is **true**, perform ? EnsureDeferredNamespaceEvaluation(_O_).
1. ...
flags: [module]
features: [import-defer]
---*/

import "./setup_FIXTURE.js";

import defer * as ns1 "./dep-1_FIXTURE.js";
import defer * as ns1 from "./dep-1_FIXTURE.js";

assert(globalThis.evaluations.length === 0, "import defer does not trigger evaluation");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ info: |
[[GetPrototypeOf]] ( )
1. Return **null**.
flags: [module]
features: [import-defer]
---*/

import "./setup_FIXTURE.js";

import defer * as ns1 "./dep-1_FIXTURE.js";
import defer * as ns1 from "./dep-1_FIXTURE.js";

assert(globalThis.evaluations.length === 0, "import defer does not trigger evaluation");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ info: |
[[IsExtensible]] ( )
1. Return **false**.
flags: [module]
features: [import-defer]
---*/

import "./setup_FIXTURE.js";

import defer * as ns1 "./dep-1_FIXTURE.js";
import defer * as ns1 from "./dep-1_FIXTURE.js";

assert(globalThis.evaluations.length === 0, "import defer does not trigger evaluation");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ info: |
[[PreventExtensions]] ( )
1. Return **true**.
flags: [module]
features: [import-defer]
---*/

import "./setup_FIXTURE.js";

import defer * as ns1 "./dep-1_FIXTURE.js";
import defer * as ns1 from "./dep-1_FIXTURE.js";

assert(globalThis.evaluations.length === 0, "import defer does not trigger evaluation");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,20 @@ info: |
[[Set]] ( _P_, _V_, _Receiver_ )
1. Return **false**.
flags: [module]
features: [import-defer]
---*/

import "./setup_FIXTURE.js";

import defer * as ns1 "./dep-1_FIXTURE.js";
import defer * as ns1 from "./dep-1_FIXTURE.js";

assert(globalThis.evaluations.length === 0, "import defer does not trigger evaluation");

ns1.foo = 2;
ns1.ns_1_2 = 3;
try {
ns1.foo = 2;
ns1.ns_1_2 = 3;
} catch {
}

assert(globalThis.evaluations.length === 0, "[[Get]] of a symbol does not trigger evaluation");
assert(globalThis.evaluations.length === 0, "[[Set]] of a symbol does not trigger evaluation");
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ info: |
[[SetPrototypeOf]] ( _V_ )
1. Return ! SetImmutablePrototype(_O_, _V_).
flags: [module]
features: [import-defer]
---*/

import "./setup_FIXTURE.js";

import defer * as ns1 "./dep-1_FIXTURE.js";
import defer * as ns1 from "./dep-1_FIXTURE.js";

assert(globalThis.evaluations.length === 0, "import defer does not trigger evaluation");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ info: |
1. If _O_.[[Deferred]] is **true**, perform ? EnsureDeferredNamespaceEvaluation(_O_).
1. ...
flags: [module]
features: [import-defer]
---*/

import "./setup_FIXTURE.js";

import defer * as ns1 "./dep-1_FIXTURE.js";
import defer * as ns1 from "./dep-1_FIXTURE.js";

assert(globalThis.evaluations.length === 0, "import defer does not trigger evaluation");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ info: |
1. Set _index_ to ? InnerModuleEvaluation(_requiredModule_, _stack_, _index_).
1. ...
flags: [module]
features: [import-defer]
includes: [deepEqual.js]
---*/

import "./setup_FIXTURE.js";

import defer * as ns1 "./dep-1_FIXTURE.js";
import defer * as ns1 from "./dep-1_FIXTURE.js";

assert(globalThis.evaluations.length === 0, "import defer does not trigger evaluation");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ info: |
1. Set _index_ to ? InnerModuleEvaluation(_requiredModule_, _stack_, _index_).
1. ...
flags: [module]
features: [import-defer]
includes: [deepEqual.js]
---*/

import "./setup_FIXTURE.js";

import defer * as ns1 "./dep-1_FIXTURE.js";
import defer * as ns1 from "./dep-1_FIXTURE.js";
import "./dep-2_FIXTURE.js";
import "./dep-1_FIXTURE.js";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ info: |
NameSpaceImport :
`*` `as` ImportedBinding
flags: [module]
features: [import-defer]
---*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ info: |
ImportedBinding :
BindingIdentifier[~Yield, +Await]
flags: [module]
features: [import-defer]
---*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ info: |
NameSpaceImport :
`*` `as` ImportedBinding
flags: [module]
features: [import-defer]
---*/

Expand Down

0 comments on commit 620655a

Please sign in to comment.