Replace method on strings fails with RegExp object from another compartment

UNCONFIRMED
Unassigned

Status

()

Firefox
General
UNCONFIRMED
6 years ago
6 years ago

People

(Reporter: Daniel Hahler, Unassigned)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
User-Agent:       Mozilla/5.0 (X11; Linux i686; rv:2.0b12pre) Gecko/20110213 Firefox/4.0b12pre
Build Identifier: Mozilla/5.0 (X11; Linux i686; rv:2.0b12pre) Gecko/20110213 Firefox/4.0b12pre

I've run into this bug using Pentadactyl, where I have the following in my rc file:
   map gp -js dactyl.open(buffer.URL.replace(/(\.\w{2,4})\//, "$1.nyud.net/"))

Howerver, buffer.URL.replace never worked when using a RegExp object, but only when using normal strings for the pattern.

According to Kris Maglione this is a bug in Firefox.

Reproducible: Always




The extensions source of the Buffer object can be seen at http://code.google.com/p/dactyl/source/browse/common/content/buffer.js - in case this might be relevant.

Updated

6 years ago
Version: unspecified → Trunk
To add some more detail to this, the replacement works, but the stringified version of the regexp is replaced rather than the matching text. So, "/(\\.\\w{2,4})\\//r".replace(regexp, "##") returns the string "##".

If I had to guess, I'd say that this was related to 606875, although {}.toString.call(regexp) does now return "[object RegExp]" as expected.
You need to log in before you can comment on or make changes to this bug.