location.assign and location.replace ignore the document base URI and use the document URI as the base instead

RESOLVED FIXED in Firefox 48

Status

()

defect
RESOLVED FIXED
6 years ago
4 months ago

People

(Reporter: mike, Assigned: farre, Mentored)

Tracking

Trunk
mozilla48
Points:
---

Firefox Tracking Flags

(firefox48 fixed)

Details

(Whiteboard: [lang=c++][tw-dom], )

Attachments

(1 attachment)

See the test case at http://www.hixie.ch/tests/adhoc/html/navigation/javascript-url/001.html

Hixie says per spec the expected result is that the iframe ends up showing the text "inner base used for resolution", which is the result that Chrome and Safari give. But in Firefox the result is "inner address used for resolution".

* The source of 001.html has this:

<base href="http://www.hixie.ch/tests/adhoc/html/navigation/javascript-url/outer-base/">
<body onload="frames[0].location = 'javascript:location.assign(&quot;test.txt&quot;)'">
<iframe src="http://www.hixie.ch/tests/adhoc/html/navigation/javascript-url/inner-address/inner.html"></iframe>

* The source of http://www.hixie.ch/tests/adhoc/html/navigation/javascript-url/inner-address/inner.html has this:

<base href="http://www.hixie.ch/tests/adhoc/html/navigation/javascript-url/inner-base/">
<p>Fail

* The contents of http://www.hixie.ch/tests/adhoc/html/navigation/javascript-url/inner-address/test.txt are "inner address used for resolution".

* The contents of http://www.hixie.ch/tests/adhoc/html/navigation/javascript-url/inner-base/test.txt are "inner base used for resolution".
Look like assign() and replace() both use the location URI as the base.  Compare the href setter, which does something quite different.

I don't know why the difference is there, exactly, but it seems fishy.

The javascript: bit is a total red herring in this case; it's a pure Location issue.
Summary: resolving URL in some_iframe.location = javascript:location.assign("foo.txt") ignores iframe doc's base element → location.assign and location.replace ignore the document base URI and use the document URI as the base instead
Whiteboard: [mentor=bz][lang=c++]
I would like to give this bug a try, can someone assign me to it?
Assignee: nobody → badescunicu
I am very sorry, I can't finish this bug in a decent amount of time. Maybe someone can resolve it faster, so I have removed myself from the assignee list.
Assignee: badescunicu → nobody
Mentor: bzbarsky
Whiteboard: [mentor=bz][lang=c++] → [lang=c++]
Boris do you have any tips on how should I start with this bug?
I would like to work on this bug. I have built the mozilla-central source. Can anyone assign this to me please ?
Thanks for looking at this. Let us know if you encounter any problems.
Assignee: nobody → jacksonisaac2008
Are you still working on this, Jackson?
Flags: needinfo?(jacksonisaac2008)
@jdm

Sorry, was busy with academics. I am building mozilla again, so maybe you can assign it to nobody so that someone else can work on it. If no one takes it I will give it a try after my build is done.
Flags: needinfo?(jacksonisaac2008)
Assignee: jacksonisaac2008 → nobody
Whiteboard: [lang=c++] → [lang=c++][tw-dom]
Assignee: nobody → afarre
Location.replace actually already does this. It's only assign that's not doing it.
Comment on attachment 8741398 [details]
MozReview Request: Bug 949413 - Set href with context in Location.assign r?bz

https://reviewboard.mozilla.org/r/46459/#review43007

The tests here should be web platform tests, not mochitests.  r=me with that.
Attachment #8741398 - Flags: review?(bzbarsky) → review+
Comment on attachment 8741398 [details]
MozReview Request: Bug 949413 - Set href with context in Location.assign r?bz

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/46459/diff/1-2/
Pushed it to a new review, how do I close the old one?
Oh, it didn't create a new review, it updated the old one. I'm starting to really like mozreview :)
Note that mozreview decides to carry over an r+ by default, so if you want me to look at the patch you should probably let me know (e.g. by requesting review directly in bugzilla)...
Right. I had to re-write the test case when I moved it over to web-platform so I guess if you could just check that I didn't mess it up I'd be glad. Is there a process for requesting reviews in bugzilla or do I just do it in the comments?
You click the "Details" link on the attachment, and in the resulting view under "Flags" change the "review" combobox to "?" and put in who you're requesting review from.
Attachment #8741398 - Flags: review+ → review?(bzbarsky)
Comment on attachment 8741398 [details]
MozReview Request: Bug 949413 - Set href with context in Location.assign r?bz

https://reviewboard.mozilla.org/r/46459/#review43377

r=me
Attachment #8741398 - Flags: review?(bzbarsky) → review+
Keywords: checkin-needed
Keywords: checkin-needed
Comment on attachment 8741398 [details]
MozReview Request: Bug 949413 - Set href with context in Location.assign r?bz

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/46459/diff/2-3/
Keywords: checkin-needed
Instead of the "expected: PASS" thing, you should just remove the relevant entry from the .ini file.
Keywords: checkin-needed
Comment on attachment 8741398 [details]
MozReview Request: Bug 949413 - Set href with context in Location.assign r?bz

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/46459/diff/3-4/
Thanks, fixed that!
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/e3a467fdf81a
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.