mirror of
https://github.com/tc39/test262.git
synced 2025-09-25 19:18:48 +02:00
Replace createNewGlobal with $262.createRealm().global in sm/Array
This commit is contained in:
parent
4ea90c4681
commit
d24dd57c58
@ -29,6 +29,4 @@ function test(otherGlobal) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test(createNewGlobal());
|
test($262.createRealm().global);
|
||||||
test(createNewGlobal({newCompartment: true}));
|
|
||||||
|
|
||||||
|
@ -83,6 +83,4 @@ function test(otherGlobal) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test(createNewGlobal());
|
test($262.createRealm().global);
|
||||||
test(createNewGlobal({newCompartment: true}));
|
|
||||||
|
|
||||||
|
@ -11,10 +11,10 @@ description: |
|
|||||||
pending
|
pending
|
||||||
esid: pending
|
esid: pending
|
||||||
---*/
|
---*/
|
||||||
if (typeof createNewGlobal === 'function') {
|
|
||||||
// G.Array.from, where G is any global, produces an array whose prototype
|
// G.Array.from, where G is any global, produces an array whose prototype
|
||||||
// is G.Array.prototype.
|
// is G.Array.prototype.
|
||||||
var g = createNewGlobal();
|
var g = $262.createRealm().global;
|
||||||
var ga = g.Array.from([1, 2, 3]);
|
var ga = g.Array.from([1, 2, 3]);
|
||||||
assert.sameValue(ga instanceof g.Array, true);
|
assert.sameValue(ga instanceof g.Array, true);
|
||||||
|
|
||||||
@ -31,7 +31,8 @@ if (typeof createNewGlobal === 'function') {
|
|||||||
|
|
||||||
// The default 'this' value received by a non-strict mapping function is
|
// The default 'this' value received by a non-strict mapping function is
|
||||||
// that function's global, not Array.from's global or the caller's global.
|
// that function's global, not Array.from's global or the caller's global.
|
||||||
var h = createNewGlobal(), result = undefined;
|
var h = $262.createRealm().global;
|
||||||
|
var result = undefined;
|
||||||
h.mainGlobal = this;
|
h.mainGlobal = this;
|
||||||
h.eval("function f() { mainGlobal.result = this; }");
|
h.eval("function f() { mainGlobal.result = this; }");
|
||||||
g.Array.from.call(Array, [5, 6, 7], h.f);
|
g.Array.from.call(Array, [5, 6, 7], h.f);
|
||||||
@ -41,5 +42,3 @@ if (typeof createNewGlobal === 'function') {
|
|||||||
g.globalName = "g";
|
g.globalName = "g";
|
||||||
h.globalName = "h";
|
h.globalName = "h";
|
||||||
assert.sameValue(result.globalName, "h");
|
assert.sameValue(result.globalName, "h");
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ description: |
|
|||||||
esid: pending
|
esid: pending
|
||||||
---*/
|
---*/
|
||||||
var global = this;
|
var global = this;
|
||||||
var otherGlobal = createNewGlobal();
|
var otherGlobal = $262.createRealm().global;
|
||||||
|
|
||||||
var thisGlobal = () => global;
|
var thisGlobal = () => global;
|
||||||
var alternateGlobals = (function(i) {
|
var alternateGlobals = (function(i) {
|
||||||
|
@ -14,6 +14,8 @@ var summary = 'Use ArraySpeciesCreate in Array.prototype.{concat,filter,map,slic
|
|||||||
|
|
||||||
print(BUGNUMBER + ": " + summary);
|
print(BUGNUMBER + ": " + summary);
|
||||||
|
|
||||||
|
var g = $262.createRealm().global;
|
||||||
|
|
||||||
function test(funcName, args, expectedLength, expectedLogs) {
|
function test(funcName, args, expectedLength, expectedLogs) {
|
||||||
// modified @@species
|
// modified @@species
|
||||||
function FakeArray(n) {
|
function FakeArray(n) {
|
||||||
@ -128,7 +130,6 @@ function test(funcName, args, expectedLength, expectedLogs) {
|
|||||||
assert.sameValue(b.constructor, Array);
|
assert.sameValue(b.constructor, Array);
|
||||||
|
|
||||||
// @@species from different global
|
// @@species from different global
|
||||||
var g = createNewGlobal();
|
|
||||||
g.eval("function FakeArray(n) { this.length = n; }");
|
g.eval("function FakeArray(n) { this.length = n; }");
|
||||||
a = [1, 2, 3, 4, 5];
|
a = [1, 2, 3, 4, 5];
|
||||||
a.constructor = {
|
a.constructor = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user