Backed out 3 changesets (bug 1892041) for causing failures on async-module-does-not...
[gecko.git] / js / src / tests / test262 / annexB / built-ins / RegExp / prototype / compile / this-cross-realm-instance.js
blob5c4f9a82340e42c1dcc6a336cf49ff77962b1ce0
1 // |reftest| skip -- legacy-regexp is not supported
2 // Copyright (C) 2020 ExE Boss. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 esid: sec-regexp.prototype.compile
6 description: RegExp.prototype.compile throws a TypeError for cross-realm calls
7 features: [legacy-regexp,cross-realm]
8 ---*/
10 const other = $262.createRealm().global;
12 const regexp = new RegExp("");
13 const otherRealm_regexp = new other.RegExp("");
15 assert.throws(
16   TypeError,
17   function () {
18     RegExp.prototype.compile.call(otherRealm_regexp);
19   },
20   "`RegExp.prototype.compile.call(otherRealm_regexp)` throws TypeError"
23 assert.throws(
24   other.TypeError,
25   function () {
26     other.RegExp.prototype.compile.call(regexp);
27   },
28   "`other.RegExp.prototype.compile.call(regexp)` throws TypeError"
31 assert.sameValue(
32   otherRealm_regexp.compile(),
33   otherRealm_regexp,
34   "`otherRealm_regexp.compile()` is SameValue with `otherRealm_regexp`"
37 reportCompare(0, 0);