| 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: pending |
| 6 |
description: RegExp.input throws a TypeError for cross-realm receiver |
| 7 |
info: | |
| 8 |
get RegExp.input |
| 9 |
|
| 10 |
1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpInput]]). |
| 11 |
|
| 12 |
set RegExp.input = val |
| 13 |
|
| 14 |
1. Return ? SetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpInput]], val). |
| 15 |
|
| 16 |
GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ). |
| 17 |
|
| 18 |
1. Assert C is an object that has an internal slot named internalSlotName. |
| 19 |
2. If SameValue(C, thisValue) is false, throw a TypeError exception. |
| 20 |
3. ... |
| 21 |
|
| 22 |
SetLegacyRegExpStaticProperty( C, thisValue, internalSlotName, val ). |
| 23 |
|
| 24 |
1. Assert C is an object that has an internal slot named internalSlotName. |
| 25 |
2. If SameValue(C, thisValue) is false, throw a TypeError exception. |
| 26 |
3. ... |
| 27 |
features: [legacy-regexp,cross-realm,Reflect,Reflect.set] |
| 28 |
---*/ |
| 29 |
|
| 30 |
const other = $262.createRealm().global; |
| 31 |
|
| 32 |
assert.throws( |
| 33 |
TypeError, |
| 34 |
function () { |
| 35 |
Reflect.get(RegExp, "input", other.RegExp); |
| 36 |
}, |
| 37 |
"RegExp.input getter throws for cross-realm receiver" |
| 38 |
); |
| 39 |
|
| 40 |
assert.throws( |
| 41 |
TypeError, |
| 42 |
function () { |
| 43 |
Reflect.set(RegExp, "input", "", other.RegExp); |
| 44 |
}, |
| 45 |
"RegExp.input setter throws for cross-realm receiver" |
| 46 |
); |
| 47 |
|
| 48 |
assert.throws( |
| 49 |
TypeError, |
| 50 |
function () { |
| 51 |
Reflect.get(RegExp, "$_", other.RegExp); |
| 52 |
}, |
| 53 |
"RegExp.$_ getter throws for cross-realm receiver" |
| 54 |
); |
| 55 |
|
| 56 |
assert.throws( |
| 57 |
TypeError, |
| 58 |
function () { |
| 59 |
Reflect.set(RegExp, "$_", "", other.RegExp); |
| 60 |
}, |
| 61 |
"RegExp.$_ setter throws for cross-realm receiver" |
| 62 |
); |
| 63 |
|
| 64 |
reportCompare(0, 0); |