Closed Bug 1109577 Opened 11 years ago Closed 9 years ago

Accessing `RegExp.prototype.flags` directly should throw

Categories

(Core :: JavaScript: Standard Library, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: mathias, Unassigned)

References

Details

Since bug 1108467 the following test was added to the codebase: assertEq(RegExp.prototype.flags, ""); However, `RegExp.prototype.flags` should throw since it accesses `RegExp.prototype.global` which throws in step 3 of its algorithm (since `R = RegExp.prototype` in this situation): 3. If R does not have an [[OriginalFlags]] internal slot throw a TypeError exception. Consider removing this broken test and behavior.
See Also: → 1108467
Oh, indeed!
Since none of the major ECMAScript engines seem to implement the part of the algorithm described above, maybe the spec should be changed. I’ve filed https://bugs.ecmascript.org/show_bug.cgi?id=3432.
Depends on: 1192038
A recent amendment of the spec (https://github.com/tc39/ecma262/pull/511) made this bug invalid: now RegExp.prototype.flags should produce "".
Claude is right.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.