Note: There are a few cases of duplicates in user autocompletion which are being worked on.

Setting location.hash mangles URLs with escaped characters

RESOLVED DUPLICATE of bug 622981

Status

()

Core
Networking
RESOLVED DUPLICATE of bug 622981
6 years ago
6 years ago

People

(Reporter: Greg Valure, Unassigned)

Tracking

2.0 Branch
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
The attached HTML file sets location.hash to "test" on body.onload and window.onhashchange.  If the path has a space in it and you set the URL to end in #, the URL will get mangled.  It doesn't happen in any other situation.

1. Open the attached file.  URL bar shows file:///C:/Temp/a a.html, it correctly gets changed to file:///C:/Temp/a a.html#test.

2. Open file:///C:/Temp/a a.html#foo, it correctly gets changed to file:///C:/Temp/a a.html#test

3. Open file:///C:/Temp/a a.html#, it incorrectly gets changed to file:///C:/Temp/a a.htmtestl#

4. If the file is renamed to aa.html, opening file:///C:/Temp/aa.html# makes it correctly get changed to file:///C:/Temp/aa.html#test

5. If the file is renamed to a a a.html, opening file:///C:/Temp/a a a.html# makes it incorrectly change to file:///c:/temp/a a a.htesttml#

Since adding a space made it shift left two characters and two spaces shifted it four, I'm guessing the code for the special case of "#" is taking a string index from the unescaped URL and using it to insert into an escaped URL string.

Using Firefox 4.0.1.
(Reporter)

Comment 1

6 years ago
Created attachment 531987 [details]
Test case

Comment 2

6 years ago
jesup, I assume your recent patch fixed this, right?

Comment 3

6 years ago
Er, and ccing rjesup.  See comment 2.
Assignee: ashuk → nobody
Component: Java APIs for DOM → Networking
QA Contact: dom-apis → networking
This is the same problem as bug 622981 - the space gets encoded causing the issue.  Tried it on a trunk build (on linux though) and the problem does not appear.
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 622981
You need to log in before you can comment on or make changes to this bug.