Closed Bug 677851 Opened 13 years ago Closed 13 years ago

Setting location.hash with javascript when loaded URL ends with empty hash location produces error

Categories

(Core :: DOM: Core & HTML, defect)

x86_64
macOS
defect
Not set
normal

Tracking

()

VERIFIED WONTFIX

People

(Reporter: brandon.lebedev, Unassigned)

Details

(Whiteboard: DUPEME)

*This bug report considers an issue similar to those documented in bug reports 450236, 323612, and 398722.

If Firefox loads a page ending with an empty hash tag, eg. (test.html#), and then a javascript executes the function [location.hash = "foo"], firefox loads an invalid URL [test.htmfool#].

Reproducible: Always

Steps to Reproduce:
1. Save this into an html file:
    <html>
    <body>
    <button onclick="window.location.hash = 'foo'">Click Here</button>
    </body>
    </html>

2. Open the file in Firefox
3. Append a hash mark to the URL in the navigation bar ( now [test.html#]) and press Enter/Return to reload the page
4. Press "Click Here" button to execute javascript.

Expected Results
URL should be updated to [test.html#foo]

Actual Results
Firefox loads new page [test.htmfool#]

I have tested this issue on Firefox versions 3.6 and 5.0.1 running on OS X.  The problem occurs consistently.  I suspect the issue occurs across all OSes because of the other bug reports.

Why this should be corrected:
*An empty hash tag, e.g. [test.html#] is a valid hash location often used to reset a scrollbar to the top of a webpage.

*M Laplante's comment on 2008-09-18 11:57:33 PDT in Bug Report 323612 (see "Actual Results), notes a similar behavior where Firefox removes the last letter of the URL, thought in this report, Firefox shifts the last letter of the URL after the hash title and before the has mark.
Component: General → DOM
Product: Firefox → Core
QA Contact: general → general
This worksforme on trunk; I bet jesup's changes fixed this.
Whiteboard: DUPEME
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
I cannot replicate the issue two days later under the same testing environment (OS X 10.5.8; Firefox 3.6.16 and 5.0.1)  No updates have been applied on this computer, except for a Flash upgrade to 10.3.183.5.
Resolution: DUPLICATE → WORKSFORME
I just had the same error occur that I reported originally.  It repeated consistently, so I tired to build a new test file, but by the time I had a new test file prepared, the bug stopped happening.  I can't isolate the issue.
Status: RESOLVED → VERIFIED
Resolution: WORKSFORME → WONTFIX
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.