fix: rename Realm -> ShadowRealm

This commit is contained in:
rwaldron 2021-09-02 11:07:19 -04:00
parent 4a55a4f67a
commit 025a9691cb
40 changed files with 195 additions and 195 deletions

View File

@ -1,18 +1,18 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm-constructor esid: sec-shadowrealm-constructor
description: > description: >
Realm is a constructor and has [[Construct]] internal method. ShadowRealm is a constructor and has [[Construct]] internal method.
includes: [isConstructor.js] includes: [isConstructor.js]
features: [ShadowRealm, Reflect.construct] features: [ShadowRealm, Reflect.construct]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm, typeof ShadowRealm,
'function', 'function',
'This test must fail if Realm is not a function' 'This test must fail if ShadowRealm is not a function'
); );
assert(isConstructor(Realm)); assert(isConstructor(ShadowRealm));
assert.sameValue(Object.getPrototypeOf(Realm), Function.prototype); assert.sameValue(Object.getPrototypeOf(ShadowRealm), Function.prototype);
new Realm(); new ShadowRealm();

View File

@ -1,14 +1,14 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm-constructor esid: sec-shadowrealm-constructor
description: > description: >
The Realm constructor is the initial value of the "Realm" property of the global object. The ShadowRealm constructor is the initial value of the "ShadowRealm" property of the global object.
includes: [propertyHelper.js] includes: [propertyHelper.js]
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
verifyProperty(this, "Realm", { verifyProperty(this, "ShadowRealm", {
enumerable: false, enumerable: false,
writable: true, writable: true,
configurable: true, configurable: true,

View File

@ -1,9 +1,9 @@
// Copyright (C) 2021 Leo Balter. All rights reserved. // Copyright (C) 2021 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm-constructor esid: sec-shadowrealm-constructor
description: > description: >
The Realm constructor is extensible The ShadowRealm constructor is extensible
info: | info: |
17 ECMAScript Standard Built-in Objects 17 ECMAScript Standard Built-in Objects
@ -12,4 +12,4 @@ info: |
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue(Object.isExtensible(Realm), true); assert.sameValue(Object.isExtensible(ShadowRealm), true);

View File

@ -2,15 +2,15 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm esid: sec-shadowrealm
description: > description: >
The new instance is extensible The new instance is extensible
info: | info: |
Realm ( ) ShadowRealm ( )
... ...
2. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%Realm.prototype%", 2. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%ShadowRealm.prototype%",
« [[Realm]], [[ExecutionContext]] »). « [[ShadowRealm]], [[ExecutionContext]] »).
... ...
13. Return O. 13. Return O.
@ -21,7 +21,7 @@ includes: [propertyHelper.js]
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
const realm = new Realm(); const realm = new ShadowRealm();
assert(Object.isExtensible(realm)); assert(Object.isExtensible(realm));

View File

@ -1,30 +1,30 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm-constructor esid: sec-shadowrealm-constructor
description: > description: >
new Realm() returns a realm instance new ShadowRealm() returns a shadow realm instance
info: | info: |
Realm ( ) ShadowRealm ( )
... ...
2. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%Realm.prototype%", 2. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%ShadowRealm.prototype%",
« [[Realm]], [[ExecutionContext]] »). « [[ShadowRealm]], [[ExecutionContext]] »).
... ...
13. Return O. 13. Return O.
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm, typeof ShadowRealm,
'function', 'function',
'This test must fail if Realm is not a function' 'This test must fail if ShadowRealm is not a function'
); );
var realm = new Realm(); var realm = new ShadowRealm();
assert(realm instanceof Realm); assert(realm instanceof ShadowRealm);
assert.sameValue( assert.sameValue(
Object.getPrototypeOf(realm), Object.getPrototypeOf(realm),
Realm.prototype, ShadowRealm.prototype,
'[[Prototype]] is set to %Realm.prototype%' '[[Prototype]] is set to %ShadowRealm.prototype%'
); );

View File

@ -1,11 +1,11 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm-constructor esid: sec-shadowrealm-constructor
description: > description: >
The value of Realm.length is 0 The value of ShadowRealm.length is 0
info: | info: |
Realm ( ) ShadowRealm ( )
Every built-in function object, including constructors, has a "length" property Every built-in function object, including constructors, has a "length" property
whose value is a non-negative integral Number. Unless otherwise specified, this value whose value is a non-negative integral Number. Unless otherwise specified, this value
@ -20,7 +20,7 @@ includes: [propertyHelper.js]
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
verifyProperty(Realm, "length", { verifyProperty(ShadowRealm, "length", {
value: 0, value: 0,
enumerable: false, enumerable: false,
writable: false, writable: false,

View File

@ -3,7 +3,7 @@
/*--- /*---
esid: sec-ecmascript-standard-built-in-objects esid: sec-ecmascript-standard-built-in-objects
description: > description: >
The value of Realm.name is 'Realm' The value of ShadowRealm.name is 'ShadowRealm'
info: | info: |
Every built-in function object, including constructors, has a "name" property Every built-in function object, including constructors, has a "name" property
whose value is a String. Unless otherwise specified, this value is the name whose value is a String. Unless otherwise specified, this value is the name
@ -17,8 +17,8 @@ includes: [propertyHelper.js]
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
verifyProperty(Realm, "name", { verifyProperty(ShadowRealm, "name", {
value: "Realm", value: "ShadowRealm",
enumerable: false, enumerable: false,
writable: false, writable: false,
configurable: true, configurable: true,

View File

@ -1,9 +1,9 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-properties-of-the-realm-constructor esid: sec-properties-of-the-shadowrealm-constructor
description: > description: >
The [[Prototype]] of Realm is Function.Prototype. The [[Prototype]] of ShadowRealm is Function.Prototype.
info: | info: |
Unless otherwise specified every built-in function and every built-in constructor Unless otherwise specified every built-in function and every built-in constructor
has the Function prototype object, which is the initial value of the expression has the Function prototype object, which is the initial value of the expression
@ -12,4 +12,4 @@ info: |
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue(Object.getPrototypeOf(Realm), Function.prototype); assert.sameValue(Object.getPrototypeOf(ShadowRealm), Function.prototype);

View File

@ -1,12 +1,12 @@
// Copyright (C) 2021 Leo Balter. All rights reserved. // Copyright (C) 2021 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype-@@tostringtag esid: sec-shadowrealm.prototype-@@tostringtag
description: > description: >
`Symbol.toStringTag` property descriptor `Symbol.toStringTag` property descriptor
info: | info: |
The initial value of the @@toStringTag property is the String value The initial value of the @@toStringTag property is the String value
"Realm". "ShadowRealm".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: This property has the attributes { [[Writable]]: false, [[Enumerable]]:
false, [[Configurable]]: true }. false, [[Configurable]]: true }.
@ -14,8 +14,8 @@ includes: [propertyHelper.js]
features: [ShadowRealm, Symbol.toStringTag] features: [ShadowRealm, Symbol.toStringTag]
---*/ ---*/
verifyProperty(Realm.prototype, Symbol.toStringTag, { verifyProperty(ShadowRealm.prototype, Symbol.toStringTag, {
value: 'Realm', value: 'ShadowRealm',
enumerable: false, enumerable: false,
writable: false, writable: false,
configurable: true configurable: true

View File

@ -1,14 +1,14 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.evaluate esid: sec-shadowrealm.prototype.evaluate
description: > description: >
Realm.prototype.evaluate is an ECMAScript Standard built-in object function. ShadowRealm.prototype.evaluate is an ECMAScript Standard built-in object function.
includes: [propertyHelper.js] includes: [propertyHelper.js]
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
verifyProperty(Realm.prototype, "evaluate", { verifyProperty(ShadowRealm.prototype, "evaluate", {
enumerable: false, enumerable: false,
writable: true, writable: true,
configurable: true, configurable: true,

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.evaluate esid: sec-shadowrealm.prototype.evaluate
description: > description: >
Realm.prototype.evaluate wraps errors from other realm into TypeErrors ShadowRealm.prototype.evaluate wraps errors from other realm into TypeErrors
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.evaluate, typeof ShadowRealm.prototype.evaluate,
'function', 'function',
'This test must fail if Realm.prototype.evaluate is not a function' 'This test must fail if ShadowRealm.prototype.evaluate is not a function'
); );
const r = new Realm(); const r = new ShadowRealm();
assert.throws(TypeError, () => r.evaluate('...'), 'SyntaxError => TypeError'); assert.throws(TypeError, () => r.evaluate('...'), 'SyntaxError => TypeError');
assert.throws(TypeError, () => r.evaluate('throw 42'), 'throw primitive => TypeError'); assert.throws(TypeError, () => r.evaluate('throw 42'), 'throw primitive => TypeError');

View File

@ -1,11 +1,11 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.evaluate esid: sec-shadowrealm.prototype.evaluate
description: > description: >
The value of Realm.prototype.evaluate.length is 1 The value of ShadowRealm.prototype.evaluate.length is 1
info: | info: |
Realm.prototype.evaluate ( sourceText ) ShadowRealm.prototype.evaluate ( sourceText )
Every built-in function object, including constructors, has a "length" property Every built-in function object, including constructors, has a "length" property
whose value is a non-negative integral Number. Unless otherwise specified, this value whose value is a non-negative integral Number. Unless otherwise specified, this value
@ -20,7 +20,7 @@ includes: [propertyHelper.js]
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
verifyProperty(Realm.prototype.evaluate, "length", { verifyProperty(ShadowRealm.prototype.evaluate, "length", {
value: 1, value: 1,
enumerable: false, enumerable: false,
writable: false, writable: false,

View File

@ -1,9 +1,9 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.evaluate esid: sec-shadowrealm.prototype.evaluate
description: > description: >
The value of Realm.prototype.evaluate.name is 'evaluate' The value of ShadowRealm.prototype.evaluate.name is 'evaluate'
info: | info: |
Every built-in function object, including constructors, has a "name" property Every built-in function object, including constructors, has a "name" property
whose value is a String. Unless otherwise specified, this value is the name whose value is a String. Unless otherwise specified, this value is the name
@ -17,7 +17,7 @@ includes: [propertyHelper.js]
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
verifyProperty(Realm.prototype.evaluate, "name", { verifyProperty(ShadowRealm.prototype.evaluate, "name", {
value: "evaluate", value: "evaluate",
enumerable: false, enumerable: false,
writable: false, writable: false,

View File

@ -1,30 +1,30 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.evaluate esid: sec-shadowrealm.prototype.evaluate
description: > description: >
Realm.prototype.evaluate is not a constructor. ShadowRealm.prototype.evaluate is not a constructor.
includes: [isConstructor.js] includes: [isConstructor.js]
features: [ShadowRealm, Reflect.construct] features: [ShadowRealm, Reflect.construct]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.evaluate, typeof ShadowRealm.prototype.evaluate,
'function', 'function',
'This test must fail if Realm.prototype.evaluate is not a function' 'This test must fail if ShadowRealm.prototype.evaluate is not a function'
); );
assert.sameValue( assert.sameValue(
isConstructor(Realm.prototype.evaluate), isConstructor(ShadowRealm.prototype.evaluate),
false, false,
'isConstructor(Realm.prototype.evaluate) must return false' 'isConstructor(ShadowRealm.prototype.evaluate) must return false'
); );
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
new Realm.prototype.evaluate(""); new ShadowRealm.prototype.evaluate("");
}, '`new Realm.prototype.evaluate("")` throws TypeError'); }, '`new ShadowRealm.prototype.evaluate("")` throws TypeError');
const r = new Realm(); const r = new ShadowRealm();
r.evaluate('globalThis.x = 0'); r.evaluate('globalThis.x = 0');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {

View File

@ -1,9 +1,9 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.evaluate esid: sec-shadowrealm.prototype.evaluate
description: > description: >
The [[Prototype]] of Realm.prototype.evaluate is Function.Prototype. The [[Prototype]] of ShadowRealm.prototype.evaluate is Function.Prototype.
Unless otherwise specified every built-in function and every built-in constructor Unless otherwise specified every built-in function and every built-in constructor
has the Function prototype object, which is the initial value of the expression has the Function prototype object, which is the initial value of the expression
@ -12,4 +12,4 @@ description: >
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue(Object.getPrototypeOf(Realm.prototype.evaluate), Function.prototype); assert.sameValue(Object.getPrototypeOf(ShadowRealm.prototype.evaluate), Function.prototype);

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.evaluate esid: sec-shadowrealm.prototype.evaluate
description: > description: >
Realm.prototype.evaluate returns primitive values ShadowRealm.prototype.evaluate returns primitive values
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.evaluate, typeof ShadowRealm.prototype.evaluate,
'function', 'function',
'This test must fail if Realm.prototype.evaluate is not a function' 'This test must fail if ShadowRealm.prototype.evaluate is not a function'
); );
const r = new Realm(); const r = new ShadowRealm();
assert.sameValue(r.evaluate('1 + 1'), 2); assert.sameValue(r.evaluate('1 + 1'), 2);
assert.sameValue(r.evaluate('null'), null); assert.sameValue(r.evaluate('null'), null);

View File

@ -1,23 +1,23 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.evaluate esid: sec-shadowrealm.prototype.evaluate
description: > description: >
Realm.prototype.evaluate returns symbol values ShadowRealm.prototype.evaluate returns symbol values
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.evaluate, typeof ShadowRealm.prototype.evaluate,
'function', 'function',
'This test must fail if Realm.prototype.evaluate is not a function' 'This test must fail if ShadowRealm.prototype.evaluate is not a function'
); );
const r = new Realm(); const r = new ShadowRealm();
const s = r.evaluate('Symbol()'); const s = r.evaluate('Symbol()');
assert.sameValue(typeof s, 'symbol'); assert.sameValue(typeof s, 'symbol');
assert.sameValue(s.constructor, Symbol, 'primitive does not expose other Realm constructor'); assert.sameValue(s.constructor, Symbol, 'primitive does not expose other ShadowRealm constructor');
assert.sameValue(Object.getPrototypeOf(s), Symbol.prototype); assert.sameValue(Object.getPrototypeOf(s), Symbol.prototype);
assert.sameValue(r.evaluate('Symbol.for("x")'), Symbol.for('x')); assert.sameValue(r.evaluate('Symbol.for("x")'), Symbol.for('x'));
assert.sameValue(Symbol.prototype.toString.call(s), 'Symbol()'); assert.sameValue(Symbol.prototype.toString.call(s), 'Symbol()');

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.evaluate esid: sec-shadowrealm.prototype.evaluate
description: > description: >
Realm.prototype.evaluate throws a TypeError if evaluate resolves to non-primitive values ShadowRealm.prototype.evaluate throws a TypeError if evaluate resolves to non-primitive values
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.evaluate, typeof ShadowRealm.prototype.evaluate,
'function', 'function',
'This test must fail if Realm.prototype.evaluate is not a function' 'This test must fail if ShadowRealm.prototype.evaluate is not a function'
); );
const r = new Realm(); const r = new ShadowRealm();
assert.throws(TypeError, () => r.evaluate('globalThis'), 'globalThis'); assert.throws(TypeError, () => r.evaluate('globalThis'), 'globalThis');
assert.throws(TypeError, () => r.evaluate('[]'), 'array literal'); assert.throws(TypeError, () => r.evaluate('[]'), 'array literal');

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.evaluate esid: sec-shadowrealm.prototype.evaluate
description: > description: >
Realm.prototype.evaluate throws when argument is not a string. ShadowRealm.prototype.evaluate throws when argument is not a string.
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.evaluate, typeof ShadowRealm.prototype.evaluate,
'function', 'function',
'This test must fail if Realm.prototype.evaluate is not a function' 'This test must fail if ShadowRealm.prototype.evaluate is not a function'
); );
const r = new Realm(); const r = new ShadowRealm();
assert.throws(TypeError, () => r.evaluate(['1+1'])); assert.throws(TypeError, () => r.evaluate(['1+1']));
assert.throws(TypeError, () => r.evaluate({ [Symbol.toPrimitive]() { return '1+1'; }})); assert.throws(TypeError, () => r.evaluate({ [Symbol.toPrimitive]() { return '1+1'; }}));

View File

@ -1,21 +1,21 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.evaluate esid: sec-shadowrealm.prototype.evaluate
description: > description: >
Realm.prototype.evaluate validates realm object. ShadowRealm.prototype.evaluate validates realm object.
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.evaluate, typeof ShadowRealm.prototype.evaluate,
'function', 'function',
'This test must fail if Realm.prototype.evaluate is not a function' 'This test must fail if ShadowRealm.prototype.evaluate is not a function'
); );
const r = new Realm(); const r = new ShadowRealm();
const bogus = {}; const bogus = {};
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
r.evaluate.call(bogus, ''); r.evaluate.call(bogus, '');
}, 'throws a TypeError if this is not a Realm object'); }, 'throws a TypeError if this is not a ShadowRealm object');

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.evaluate esid: sec-shadowrealm.prototype.evaluate
description: > description: >
Realm.prototype.evaluate wrapped function arguments are wrapped into the inner realm, extended. ShadowRealm.prototype.evaluate wrapped function arguments are wrapped into the inner realm, extended.
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.evaluate, typeof ShadowRealm.prototype.evaluate,
'function', 'function',
'This test must fail if Realm.prototype.evaluate is not a function' 'This test must fail if ShadowRealm.prototype.evaluate is not a function'
); );
const r = new Realm(); const r = new ShadowRealm();
const blueFn = (x, y) => x + y; const blueFn = (x, y) => x + y;
const redWrappedFn = r.evaluate(` const redWrappedFn = r.evaluate(`

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.evaluate esid: sec-shadowrealm.prototype.evaluate
description: > description: >
Realm.prototype.evaluate wrapped function arguments are wrapped into the inner realm ShadowRealm.prototype.evaluate wrapped function arguments are wrapped into the inner realm
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.evaluate, typeof ShadowRealm.prototype.evaluate,
'function', 'function',
'This test must fail if Realm.prototype.evaluate is not a function' 'This test must fail if ShadowRealm.prototype.evaluate is not a function'
); );
const r = new Realm(); const r = new ShadowRealm();
const blueFn = (x, y) => x + y; const blueFn = (x, y) => x + y;
const redWrappedFn = r.evaluate(` const redWrappedFn = r.evaluate(`

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.evaluate esid: sec-shadowrealm.prototype.evaluate
description: > description: >
Realm.prototype.evaluate wrapped function from return values share no identity. ShadowRealm.prototype.evaluate wrapped function from return values share no identity.
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.evaluate, typeof ShadowRealm.prototype.evaluate,
'function', 'function',
'This test must fail if Realm.prototype.evaluate is not a function' 'This test must fail if ShadowRealm.prototype.evaluate is not a function'
); );
const r = new Realm(); const r = new ShadowRealm();
r.evaluate(` r.evaluate(`
function fn() { return 42; } function fn() { return 42; }

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.evaluate esid: sec-shadowrealm.prototype.evaluate
description: > description: >
Realm.prototype.evaluate wrapped function observing their scopes ShadowRealm.prototype.evaluate wrapped function observing their scopes
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.evaluate, typeof ShadowRealm.prototype.evaluate,
'function', 'function',
'This test must fail if Realm.prototype.evaluate is not a function' 'This test must fail if ShadowRealm.prototype.evaluate is not a function'
); );
const r = new Realm(); const r = new ShadowRealm();
let myValue; let myValue;
function blueFn(x) { function blueFn(x) {
@ -21,7 +21,7 @@ function blueFn(x) {
return myValue; return myValue;
} }
// cb is a new function in the red Realm that chains the call to the blueFn // cb is a new function in the red ShadowRealm that chains the call to the blueFn
const redFunction = r.evaluate(` const redFunction = r.evaluate(`
var myValue = 'red'; var myValue = 'red';
0, function(cb) { 0, function(cb) {

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.evaluate esid: sec-shadowrealm.prototype.evaluate
description: > description: >
Realm.prototype.evaluate accepts callable objects ShadowRealm.prototype.evaluate accepts callable objects
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.evaluate, typeof ShadowRealm.prototype.evaluate,
'function', 'function',
'This test must fail if Realm.prototype.evaluate is not a function' 'This test must fail if ShadowRealm.prototype.evaluate is not a function'
); );
const r = new Realm(); const r = new ShadowRealm();
assert.sameValue(typeof r.evaluate('function fn() {} fn'), 'function', 'value from a fn declaration'); assert.sameValue(typeof r.evaluate('function fn() {} fn'), 'function', 'value from a fn declaration');
assert.sameValue(typeof r.evaluate('(function() {})'), 'function', 'function expression'); assert.sameValue(typeof r.evaluate('(function() {})'), 'function', 'function expression');

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.evaluate esid: sec-shadowrealm.prototype.evaluate
description: > description: >
Realm.prototype.evaluate wrapped functions can resolve callable returns. ShadowRealm.prototype.evaluate wrapped functions can resolve callable returns.
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.evaluate, typeof ShadowRealm.prototype.evaluate,
'function', 'function',
'This test must fail if Realm.prototype.evaluate is not a function' 'This test must fail if ShadowRealm.prototype.evaluate is not a function'
); );
const r = new Realm(); const r = new ShadowRealm();
const wrapped = r.evaluate('x => y => x * y'); const wrapped = r.evaluate('x => y => x * y');
const nestedWrapped = wrapped(2); const nestedWrapped = wrapped(2);

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.evaluate esid: sec-shadowrealm.prototype.evaluate
description: > description: >
Realm.prototype.evaluate wrapped functions produce new wrapping on each evaluation. ShadowRealm.prototype.evaluate wrapped functions produce new wrapping on each evaluation.
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.evaluate, typeof ShadowRealm.prototype.evaluate,
'function', 'function',
'This test must fail if Realm.prototype.evaluate is not a function' 'This test must fail if ShadowRealm.prototype.evaluate is not a function'
); );
const r = new Realm(); const r = new ShadowRealm();
r.evaluate(` r.evaluate(`
function fn() { function fn() {

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.evaluate esid: sec-shadowrealm.prototype.evaluate
description: > description: >
Realm.prototype.evaluate wrapped functions share no properties, extended ShadowRealm.prototype.evaluate wrapped functions share no properties, extended
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.evaluate, typeof ShadowRealm.prototype.evaluate,
'function', 'function',
'This test must fail if Realm.prototype.evaluate is not a function' 'This test must fail if ShadowRealm.prototype.evaluate is not a function'
); );
const r = new Realm(); const r = new ShadowRealm();
r.evaluate(` r.evaluate(`
function fn() { return 42; } function fn() { return 42; }

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.evaluate esid: sec-shadowrealm.prototype.evaluate
description: > description: >
Realm.prototype.evaluate wrapped functions share no properties ShadowRealm.prototype.evaluate wrapped functions share no properties
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.evaluate, typeof ShadowRealm.prototype.evaluate,
'function', 'function',
'This test must fail if Realm.prototype.evaluate is not a function' 'This test must fail if ShadowRealm.prototype.evaluate is not a function'
); );
const r = new Realm(); const r = new ShadowRealm();
const wrapped = r.evaluate(` const wrapped = r.evaluate(`
function fn() { function fn() {

View File

@ -1,14 +1,14 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.importvalue esid: sec-shadowrealm.prototype.importvalue
description: > description: >
Realm.prototype.importValue is an ECMAScript Standard built-in object function. ShadowRealm.prototype.importValue is an ECMAScript Standard built-in object function.
includes: [propertyHelper.js] includes: [propertyHelper.js]
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
verifyProperty(Realm.prototype, "importValue", { verifyProperty(ShadowRealm.prototype, "importValue", {
enumerable: false, enumerable: false,
writable: true, writable: true,
configurable: true, configurable: true,

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.importvalue esid: sec-shadowrealm.prototype.importvalue
description: > description: >
Realm.prototype.importValue coerces exportName to string. ShadowRealm.prototype.importValue coerces exportName to string.
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.importValue, typeof ShadowRealm.prototype.importValue,
'function', 'function',
'This test must fail if Realm.prototype.importValue is not a function' 'This test must fail if ShadowRealm.prototype.importValue is not a function'
); );
const r = new Realm(); const r = new ShadowRealm();
let count = 0; let count = 0;
const exportName = { const exportName = {

View File

@ -1,20 +1,20 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.importvalue esid: sec-shadowrealm.prototype.importvalue
description: > description: >
Realm.prototype.importValue can import a value. ShadowRealm.prototype.importValue can import a value.
flags: [async, module] flags: [async, module]
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.importValue, typeof ShadowRealm.prototype.importValue,
'function', 'function',
'This test must fail if Realm.prototype.importValue is not a function' 'This test must fail if ShadowRealm.prototype.importValue is not a function'
); );
const r = new Realm(); const r = new ShadowRealm();
r.importValue('./import-value_FIXTURE.js', 'x').then(x => { r.importValue('./import-value_FIXTURE.js', 'x').then(x => {

View File

@ -1,9 +1,9 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.importvalue esid: sec-shadowrealm.prototype.importvalue
description: > description: >
The value of Realm.prototype.importValue.length is 2 The value of ShadowRealm.prototype.importValue.length is 2
info: | info: |
Every built-in function object, including constructors, has a "length" property Every built-in function object, including constructors, has a "length" property
whose value is a non-negative integral Number. Unless otherwise specified, this value whose value is a non-negative integral Number. Unless otherwise specified, this value
@ -18,7 +18,7 @@ includes: [propertyHelper.js]
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
verifyProperty(Realm.prototype.importValue, "length", { verifyProperty(ShadowRealm.prototype.importValue, "length", {
value: 2, value: 2,
enumerable: false, enumerable: false,
writable: false, writable: false,

View File

@ -1,11 +1,11 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.importValue esid: sec-shadowrealm.prototype.importValue
description: > description: >
The value of Realm.prototype.importValue.name is 'importValue' The value of ShadowRealm.prototype.importValue.name is 'importValue'
info: | info: |
Realm.prototype.importValue ShadowRealm.prototype.importValue
Every built-in function object, including constructors, has a "name" property Every built-in function object, including constructors, has a "name" property
whose value is a String. Unless otherwise specified, this value is the name whose value is a String. Unless otherwise specified, this value is the name
@ -19,7 +19,7 @@ includes: [propertyHelper.js]
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
verifyProperty(Realm.prototype.importValue, "name", { verifyProperty(ShadowRealm.prototype.importValue, "name", {
value: "importValue", value: "importValue",
enumerable: false, enumerable: false,
writable: false, writable: false,

View File

@ -1,30 +1,30 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.importvalue esid: sec-shadowrealm.prototype.importvalue
description: > description: >
Realm.prototype.importValue is not a constructor. ShadowRealm.prototype.importValue is not a constructor.
includes: [isConstructor.js] includes: [isConstructor.js]
features: [ShadowRealm, Reflect.construct] features: [ShadowRealm, Reflect.construct]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.importValue, typeof ShadowRealm.prototype.importValue,
'function', 'function',
'This test must fail if Realm.prototype.importValue is not a function' 'This test must fail if ShadowRealm.prototype.importValue is not a function'
); );
assert.sameValue( assert.sameValue(
isConstructor(Realm.prototype.importValue), isConstructor(ShadowRealm.prototype.importValue),
false, false,
'isConstructor(Realm.prototype.importValue) must return false' 'isConstructor(ShadowRealm.prototype.importValue) must return false'
); );
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
new Realm.prototype.importValue("", "name"); new ShadowRealm.prototype.importValue("", "name");
}, '`new Realm.prototype.importValue("")` throws TypeError'); }, '`new ShadowRealm.prototype.importValue("")` throws TypeError');
const r = new Realm(); const r = new ShadowRealm();
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
new r.imporValue("./import-value_FIXTURE.js", "x"); new r.imporValue("./import-value_FIXTURE.js", "x");

View File

@ -1,9 +1,9 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.importvalue esid: sec-shadowrealm.prototype.importvalue
description: > description: >
The [[Prototype]] of Realm.prototype.importValue is AsyncFunction.Prototype. The [[Prototype]] of ShadowRealm.prototype.importValue is AsyncFunction.Prototype.
info: | info: |
Unless otherwise specified every built-in function and every built-in constructor Unless otherwise specified every built-in function and every built-in constructor
has the Function prototype object, which is the initial value of the expression has the Function prototype object, which is the initial value of the expression
@ -12,4 +12,4 @@ info: |
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue(Object.getPrototypeOf(Realm.prototype.importValue), Function.prototype); assert.sameValue(Object.getPrototypeOf(ShadowRealm.prototype.importValue), Function.prototype);

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.importvalue esid: sec-shadowrealm.prototype.importvalue
description: > description: >
Realm.prototype.importValue coerces specifier to string. ShadowRealm.prototype.importValue coerces specifier to string.
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.importValue, typeof ShadowRealm.prototype.importValue,
'function', 'function',
'This test must fail if Realm.prototype.importValue is not a function' 'This test must fail if ShadowRealm.prototype.importValue is not a function'
); );
const r = new Realm(); const r = new ShadowRealm();
let count = 0; let count = 0;
const specifier = { const specifier = {

View File

@ -3,15 +3,15 @@
/*--- /*---
esid: sec-realmimportvalue esid: sec-realmimportvalue
description: > description: >
Realm.prototype.importValue rejects when export name does not exist ShadowRealm.prototype.importValue rejects when export name does not exist
info: | info: |
RealmImportValue ( specifierString, exportNameString, callerRealm, evalRealm, evalContext ) RealmImportValue ( specifierString, exportNameString, callerRealm, evalRealm, evalContext )
Assert: Type(specifierString) is String. Assert: Type(specifierString) is String.
Assert: Type(exportNameString) is String. Assert: Type(exportNameString) is String.
Assert: callerRealm is a Realm Record. Assert: callerRealm is a ShadowRealm Record.
Assert: evalRealm is a Realm Record. Assert: evalRealm is a ShadowRealm Record.
Assert: evalContext is an execution context associated to a Realm instance's [[ExecutionContext]]. Assert: evalContext is an execution context associated to a ShadowRealm instance's [[ExecutionContext]].
Let innerCapability be ! NewPromiseCapability(%Promise%). Let innerCapability be ! NewPromiseCapability(%Promise%).
Let runningContext be the running execution context. Let runningContext be the running execution context.
If runningContext is not already suspended, suspend runningContext. If runningContext is not already suspended, suspend runningContext.
@ -39,12 +39,12 @@ features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.importValue, typeof ShadowRealm.prototype.importValue,
'function', 'function',
'This test must fail if Realm.prototype.importValue is not a function' 'This test must fail if ShadowRealm.prototype.importValue is not a function'
); );
const r = new Realm(); const r = new ShadowRealm();
r.importValue('./import-value_FIXTURE.js', 'y') r.importValue('./import-value_FIXTURE.js', 'y')
.then( .then(

View File

@ -1,21 +1,21 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved. // Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-realm.prototype.importvalue esid: sec-shadowrealm.prototype.importvalue
description: > description: >
Realm.prototype.importValue validates realm object. ShadowRealm.prototype.importValue validates realm object.
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue( assert.sameValue(
typeof Realm.prototype.importValue, typeof ShadowRealm.prototype.importValue,
'function', 'function',
'This test must fail if Realm.prototype.importValue is not a function' 'This test must fail if ShadowRealm.prototype.importValue is not a function'
); );
const r = new Realm(); const r = new ShadowRealm();
const bogus = {}; const bogus = {};
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
r.importValue.call(bogus, "specifier", "name"); r.importValue.call(bogus, "specifier", "name");
}, 'throws a TypeError if this is not a Realm object'); }, 'throws a TypeError if this is not a ShadowRealm object');

View File

@ -3,7 +3,7 @@
/*--- /*---
esid: sec-properties-of-the-realm-prototype-object esid: sec-properties-of-the-realm-prototype-object
description: > description: >
The [[Prototype]] of Realm.prototype is Object.Prototype. The [[Prototype]] of ShadowRealm.prototype is Object.Prototype.
info: | info: |
Unless otherwise specified every built-in prototype object has the Object prototype Unless otherwise specified every built-in prototype object has the Object prototype
object, which is the initial value of the expression Object.prototype, as the value object, which is the initial value of the expression Object.prototype, as the value
@ -12,4 +12,4 @@ info: |
features: [ShadowRealm] features: [ShadowRealm]
---*/ ---*/
assert.sameValue(Object.getPrototypeOf(Realm.prototype), Object.prototype); assert.sameValue(Object.getPrototypeOf(ShadowRealm.prototype), Object.prototype);