Last Comment Bug 656691 - Setting location.hash mangles URLs with escaped characters
: Setting location.hash mangles URLs with escaped characters
Status: RESOLVED DUPLICATE of bug 622981
:
Product: Core
Classification: Components
Component: Networking (show other bugs)
: 2.0 Branch
: x86 Windows XP
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-05-12 11:05 PDT by Greg Valure
Modified: 2011-07-17 22:05 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Test case (216 bytes, text/html)
2011-05-12 11:07 PDT, Greg Valure
no flags Details

Description Greg Valure 2011-05-12 11:05:45 PDT
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.
Comment 1 Greg Valure 2011-05-12 11:07:18 PDT
Created attachment 531987 [details]
Test case
Comment 2 Boris Zbarsky [:bz] 2011-07-15 16:34:46 PDT
jesup, I assume your recent patch fixed this, right?
Comment 3 Boris Zbarsky [:bz] 2011-07-15 16:35:18 PDT
Er, and ccing rjesup.  See comment 2.
Comment 4 Randell Jesup [:jesup] 2011-07-17 22:05:04 PDT
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.

*** This bug has been marked as a duplicate of bug 622981 ***

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