blob: 666bd56e9e92ff004769652df8c95d4a71838b0e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// |reftest| skip -- legacy-regexp is not supported
// Copyright (C) 2020 ExE Boss. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-regexp.prototype.compile
description: RegExp.prototype.compile throws a TypeError for cross-realm calls
features: [legacy-regexp,cross-realm]
---*/
const other = $262.createRealm().global;
const regexp = new RegExp("");
const otherRealm_regexp = new other.RegExp("");
assert.throws(
TypeError,
function () {
RegExp.prototype.compile.call(otherRealm_regexp);
});
assert.throws(
other.TypeError,
function () {
other.RegExp.prototype.compile.call(regexp);
},
"`other.RegExp.prototype.compile.call(regexp)` throws TypeError"
);
assert.sameValue(
otherRealm_regexp.compile(),
otherRealm_regexp,
"`otherRealm_regexp.compile()` is SameValue with `otherRealm_regexp`"
);
reportCompare(0, 0);
|