Closed Bug 280546 Opened 21 years ago Closed 20 years ago

JavaScript1.2 - foo.replace("?","") dies with "invalid quantifier"

Categories

(Core :: JavaScript Engine, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: Erb, Unassigned)

References

()

Details

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Build Identifier: The URL produces a popup window with the following source: <html> <head> <title>eTrust SSO for Web</title> <SCRIPT LANGUAGE="JavaScript1.2"> <!-- window.onload = loadFrame; function loadFrame() { var loginURL = "/?SSOCMD=SSOLOGIN"; var query = top.location.search; if ( query ) { loginURL = query.replace("SSCMD", "SSOCMD" ); loginURL = loginURL.replace("SSCMD", "SSOCMD" ); loginURL = loginURL.replace("?query=", "?"); } top.data.location.replace(loginURL); } //--> </SCRIPT> </head> <frameset noresize framespacing="0" frameborder="0" border="false" cols="500" rows="360,0"> <frame name="data" noresize scrolling="no" marginwidth="0" marginheight="0" src="data.html"> <body> </body> </frameset> </html> Note the tricky way the URL is replaced. This works on IE but not Firefox. Reproducible: Always Steps to Reproduce: See Details Actual Results: Only the page background is visible. Expected Results: New URL is navigated to in popup window, showing a form.
Sorry, forgot the Firefox version: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Version: unspecified → 1.0 Branch
Try disabling the popup blocking, otherwise popups in load events aren't going to appear.
Popups are not being blocked in this scenario.
I suspect that will turn out to be an intentional feature of JavaScript1.2, which was a rather different beast than most JavaScripts. While <script language="JavaScript"> alert("f?oo".replace('?oo','ee')); </script> alerts "Fee", <script language="JavaScript1.2"> alert("f?oo".replace('?oo','ee')); </script> dies with an "Error: invalid quantifier ?" in the JS Console.
Assignee: firefox → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → pschwartau
Summary: tricky JavaScript replacement of current page URL does not work → JavaScript1.2 - foo.replace("?","") dies with "invalid quantifier"
Version: 1.0 Branch → Trunk
It may be unavoidable to have to say that Microsoft sets the standard. I think that's pretty much the reason behind most pages that work "wrong" in Mozilla/Firefox.
This error occurs for JavaScript 1.1-1.4, but not in JavaScript 1.5. The ECMA 262 1 and 2 Specifications had the first argument as a regular expression however ECMA 262 3 has the first argument as either a string or a regular expression. In JS 1.1 - 1.4, We convert the argument to a regular expression but in JS 1.5 we treat it as a string. Another example where older JS version emulation bites us.
Fixed for 1.8b2 by checkin for bug 255895. /be
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.