From 9e0410814ae1e8abef112f12d2e38691623676ee Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Tue, 30 Oct 2018 14:04:19 -0400 Subject: [PATCH] Test cross-realm use of RegExp source getter in both directions --- .../RegExp/prototype/source/this-val-invalid-obj.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/built-ins/RegExp/prototype/source/this-val-invalid-obj.js b/test/built-ins/RegExp/prototype/source/this-val-invalid-obj.js index 6d2af3fab0..3385bbe4db 100644 --- a/test/built-ins/RegExp/prototype/source/this-val-invalid-obj.js +++ b/test/built-ins/RegExp/prototype/source/this-val-invalid-obj.js @@ -13,8 +13,9 @@ info: | ---*/ var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'source').get; -var otherRealm = $262.createRealm().global; -var otherRealmRegExpProto = otherRealm.RegExp.prototype; +var other = $262.createRealm().global; +var otherRegExpProto = other.RegExp.prototype; +var otherRegExpGetter = Object.getOwnPropertyDescriptor(otherRegExpProto, 'source').get; assert.throws(TypeError, function() { get.call({}); @@ -29,5 +30,9 @@ assert.throws(TypeError, function() { }, 'arguments object'); assert.throws(TypeError, function() { - get.call(otherRealmRegExpProto); + 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');