summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.matchAll/this-tostring-flags-throws.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/RegExp/prototype/Symbol.matchAll/this-tostring-flags-throws.js')
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/Symbol.matchAll/this-tostring-flags-throws.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.matchAll/this-tostring-flags-throws.js b/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.matchAll/this-tostring-flags-throws.js
new file mode 100644
index 0000000000..3dc84b9a0c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.matchAll/this-tostring-flags-throws.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2018 Peter Wong. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: Re-throws errors while coercing RegExp's flags to a string
+info: |
+ RegExp.prototype [ @@matchAll ] ( string )
+ [...]
+ 3. Return ? MatchAllIterator(R, string).
+
+ MatchAllIterator ( R, O )
+ [...]
+ 2. If ? IsRegExp(R) is true, then
+ [...]
+ b. Let flags be ? ToString(? Get(R, "flags"))
+features: [Symbol.matchAll]
+---*/
+
+var regexp = /\w/;
+Object.defineProperty(regexp, 'flags', {
+ value: {
+ valueOf() {
+ ERROR('valueOf Should not be called');
+ },
+ toString() {
+ throw new Test262Error();
+ }
+ }
+});
+
+assert.throws(Test262Error, function() {
+ regexp[Symbol.matchAll]('');
+});
+
+reportCompare(0, 0);