Closed
Bug 1298977
Opened 9 years ago
Closed 9 years ago
NS_ERROR_FAILURE when changing location.hash for iframe with srcdoc
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla51
| Tracking | Status | |
|---|---|---|
| firefox51 | --- | fixed |
People
(Reporter: rdvornov, Assigned: bzbarsky)
Details
Attachments
(1 file)
|
4.59 KB,
patch
|
bkelly
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36
Steps to reproduce:
1. Create a iframe with srcdoc
2. Change iframe's location.hash on document load
Example:
<iframe srcdoc="<html></html>" onload="
this.contentWindow.location.hash = 'test';
"></iframe>
Actual results:
location.hash doesn't change but NS_ERROR_FAILURE exception occurs
Expected results:
location.hash should be changed with no exception.
Setting hash via location.href works as expected, i.e.
<iframe srcdoc="<html></html>" onload="
this.contentWindow.location.href += '#test';
"></iframe>
| Assignee | ||
Comment 1•9 years ago
|
||
Thank you for filing this.
So per spec, we start off at https://html.spec.whatwg.org/multipage/browsers.html#dom-location-hash and end up calling https://html.spec.whatwg.org/multipage/browsers.html#location-object-setter-navigate with "about:srcdoc#test" as the url. That lands at https://html.spec.whatwg.org/multipage/browsers.html#location-object-navigate which calls into https://html.spec.whatwg.org/multipage/browsers.html#navigate with the exceptions enabled flag set. We should get to step 6, do an anchor scroll and stop. No exception should be thrown.
The problem is that in nsLocation::SetHash we have an immutable uri, because all about: URIs flag themselves as immutable (see nsAboutProtocolHandler::NewURI). So the SetRef call we make there fails. We should be using CloneWithNewRef instead.
| Assignee | ||
Updated•9 years ago
|
Status: UNCONFIRMED → NEW
Component: Untriaged → DOM
Ever confirmed: true
Product: Firefox → Core
| Assignee | ||
Comment 2•9 years ago
|
||
Attachment #8786228 -
Flags: review?(bkelly)
| Assignee | ||
Updated•9 years ago
|
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Comment 3•9 years ago
|
||
Comment on attachment 8786228 [details] [diff] [review]
Fix setting location.hash for documents with about:something URIs to actually work
Review of attachment 8786228 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good. Thanks for linking the relevant spec text.
Attachment #8786228 -
Flags: review?(bkelly) → review+
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/0a4166cfb914
Fix setting location.hash for documents with about:something URIs to actually work. r=bkelly
Comment 5•9 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox51:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•