summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.match/get-flags-err.js
blob: e45a8d078976052afd60640c2b788a798e5393ee (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
// Copyright (C) 2022 Richard Gibson. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
description: >
    Errors thrown by `flags` accessor are forwarded to the runtime
esid: sec-regexp.prototype-@@match
info: |
    1. Let _rx_ be the *this* value.
    2. If Type(_rx_) is not Object, throw a *TypeError* exception.
    3. Let _S_ be ? ToString(_string_).
    4. Let _flags_ be ? ToString(? Get(_rx_, *"flags"*)).
features: [Symbol.match]
---*/

function CustomError() {}

var obj = {
  get flags() {
    throw new CustomError();
  },
  get global() {
    throw new Test262Error('global property should not be read');
  },
  get unicode() {
    throw new Test262Error('unicode property should not be read');
  }
};

assert.throws(CustomError, function() {
  RegExp.prototype[Symbol.match].call(obj);
});

reportCompare(0, 0);