Last Comment Bug 633830 - Replace method on strings fails with RegExp object from another compartment
: Replace method on strings fails with RegExp object from another compartment
Status: UNCONFIRMED
:
Product: Firefox
Classification: Client Software
Component: General (show other bugs)
: Trunk
: x86 Linux
: -- normal with 1 vote (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-02-13 08:23 PST by Daniel Hahler
Modified: 2011-02-13 22:22 PST (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Daniel Hahler 2011-02-13 08:23:17 PST
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.
Comment 1 Kris Maglione [:kmag] 2011-02-13 22:22:49 PST
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.

Note You need to log in before you can comment on or make changes to this bug.