archives

« Bugzilla Issues Index

#2492 — 21.2.5.2.1 (RegExpExec): Access to [[RegExpMatcher]] in step 4 is visible by non-standard RegExp.p.compile


+++ This bug was initially created as a clone of Bug #1575 +++

The [[Match]] property was accessed in step 9 in ES5.1 (cf. 15.10.6.2 RegExp.prototype.exec), but has been changed to step 4 (cf. [[RegExpMatcher]] in RegExpExec abstract operation). This change is potentially user visible due to the non-standard RegExp.prototype.compile function.

Example:
---
var r = /a/;
r.lastIndex = {valueOf: function(){ print("compile"); r.compile("b","g") }}; r.exec("b")
---

V8 and Opera(12.15 - not V8 based) both return `["b"]`, whereas SpiderMonkey returns `null`. (JSC and IE10 don't even execute the valueOf function.)

Per the current ES6 draft, the expected result is `null`.


fixed in rev23 editor's draft

The fix made for Bug #1575 was apparently revered, but I can't tell why. It may have been a crash recovery issue.


fixed in rev23 draft