Move cross-realm tests into their own files

This commit is contained in:
Richard Gibson 2018-10-31 14:47:08 -04:00 committed by Rick Waldron
parent 6da621f161
commit 5b3d429e28
14 changed files with 193 additions and 77 deletions

View 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');

View File

@ -16,9 +16,6 @@ features: [regexp-dotall]
---*/
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({});
@ -31,11 +28,3 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
dotAll.call(arguments);
}, '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');

View 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');

View File

@ -13,9 +13,6 @@ info: |
---*/
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({});
@ -28,11 +25,3 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
get.call(arguments);
}, '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');

View 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');

View File

@ -13,9 +13,6 @@ info: |
---*/
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({});
@ -28,11 +25,3 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
get.call(arguments);
}, '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');

View 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');

View File

@ -13,9 +13,6 @@ info: |
---*/
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({});
@ -28,11 +25,3 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
get.call(arguments);
}, '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');

View 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');

View File

@ -13,9 +13,6 @@ info: |
---*/
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({});
@ -28,11 +25,3 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
get.call(arguments);
}, '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');

View 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');

View File

@ -14,9 +14,6 @@ info: |
---*/
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({});
@ -29,11 +26,3 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
sticky.call(arguments);
}, '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');

View 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');

View File

@ -14,9 +14,6 @@ info: |
---*/
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({});
@ -29,11 +26,3 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
unicode.call(arguments);
}, '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');