diff --git a/test/built-ins/RegExp/prototype/dotAll/this-val-invalid-obj.js b/test/built-ins/RegExp/prototype/dotAll/this-val-invalid-obj.js index 0f0d3909b937feda9fcd2fb782b4edf15522a1cd..5790adcf4cfe072e1bf5f59a3e1075500e581b8c 100644 --- a/test/built-ins/RegExp/prototype/dotAll/this-val-invalid-obj.js +++ b/test/built-ins/RegExp/prototype/dotAll/this-val-invalid-obj.js @@ -16,6 +16,9 @@ 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({}); @@ -28,3 +31,11 @@ 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'); diff --git a/test/built-ins/RegExp/prototype/global/this-val-invalid-obj.js b/test/built-ins/RegExp/prototype/global/this-val-invalid-obj.js index 123373d483517d8285136817c61199ec36a0ac23..b8882b62506e3799496552e50b1871fe3dd3876a 100644 --- a/test/built-ins/RegExp/prototype/global/this-val-invalid-obj.js +++ b/test/built-ins/RegExp/prototype/global/this-val-invalid-obj.js @@ -13,6 +13,9 @@ 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({}); @@ -25,3 +28,11 @@ 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'); diff --git a/test/built-ins/RegExp/prototype/ignoreCase/this-val-invalid-obj.js b/test/built-ins/RegExp/prototype/ignoreCase/this-val-invalid-obj.js index b08d8e524b0a4d219684056c7d76c14185331d35..d433ed3481d536ed355ea17e5efd0bddc2349a88 100644 --- a/test/built-ins/RegExp/prototype/ignoreCase/this-val-invalid-obj.js +++ b/test/built-ins/RegExp/prototype/ignoreCase/this-val-invalid-obj.js @@ -13,6 +13,9 @@ 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({}); @@ -25,3 +28,11 @@ 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'); diff --git a/test/built-ins/RegExp/prototype/multiline/this-val-invalid-obj.js b/test/built-ins/RegExp/prototype/multiline/this-val-invalid-obj.js index 85a8b78b87007c210e1c36ba479332a171517e44..e9178d1270abf78e68bfd51dbcf1e8cca9662960 100644 --- a/test/built-ins/RegExp/prototype/multiline/this-val-invalid-obj.js +++ b/test/built-ins/RegExp/prototype/multiline/this-val-invalid-obj.js @@ -13,6 +13,9 @@ 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({}); @@ -25,3 +28,11 @@ 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'); diff --git a/test/built-ins/RegExp/prototype/sticky/this-val-invalid-obj.js b/test/built-ins/RegExp/prototype/sticky/this-val-invalid-obj.js index f982ecccf4cd19ceab7a9800d13751df48192141..03c5fead8583bbb3c77687034a1ba3ad1c9aa656 100644 --- a/test/built-ins/RegExp/prototype/sticky/this-val-invalid-obj.js +++ b/test/built-ins/RegExp/prototype/sticky/this-val-invalid-obj.js @@ -14,6 +14,9 @@ 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({}); @@ -26,3 +29,11 @@ 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'); diff --git a/test/built-ins/RegExp/prototype/unicode/this-val-invalid-obj.js b/test/built-ins/RegExp/prototype/unicode/this-val-invalid-obj.js index 2c938a8852a33d65ae5afa97cb3a27fd3c09a0f5..7cd3dd0922816cfc41d4fa76445af9455014ec4b 100644 --- a/test/built-ins/RegExp/prototype/unicode/this-val-invalid-obj.js +++ b/test/built-ins/RegExp/prototype/unicode/this-val-invalid-obj.js @@ -14,6 +14,9 @@ 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({}); @@ -26,3 +29,11 @@ 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');