If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

window.location changes URL to absolute path

RESOLVED WORKSFORME

Status

()

Firefox
Developer Tools
RESOLVED WORKSFORME
5 years ago
4 years ago

People

(Reporter: obrufau, Unassigned)

Tracking

14 Branch
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

5 years ago
User Agent: Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20100101 Firefox/14.0.1
Build ID: 20120713134347

Steps to reproduce:

If you do window.location=something (such as window.location='google.com'), or window.location.replace() with one or two arguments (such as window.location.replace('google.com','abc'))


Actual results:

The location bar shows an strange URL, which I guess is the absolute path in my computer:
jar:file:///C:/Archivos de programa/Mozilla Firefox/Firefox 14/omni.ja!/chrome/browser/content/browser/google.com

Additional data:
->I have Firefox installed on C:\Archivos de programa\Mozilla Firefox\Firefox 14\
->"google.com" at the end of the URL is the first argument of window.location.replace(), or the string "something" in window.location=something.

Moreover, with window.location.replace(), you can't go back to the page you were.
(Reporter)

Comment 1

5 years ago
Fixed on Firefox 15 beta
Please provide a testcase.
Aren't you missing the protocol e.g. http://google.com ?
Component: Untriaged → DOM
Product: Firefox → Core
(Reporter)

Comment 3

5 years ago
If I do it from a <script> it works well and there isn't any bug:
for example, in http://localhost/bug.htm:
   <script type="text/javascript">
   //<![CDATA[
   "use strict";
   window.location='abc';
   //]]>
   </script>
It redirects to http://localhost/abc

But if I load http://localhost/bug.htm (without redirection script), open the console or scratchpad and enter...
   window.location='abc';

... it redirects me to
   jar:file:///C:/Archivos%20de%20programa/Mozilla%20Firefox/Firefox%2014/omni.ja!/chrome/browser/content/browser/abc

So I can't provide a testcase.
window.location='abc'; is a relative URL and the absolute URL based on your current location (sratchpad) is the result that you get.
Component: DOM → Developer Tools
Product: Core → Firefox
(Reporter)

Comment 5

5 years ago
Well, but I think it should be interpreted as a relative URL based on the current page, even if the script is executed from console/scratchpad instead of the page.

But If you think that it shouldn't, then the bug is that Firefox 15 interpretes it like I want...
(Reporter)

Comment 6

5 years ago
Created attachment 651124 [details]
Screenshot of the error
(Reporter)

Comment 7

5 years ago
Created attachment 651127 [details]
Screnshot of the bug 2

Curiously, if I do window.location='', Firefox loads itself into current tab... weird
(Reporter)

Comment 8

4 years ago
Fixed on Firefox 15 beta
Status: UNCONFIRMED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.