2021-07-16 18:00:56 +02:00
|
|
|
// Copyright (C) 2021 Rick Waldron. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/*---
|
2021-09-02 17:07:19 +02:00
|
|
|
esid: sec-shadowrealm-constructor
|
2021-07-16 18:00:56 +02:00
|
|
|
description: >
|
2021-09-02 17:07:19 +02:00
|
|
|
new ShadowRealm() returns a shadow realm instance
|
2021-07-20 22:00:30 +02:00
|
|
|
info: |
|
2021-09-02 17:07:19 +02:00
|
|
|
ShadowRealm ( )
|
2021-07-20 22:00:30 +02:00
|
|
|
|
|
|
|
...
|
2021-09-02 17:07:19 +02:00
|
|
|
2. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%ShadowRealm.prototype%",
|
|
|
|
« [[ShadowRealm]], [[ExecutionContext]] »).
|
2021-07-20 22:00:30 +02:00
|
|
|
...
|
|
|
|
13. Return O.
|
2021-09-02 16:46:33 +02:00
|
|
|
features: [ShadowRealm]
|
2021-07-16 18:00:56 +02:00
|
|
|
---*/
|
|
|
|
assert.sameValue(
|
2021-09-02 17:07:19 +02:00
|
|
|
typeof ShadowRealm,
|
2021-07-16 18:00:56 +02:00
|
|
|
'function',
|
2021-09-02 17:07:19 +02:00
|
|
|
'This test must fail if ShadowRealm is not a function'
|
2021-07-16 18:00:56 +02:00
|
|
|
);
|
|
|
|
|
2021-09-02 17:07:19 +02:00
|
|
|
var realm = new ShadowRealm();
|
2021-07-20 22:00:30 +02:00
|
|
|
|
2021-09-02 17:07:19 +02:00
|
|
|
assert(realm instanceof ShadowRealm);
|
2021-07-20 22:00:30 +02:00
|
|
|
assert.sameValue(
|
|
|
|
Object.getPrototypeOf(realm),
|
2021-09-02 17:07:19 +02:00
|
|
|
ShadowRealm.prototype,
|
|
|
|
'[[Prototype]] is set to %ShadowRealm.prototype%'
|
2021-07-20 22:00:30 +02:00
|
|
|
);
|
2021-09-14 00:51:49 +02:00
|
|
|
|
|
|
|
var otherRealm = new ShadowRealm();
|
|
|
|
assert.notSameValue(realm, otherRealm, 'each instance is different');
|