Closed Bug 633830 Opened 13 years ago Closed 5 years ago

Replace method on strings fails with RegExp object from another compartment

Categories

(Firefox :: General, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: mozilla-bugs, Unassigned)

Details

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.
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.
So this is a regression of bug 606875 ?
Flags: needinfo?(mozilla-bugs)

2019-03-06

This bug is part of a group of bugs which have had an open needinfo for at least 12 weeks.

The request for information has not been answered, and we can't move forward on the bug so we are closing it.

If the defect is still present, please reopen this bug with an updated report.

Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → INCOMPLETE
Flags: needinfo?(mozilla-bugs)
You need to log in before you can comment on or make changes to this bug.