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.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm-constructor
esid: sec-shadowrealm-constructor
description: >
Realm is a constructor and has [[Construct]] internal method.
ShadowRealm is a constructor and has [[Construct]] internal method.
includes: [isConstructor.js]
features: [ShadowRealm, Reflect.construct]
---*/
assert.sameValue(
typeof Realm,
typeof ShadowRealm,
'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.sameValue(Object.getPrototypeOf(Realm), Function.prototype);
new Realm();
assert(isConstructor(ShadowRealm));
assert.sameValue(Object.getPrototypeOf(ShadowRealm), Function.prototype);
new ShadowRealm();

View File

@ -1,14 +1,14 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm-constructor
esid: sec-shadowrealm-constructor
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]
features: [ShadowRealm]
---*/
verifyProperty(this, "Realm", {
verifyProperty(this, "ShadowRealm", {
enumerable: false,
writable: true,
configurable: true,

View File

@ -1,9 +1,9 @@
// Copyright (C) 2021 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm-constructor
esid: sec-shadowrealm-constructor
description: >
The Realm constructor is extensible
The ShadowRealm constructor is extensible
info: |
17 ECMAScript Standard Built-in Objects
@ -12,4 +12,4 @@ info: |
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.
/*---
esid: sec-realm
esid: sec-shadowrealm
description: >
The new instance is extensible
info: |
Realm ( )
ShadowRealm ( )
...
2. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%Realm.prototype%",
« [[Realm]], [[ExecutionContext]] »).
2. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%ShadowRealm.prototype%",
« [[ShadowRealm]], [[ExecutionContext]] »).
...
13. Return O.
@ -21,7 +21,7 @@ includes: [propertyHelper.js]
features: [ShadowRealm]
---*/
const realm = new Realm();
const realm = new ShadowRealm();
assert(Object.isExtensible(realm));

View File

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

View File

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

View File

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

View File

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

View File

@ -1,14 +1,14 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.evaluate
esid: sec-shadowrealm.prototype.evaluate
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]
features: [ShadowRealm]
---*/
verifyProperty(Realm.prototype, "evaluate", {
verifyProperty(ShadowRealm.prototype, "evaluate", {
enumerable: false,
writable: true,
configurable: true,

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.evaluate
esid: sec-shadowrealm.prototype.evaluate
description: >
Realm.prototype.evaluate wraps errors from other realm into TypeErrors
ShadowRealm.prototype.evaluate wraps errors from other realm into TypeErrors
features: [ShadowRealm]
---*/
assert.sameValue(
typeof Realm.prototype.evaluate,
typeof ShadowRealm.prototype.evaluate,
'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('throw 42'), 'throw primitive => TypeError');

View File

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

View File

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

View File

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

View File

@ -1,9 +1,9 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.evaluate
esid: sec-shadowrealm.prototype.evaluate
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
has the Function prototype object, which is the initial value of the expression
@ -12,4 +12,4 @@ description: >
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.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.evaluate
esid: sec-shadowrealm.prototype.evaluate
description: >
Realm.prototype.evaluate returns primitive values
ShadowRealm.prototype.evaluate returns primitive values
features: [ShadowRealm]
---*/
assert.sameValue(
typeof Realm.prototype.evaluate,
typeof ShadowRealm.prototype.evaluate,
'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('null'), null);

View File

@ -1,23 +1,23 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.evaluate
esid: sec-shadowrealm.prototype.evaluate
description: >
Realm.prototype.evaluate returns symbol values
ShadowRealm.prototype.evaluate returns symbol values
features: [ShadowRealm]
---*/
assert.sameValue(
typeof Realm.prototype.evaluate,
typeof ShadowRealm.prototype.evaluate,
'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()');
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(r.evaluate('Symbol.for("x")'), Symbol.for('x'));
assert.sameValue(Symbol.prototype.toString.call(s), 'Symbol()');

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.evaluate
esid: sec-shadowrealm.prototype.evaluate
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]
---*/
assert.sameValue(
typeof Realm.prototype.evaluate,
typeof ShadowRealm.prototype.evaluate,
'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('[]'), 'array literal');

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.evaluate
esid: sec-shadowrealm.prototype.evaluate
description: >
Realm.prototype.evaluate throws when argument is not a string.
ShadowRealm.prototype.evaluate throws when argument is not a string.
features: [ShadowRealm]
---*/
assert.sameValue(
typeof Realm.prototype.evaluate,
typeof ShadowRealm.prototype.evaluate,
'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({ [Symbol.toPrimitive]() { return '1+1'; }}));

View File

@ -1,21 +1,21 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.evaluate
esid: sec-shadowrealm.prototype.evaluate
description: >
Realm.prototype.evaluate validates realm object.
ShadowRealm.prototype.evaluate validates realm object.
features: [ShadowRealm]
---*/
assert.sameValue(
typeof Realm.prototype.evaluate,
typeof ShadowRealm.prototype.evaluate,
'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 = {};
assert.throws(TypeError, function() {
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.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.evaluate
esid: sec-shadowrealm.prototype.evaluate
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]
---*/
assert.sameValue(
typeof Realm.prototype.evaluate,
typeof ShadowRealm.prototype.evaluate,
'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 redWrappedFn = r.evaluate(`

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.evaluate
esid: sec-shadowrealm.prototype.evaluate
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]
---*/
assert.sameValue(
typeof Realm.prototype.evaluate,
typeof ShadowRealm.prototype.evaluate,
'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 redWrappedFn = r.evaluate(`

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.evaluate
esid: sec-shadowrealm.prototype.evaluate
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]
---*/
assert.sameValue(
typeof Realm.prototype.evaluate,
typeof ShadowRealm.prototype.evaluate,
'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(`
function fn() { return 42; }

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.evaluate
esid: sec-shadowrealm.prototype.evaluate
description: >
Realm.prototype.evaluate wrapped function observing their scopes
ShadowRealm.prototype.evaluate wrapped function observing their scopes
features: [ShadowRealm]
---*/
assert.sameValue(
typeof Realm.prototype.evaluate,
typeof ShadowRealm.prototype.evaluate,
'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;
function blueFn(x) {
@ -21,7 +21,7 @@ function blueFn(x) {
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(`
var myValue = 'red';
0, function(cb) {

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.evaluate
esid: sec-shadowrealm.prototype.evaluate
description: >
Realm.prototype.evaluate accepts callable objects
ShadowRealm.prototype.evaluate accepts callable objects
features: [ShadowRealm]
---*/
assert.sameValue(
typeof Realm.prototype.evaluate,
typeof ShadowRealm.prototype.evaluate,
'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() {})'), 'function', 'function expression');

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.evaluate
esid: sec-shadowrealm.prototype.evaluate
description: >
Realm.prototype.evaluate wrapped functions can resolve callable returns.
ShadowRealm.prototype.evaluate wrapped functions can resolve callable returns.
features: [ShadowRealm]
---*/
assert.sameValue(
typeof Realm.prototype.evaluate,
typeof ShadowRealm.prototype.evaluate,
'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 nestedWrapped = wrapped(2);

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.evaluate
esid: sec-shadowrealm.prototype.evaluate
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]
---*/
assert.sameValue(
typeof Realm.prototype.evaluate,
typeof ShadowRealm.prototype.evaluate,
'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(`
function fn() {

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.evaluate
esid: sec-shadowrealm.prototype.evaluate
description: >
Realm.prototype.evaluate wrapped functions share no properties, extended
ShadowRealm.prototype.evaluate wrapped functions share no properties, extended
features: [ShadowRealm]
---*/
assert.sameValue(
typeof Realm.prototype.evaluate,
typeof ShadowRealm.prototype.evaluate,
'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(`
function fn() { return 42; }

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.evaluate
esid: sec-shadowrealm.prototype.evaluate
description: >
Realm.prototype.evaluate wrapped functions share no properties
ShadowRealm.prototype.evaluate wrapped functions share no properties
features: [ShadowRealm]
---*/
assert.sameValue(
typeof Realm.prototype.evaluate,
typeof ShadowRealm.prototype.evaluate,
'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(`
function fn() {

View File

@ -1,14 +1,14 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.importvalue
esid: sec-shadowrealm.prototype.importvalue
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]
features: [ShadowRealm]
---*/
verifyProperty(Realm.prototype, "importValue", {
verifyProperty(ShadowRealm.prototype, "importValue", {
enumerable: false,
writable: true,
configurable: true,

View File

@ -1,19 +1,19 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.importvalue
esid: sec-shadowrealm.prototype.importvalue
description: >
Realm.prototype.importValue coerces exportName to string.
ShadowRealm.prototype.importValue coerces exportName to string.
features: [ShadowRealm]
---*/
assert.sameValue(
typeof Realm.prototype.importValue,
typeof ShadowRealm.prototype.importValue,
'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;
const exportName = {

View File

@ -1,20 +1,20 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.importvalue
esid: sec-shadowrealm.prototype.importvalue
description: >
Realm.prototype.importValue can import a value.
ShadowRealm.prototype.importValue can import a value.
flags: [async, module]
features: [ShadowRealm]
---*/
assert.sameValue(
typeof Realm.prototype.importValue,
typeof ShadowRealm.prototype.importValue,
'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 => {

View File

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

View File

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

View File

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

View File

@ -1,9 +1,9 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.importvalue
esid: sec-shadowrealm.prototype.importvalue
description: >
The [[Prototype]] of Realm.prototype.importValue is AsyncFunction.Prototype.
The [[Prototype]] of ShadowRealm.prototype.importValue is AsyncFunction.Prototype.
info: |
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
@ -12,4 +12,4 @@ info: |
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.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.importvalue
esid: sec-shadowrealm.prototype.importvalue
description: >
Realm.prototype.importValue coerces specifier to string.
ShadowRealm.prototype.importValue coerces specifier to string.
features: [ShadowRealm]
---*/
assert.sameValue(
typeof Realm.prototype.importValue,
typeof ShadowRealm.prototype.importValue,
'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;
const specifier = {

View File

@ -3,15 +3,15 @@
/*---
esid: sec-realmimportvalue
description: >
Realm.prototype.importValue rejects when export name does not exist
ShadowRealm.prototype.importValue rejects when export name does not exist
info: |
RealmImportValue ( specifierString, exportNameString, callerRealm, evalRealm, evalContext )
Assert: Type(specifierString) is String.
Assert: Type(exportNameString) is String.
Assert: callerRealm is a Realm Record.
Assert: evalRealm is a Realm Record.
Assert: evalContext is an execution context associated to a Realm instance's [[ExecutionContext]].
Assert: callerRealm is a ShadowRealm Record.
Assert: evalRealm is a ShadowRealm Record.
Assert: evalContext is an execution context associated to a ShadowRealm instance's [[ExecutionContext]].
Let innerCapability be ! NewPromiseCapability(%Promise%).
Let runningContext be the running execution context.
If runningContext is not already suspended, suspend runningContext.
@ -39,12 +39,12 @@ features: [ShadowRealm]
---*/
assert.sameValue(
typeof Realm.prototype.importValue,
typeof ShadowRealm.prototype.importValue,
'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')
.then(

View File

@ -1,21 +1,21 @@
// Copyright (C) 2021 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-realm.prototype.importvalue
esid: sec-shadowrealm.prototype.importvalue
description: >
Realm.prototype.importValue validates realm object.
ShadowRealm.prototype.importValue validates realm object.
features: [ShadowRealm]
---*/
assert.sameValue(
typeof Realm.prototype.importValue,
typeof ShadowRealm.prototype.importValue,
'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 = {};
assert.throws(TypeError, function() {
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
description: >
The [[Prototype]] of Realm.prototype is Object.Prototype.
The [[Prototype]] of ShadowRealm.prototype is Object.Prototype.
info: |
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
@ -12,4 +12,4 @@ info: |
features: [ShadowRealm]
---*/
assert.sameValue(Object.getPrototypeOf(Realm.prototype), Object.prototype);
assert.sameValue(Object.getPrototypeOf(ShadowRealm.prototype), Object.prototype);