| 1 |
// |reftest| skip module -- import-defer is not supported |
| 2 |
// Copyright (C) 2024 Igalia, S.L. All rights reserved. |
| 3 |
// This code is governed by the BSD license found in the LICENSE file. |
| 4 |
|
| 5 |
/*--- |
| 6 |
esid: sec-module-namespace-exotic-objects-get-p-receiver-EnsureDeferredNamespaceEvaluation |
| 7 |
description: > |
| 8 |
Modules cannot try to trigger their own evaluation |
| 9 |
info: | |
| 10 |
10.4.6.8 [[Get]] ( _P_, _Receiver_ ) |
| 11 |
1. ... |
| 12 |
1. If _O_.[[Deferred]] is **true**, perform ? EnsureDeferredNamespaceEvaluation(_O_). |
| 13 |
1. ... |
| 14 |
|
| 15 |
EnsureDeferredNamespaceEvaluation ( _O_ ) |
| 16 |
1. Assert: _O_.[[Deferred]] is *false*. |
| 17 |
1. Let _m_ be _O_.[[Module]]. |
| 18 |
1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. |
| 19 |
1. ... |
| 20 |
|
| 21 |
ReadyForSyncExecution( _module_, _seen_ ) |
| 22 |
1. If _seen_ is not provided, let _seen_ be a new empty List. |
| 23 |
1. If _seen_ contains _module_, return *true*. |
| 24 |
1. Append _module_ to _seen_. |
| 25 |
1. If _module_.[[Status]] is ~evaluated~, return *true*. |
| 26 |
1. If _module_.[[Status]] is ~evaluating~ or ~evaluating-async~, return *false*. |
| 27 |
1. Assert: _module_.[[Status]] is ~linked~. |
| 28 |
1. If _module_.[[HasTLA]] is *true*, return *false*. |
| 29 |
1. For each ModuleRequest Record _required_ of _module_.[[RequestedModules]], do |
| 30 |
1. Let _requiredModule_ be GetImportedModule(_module_, _required_.[[Specifier]]). |
| 31 |
1. If ReadyForSyncExecution(_requiredModule_, _seen_) is *false*, then |
| 32 |
1. Return *false*. |
| 33 |
1. Return *true*. |
| 34 |
|
| 35 |
flags: [module] |
| 36 |
features: [import-defer] |
| 37 |
---*/ |
| 38 |
|
| 39 |
import defer * as self from "./get-self-while-evaluating.js"; |
| 40 |
|
| 41 |
assert.throws(TypeError, () => self.foo); |
| 42 |
|
| 43 |
reportCompare(0, 0); |