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 bf136a4abe..6d2af3fab0 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,6 +13,8 @@ info: | ---*/ var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'source').get; +var otherRealm = $262.createRealm().global; +var otherRealmRegExpProto = otherRealm.RegExp.prototype; assert.throws(TypeError, function() { get.call({}); @@ -25,3 +27,7 @@ assert.throws(TypeError, function() { assert.throws(TypeError, function() { get.call(arguments); }, 'arguments object'); + +assert.throws(TypeError, function() { + get.call(otherRealmRegExpProto); +}, 'cross-realm RegExp.prototype');