mirror of
https://github.com/tc39/test262.git
synced 2025-07-31 01:44:54 +02:00
Move cross-realm tests into their own files
This commit is contained in:
parent
6da621f161
commit
5b3d429e28
29
test/built-ins/RegExp/prototype/dotAll/cross-realm.js
vendored
Normal file
29
test/built-ins/RegExp/prototype/dotAll/cross-realm.js
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// Copyright (C) 2017 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-get-regexp.prototype.dotall
|
||||||
|
description: Invoked on a cross-realm object
|
||||||
|
info: |
|
||||||
|
get RegExp.prototype.dotAll
|
||||||
|
|
||||||
|
1. Let R be the this value.
|
||||||
|
2. If Type(R) is not Object, throw a TypeError exception.
|
||||||
|
3. If R does not have an [[OriginalFlags]] internal slot, then
|
||||||
|
a. If SameValue(R, %RegExpPrototype%) is true, return undefined.
|
||||||
|
b. Otherwise, throw a TypeError exception.
|
||||||
|
features: [regexp-dotall, cross-realm]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var dotAll = Object.getOwnPropertyDescriptor(RegExp.prototype, 'dotAll').get;
|
||||||
|
var other = $262.createRealm().global;
|
||||||
|
var otherRegExpProto = other.RegExp.prototype;
|
||||||
|
var otherRegExpGetter = Object.getOwnPropertyDescriptor(otherRegExpProto, 'dotAll').get;
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
dotAll.call(otherRegExpProto);
|
||||||
|
}, 'cross-realm RegExp.prototype');
|
||||||
|
|
||||||
|
assert.throws(other.TypeError, function() {
|
||||||
|
otherRegExpGetter.call(RegExp.prototype);
|
||||||
|
}, 'cross-realm RegExp.prototype getter method against primary realm RegExp.prototype');
|
@ -16,9 +16,6 @@ features: [regexp-dotall]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
var dotAll = Object.getOwnPropertyDescriptor(RegExp.prototype, 'dotAll').get;
|
var dotAll = Object.getOwnPropertyDescriptor(RegExp.prototype, 'dotAll').get;
|
||||||
var other = $262.createRealm().global;
|
|
||||||
var otherRegExpProto = other.RegExp.prototype;
|
|
||||||
var otherRegExpGetter = Object.getOwnPropertyDescriptor(otherRegExpProto, 'dotAll').get;
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
dotAll.call({});
|
dotAll.call({});
|
||||||
@ -31,11 +28,3 @@ assert.throws(TypeError, function() {
|
|||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
dotAll.call(arguments);
|
dotAll.call(arguments);
|
||||||
}, 'arguments object');
|
}, 'arguments object');
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
dotAll.call(otherRegExpProto);
|
|
||||||
}, 'cross-realm RegExp.prototype');
|
|
||||||
|
|
||||||
assert.throws(other.TypeError, function() {
|
|
||||||
otherRegExpGetter.call(RegExp.prototype);
|
|
||||||
}, 'cross-realm RegExp.prototype getter method against primary realm RegExp.prototype');
|
|
||||||
|
27
test/built-ins/RegExp/prototype/global/cross-realm.js
vendored
Normal file
27
test/built-ins/RegExp/prototype/global/cross-realm.js
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-get-regexp.prototype.global
|
||||||
|
es6id: 21.2.5.4
|
||||||
|
description: A TypeError is thrown when the "this" value is an invalid cross-realm Object
|
||||||
|
info: |
|
||||||
|
1. Let R be the this value.
|
||||||
|
2. If Type(R) is not Object, throw a TypeError exception.
|
||||||
|
3. If R does not have an [[OriginalFlags]] internal slot, then
|
||||||
|
a. If SameValue(R, %RegExpPrototype%) is true, return undefined.
|
||||||
|
b. Otherwise, throw a TypeError exception.
|
||||||
|
features: [cross-realm]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'global').get;
|
||||||
|
var other = $262.createRealm().global;
|
||||||
|
var otherRegExpProto = other.RegExp.prototype;
|
||||||
|
var otherRegExpGetter = Object.getOwnPropertyDescriptor(otherRegExpProto, 'global').get;
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
get.call(otherRegExpProto);
|
||||||
|
}, 'cross-realm RegExp.prototype');
|
||||||
|
|
||||||
|
assert.throws(other.TypeError, function() {
|
||||||
|
otherRegExpGetter.call(RegExp.prototype);
|
||||||
|
}, 'cross-realm RegExp.prototype getter method against primary realm RegExp.prototype');
|
@ -13,9 +13,6 @@ info: |
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'global').get;
|
var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'global').get;
|
||||||
var other = $262.createRealm().global;
|
|
||||||
var otherRegExpProto = other.RegExp.prototype;
|
|
||||||
var otherRegExpGetter = Object.getOwnPropertyDescriptor(otherRegExpProto, 'global').get;
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
get.call({});
|
get.call({});
|
||||||
@ -28,11 +25,3 @@ assert.throws(TypeError, function() {
|
|||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
get.call(arguments);
|
get.call(arguments);
|
||||||
}, 'arguments object');
|
}, 'arguments object');
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
get.call(otherRegExpProto);
|
|
||||||
}, 'cross-realm RegExp.prototype');
|
|
||||||
|
|
||||||
assert.throws(other.TypeError, function() {
|
|
||||||
otherRegExpGetter.call(RegExp.prototype);
|
|
||||||
}, 'cross-realm RegExp.prototype getter method against primary realm RegExp.prototype');
|
|
||||||
|
27
test/built-ins/RegExp/prototype/ignoreCase/cross-realm.js
vendored
Normal file
27
test/built-ins/RegExp/prototype/ignoreCase/cross-realm.js
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-get-regexp.prototype.ignorecase
|
||||||
|
es6id: 21.2.5.5
|
||||||
|
description: A TypeError is thrown when the "this" value is an invalid cross-realm Object
|
||||||
|
info: |
|
||||||
|
1. Let R be the this value.
|
||||||
|
2. If Type(R) is not Object, throw a TypeError exception.
|
||||||
|
3. If R does not have an [[OriginalFlags]] internal slot, then
|
||||||
|
a. If SameValue(R, %RegExpPrototype%) is true, return undefined.
|
||||||
|
b. Otherwise, throw a TypeError exception.
|
||||||
|
features: [cross-realm]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'ignoreCase').get;
|
||||||
|
var other = $262.createRealm().global;
|
||||||
|
var otherRegExpProto = other.RegExp.prototype;
|
||||||
|
var otherRegExpGetter = Object.getOwnPropertyDescriptor(otherRegExpProto, 'ignoreCase').get;
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
get.call(otherRegExpProto);
|
||||||
|
}, 'cross-realm RegExp.prototype');
|
||||||
|
|
||||||
|
assert.throws(other.TypeError, function() {
|
||||||
|
otherRegExpGetter.call(RegExp.prototype);
|
||||||
|
}, 'cross-realm RegExp.prototype getter method against primary realm RegExp.prototype');
|
@ -13,9 +13,6 @@ info: |
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'ignoreCase').get;
|
var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'ignoreCase').get;
|
||||||
var other = $262.createRealm().global;
|
|
||||||
var otherRegExpProto = other.RegExp.prototype;
|
|
||||||
var otherRegExpGetter = Object.getOwnPropertyDescriptor(otherRegExpProto, 'ignoreCase').get;
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
get.call({});
|
get.call({});
|
||||||
@ -28,11 +25,3 @@ assert.throws(TypeError, function() {
|
|||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
get.call(arguments);
|
get.call(arguments);
|
||||||
}, 'arguments object');
|
}, 'arguments object');
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
get.call(otherRegExpProto);
|
|
||||||
}, 'cross-realm RegExp.prototype');
|
|
||||||
|
|
||||||
assert.throws(other.TypeError, function() {
|
|
||||||
otherRegExpGetter.call(RegExp.prototype);
|
|
||||||
}, 'cross-realm RegExp.prototype getter method against primary realm RegExp.prototype');
|
|
||||||
|
27
test/built-ins/RegExp/prototype/multiline/cross-realm.js
vendored
Normal file
27
test/built-ins/RegExp/prototype/multiline/cross-realm.js
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-get-regexp.prototype.multiline
|
||||||
|
es6id: 21.2.5.7
|
||||||
|
description: A TypeError is thrown when the "this" value is an invalid cross-realm Object
|
||||||
|
info: |
|
||||||
|
1. Let R be the this value.
|
||||||
|
2. If Type(R) is not Object, throw a TypeError exception.
|
||||||
|
3. If R does not have an [[OriginalFlags]] internal slot, then
|
||||||
|
a. If SameValue(R, %RegExpPrototype%) is true, return undefined.
|
||||||
|
b. Otherwise, throw a TypeError exception.
|
||||||
|
features: [cross-realm]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'multiline').get;
|
||||||
|
var other = $262.createRealm().global;
|
||||||
|
var otherRegExpProto = other.RegExp.prototype;
|
||||||
|
var otherRegExpGetter = Object.getOwnPropertyDescriptor(otherRegExpProto, 'multiline').get;
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
get.call(otherRegExpProto);
|
||||||
|
}, 'cross-realm RegExp.prototype');
|
||||||
|
|
||||||
|
assert.throws(other.TypeError, function() {
|
||||||
|
otherRegExpGetter.call(RegExp.prototype);
|
||||||
|
}, 'cross-realm RegExp.prototype getter method against primary realm RegExp.prototype');
|
@ -13,9 +13,6 @@ info: |
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'multiline').get;
|
var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'multiline').get;
|
||||||
var other = $262.createRealm().global;
|
|
||||||
var otherRegExpProto = other.RegExp.prototype;
|
|
||||||
var otherRegExpGetter = Object.getOwnPropertyDescriptor(otherRegExpProto, 'multiline').get;
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
get.call({});
|
get.call({});
|
||||||
@ -28,11 +25,3 @@ assert.throws(TypeError, function() {
|
|||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
get.call(arguments);
|
get.call(arguments);
|
||||||
}, 'arguments object');
|
}, 'arguments object');
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
get.call(otherRegExpProto);
|
|
||||||
}, 'cross-realm RegExp.prototype');
|
|
||||||
|
|
||||||
assert.throws(other.TypeError, function() {
|
|
||||||
otherRegExpGetter.call(RegExp.prototype);
|
|
||||||
}, 'cross-realm RegExp.prototype getter method against primary realm RegExp.prototype');
|
|
||||||
|
27
test/built-ins/RegExp/prototype/source/cross-realm.js
vendored
Normal file
27
test/built-ins/RegExp/prototype/source/cross-realm.js
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-get-regexp.prototype.source
|
||||||
|
es6id: 21.2.5.10
|
||||||
|
description: A TypeError is thrown when the "this" value is an invalid cross-realm Object
|
||||||
|
info: |
|
||||||
|
1. Let R be the this value.
|
||||||
|
2. If Type(R) is not Object, throw a TypeError exception.
|
||||||
|
3. If R does not have an [[OriginalFlags]] internal slot, then
|
||||||
|
a. If SameValue(R, %RegExpPrototype%) is true, return "(?:)".
|
||||||
|
b. Otherwise, throw a TypeError exception.
|
||||||
|
features: [cross-realm]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'source').get;
|
||||||
|
var other = $262.createRealm().global;
|
||||||
|
var otherRegExpProto = other.RegExp.prototype;
|
||||||
|
var otherRegExpGetter = Object.getOwnPropertyDescriptor(otherRegExpProto, 'source').get;
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
get.call(otherRegExpProto);
|
||||||
|
}, 'cross-realm RegExp.prototype');
|
||||||
|
|
||||||
|
assert.throws(other.TypeError, function() {
|
||||||
|
otherRegExpGetter.call(RegExp.prototype);
|
||||||
|
}, 'cross-realm RegExp.prototype getter method against primary realm RegExp.prototype');
|
@ -13,9 +13,6 @@ info: |
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'source').get;
|
var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'source').get;
|
||||||
var other = $262.createRealm().global;
|
|
||||||
var otherRegExpProto = other.RegExp.prototype;
|
|
||||||
var otherRegExpGetter = Object.getOwnPropertyDescriptor(otherRegExpProto, 'source').get;
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
get.call({});
|
get.call({});
|
||||||
@ -28,11 +25,3 @@ assert.throws(TypeError, function() {
|
|||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
get.call(arguments);
|
get.call(arguments);
|
||||||
}, 'arguments object');
|
}, 'arguments object');
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
get.call(otherRegExpProto);
|
|
||||||
}, 'cross-realm RegExp.prototype');
|
|
||||||
|
|
||||||
assert.throws(other.TypeError, function() {
|
|
||||||
otherRegExpGetter.call(RegExp.prototype);
|
|
||||||
}, 'cross-realm RegExp.prototype getter method against primary realm RegExp.prototype');
|
|
||||||
|
28
test/built-ins/RegExp/prototype/sticky/cross-realm.js
vendored
Normal file
28
test/built-ins/RegExp/prototype/sticky/cross-realm.js
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: Invoked on a cross-realm object without an [[OriginalFlags]] internal slot
|
||||||
|
es6id: 21.2.5.12
|
||||||
|
info: |
|
||||||
|
21.2.5.12 get RegExp.prototype.sticky
|
||||||
|
|
||||||
|
1. Let R be the this value.
|
||||||
|
2. If Type(R) is not Object, throw a TypeError exception.
|
||||||
|
3. If R does not have an [[OriginalFlags]] internal slot, throw a TypeError
|
||||||
|
exception.
|
||||||
|
features: [cross-realm]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var sticky = Object.getOwnPropertyDescriptor(RegExp.prototype, 'sticky').get;
|
||||||
|
var other = $262.createRealm().global;
|
||||||
|
var otherRegExpProto = other.RegExp.prototype;
|
||||||
|
var otherRegExpGetter = Object.getOwnPropertyDescriptor(otherRegExpProto, 'sticky').get;
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
sticky.call(otherRegExpProto);
|
||||||
|
}, 'cross-realm RegExp.prototype');
|
||||||
|
|
||||||
|
assert.throws(other.TypeError, function() {
|
||||||
|
otherRegExpGetter.call(RegExp.prototype);
|
||||||
|
}, 'cross-realm RegExp.prototype getter method against primary realm RegExp.prototype');
|
@ -14,9 +14,6 @@ info: |
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
var sticky = Object.getOwnPropertyDescriptor(RegExp.prototype, 'sticky').get;
|
var sticky = Object.getOwnPropertyDescriptor(RegExp.prototype, 'sticky').get;
|
||||||
var other = $262.createRealm().global;
|
|
||||||
var otherRegExpProto = other.RegExp.prototype;
|
|
||||||
var otherRegExpGetter = Object.getOwnPropertyDescriptor(otherRegExpProto, 'sticky').get;
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
sticky.call({});
|
sticky.call({});
|
||||||
@ -29,11 +26,3 @@ assert.throws(TypeError, function() {
|
|||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
sticky.call(arguments);
|
sticky.call(arguments);
|
||||||
}, 'arguments object');
|
}, 'arguments object');
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
sticky.call(otherRegExpProto);
|
|
||||||
}, 'cross-realm RegExp.prototype');
|
|
||||||
|
|
||||||
assert.throws(other.TypeError, function() {
|
|
||||||
otherRegExpGetter.call(RegExp.prototype);
|
|
||||||
}, 'cross-realm RegExp.prototype getter method against primary realm RegExp.prototype');
|
|
||||||
|
28
test/built-ins/RegExp/prototype/unicode/cross-realm.js
vendored
Normal file
28
test/built-ins/RegExp/prototype/unicode/cross-realm.js
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: Invoked on a cross-realm object without an [[OriginalFlags]] internal slot
|
||||||
|
es6id: 21.2.5.15
|
||||||
|
info: |
|
||||||
|
21.2.5.15 get RegExp.prototype.unicode
|
||||||
|
|
||||||
|
1. Let R be the this value.
|
||||||
|
2. If Type(R) is not Object, throw a TypeError exception.
|
||||||
|
3. If R does not have an [[OriginalFlags]] internal slot, throw a TypeError
|
||||||
|
exception.
|
||||||
|
features: [cross-realm]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var unicode = Object.getOwnPropertyDescriptor(RegExp.prototype, 'unicode').get;
|
||||||
|
var other = $262.createRealm().global;
|
||||||
|
var otherRegExpProto = other.RegExp.prototype;
|
||||||
|
var otherRegExpGetter = Object.getOwnPropertyDescriptor(otherRegExpProto, 'unicode').get;
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
unicode.call(otherRegExpProto);
|
||||||
|
}, 'cross-realm RegExp.prototype');
|
||||||
|
|
||||||
|
assert.throws(other.TypeError, function() {
|
||||||
|
otherRegExpGetter.call(RegExp.prototype);
|
||||||
|
}, 'cross-realm RegExp.prototype getter method against primary realm RegExp.prototype');
|
@ -14,9 +14,6 @@ info: |
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
var unicode = Object.getOwnPropertyDescriptor(RegExp.prototype, 'unicode').get;
|
var unicode = Object.getOwnPropertyDescriptor(RegExp.prototype, 'unicode').get;
|
||||||
var other = $262.createRealm().global;
|
|
||||||
var otherRegExpProto = other.RegExp.prototype;
|
|
||||||
var otherRegExpGetter = Object.getOwnPropertyDescriptor(otherRegExpProto, 'unicode').get;
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
unicode.call({});
|
unicode.call({});
|
||||||
@ -29,11 +26,3 @@ assert.throws(TypeError, function() {
|
|||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
unicode.call(arguments);
|
unicode.call(arguments);
|
||||||
}, 'arguments object');
|
}, 'arguments object');
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
unicode.call(otherRegExpProto);
|
|
||||||
}, 'cross-realm RegExp.prototype');
|
|
||||||
|
|
||||||
assert.throws(other.TypeError, function() {
|
|
||||||
otherRegExpGetter.call(RegExp.prototype);
|
|
||||||
}, 'cross-realm RegExp.prototype getter method against primary realm RegExp.prototype');
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user