Closed Bug 465804 Opened 17 years ago Closed 16 years ago

[FIX]Remove nsLocation::FindUsableURI

Categories

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

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(2 files)

See bug 445004 for why it's no longer needed.
Well, I have a patch. It fails one mochitest, which sets location to javascript: on an about:blank iframe and then uses a relative URI in that javascript: document. I'll do some testing regarding what other UAs do in that sort of situation, both with subframes and with window.open.
Attached file Small testcase
To test, unzip and load the outer test.html. This tests the following things: 1) Setting location.href of an about:blank iframe to a javascript: URI that then sets window.location to a relative URI. 2) Appending a script that sets window.location to a relative URI to an about:blank iframe. 3) Adding a relative-URI image via innerHTML to an about:blank iframe 4) Adding a relative-URI image via new Image() to an about:blank iframe 5) Adding a relative-URI image via innerHTML to a document in a different dir 6) Adding a relative-URI image via new Image() to a document in a different dir 7) Setting location.href on a newly-opened window to a javascript URI that sets location to a relative URI. 8) Setting location.href on an opened window with a document in a different dir to a javascript URI that sets location to a relative URI. Behavior in various UAs: IE 7: 1) Resolves relative URI relative to iframe's parent(?) 2) Throws an exception trying to construct the script 3,4) Resolves relative URI relative to iframe's parent(?) 5,6) Resolves relative URI relative to document the image is in 7) Resolves relative URI relative to opener(?) 8) Resolves relative URI relative to the document in the window the javascript: is running in. Opera 9.6: 1) Resolves relative URI relative to about:blank 2) Resolves relative URI relative to about:blank 3,4) Resolves relative URI relative to about:blank 5,6) Resolves relative URI relative to document the image is in 7) Resolves relative URI relative to opener(?) 8) Resolves relative URI relative to the document in the window the javascript: is running in. Safari 3.1.2: Exactly like Opera 9.6 Webkit trunk: As Safari 3.1.2, except for: 7) Resolves relative URI relative to about:blank (or just doesn't load it?) Gecko trunk: 1,2,5,6) As IE 3,4) As Opera 7) As webkit trunk 8) As everyone In Gecko, reason 1 and 2 work as IE (whereas 3,4,7 do not) is precisely because of FindUsableURI, which only walks frames and only works for location sets. I haven't tested how <base href> affects this, but it would be awfully nice if someone would! IE's behavior is most easily explained by assuming that its about:blank has a base URI that depends on where it was loaded from (just like javascript: works in Gecko now). I'm somewhat tempted to do that in Gecko too, and still remove FindUsableURI. Thoughts?
Depends on: 482659
Attached patch Proposed fixSplinter Review
Passes tests and all.
Attachment #369030 - Flags: superreview?(jst)
Attachment #369030 - Flags: review?(jst)
Attachment #369030 - Flags: superreview?(jst)
Attachment #369030 - Flags: superreview+
Attachment #369030 - Flags: review?(jst)
Attachment #369030 - Flags: review+
Comment on attachment 369030 [details] [diff] [review] Proposed fix Makes sense. And giving about:blank base URI's like our javascript: URIs have sounds good to me.
Yeah. I did that already. ;) That's why this no longer fails tests. Pushed http://hg.mozilla.org/mozilla-central/rev/c186c49f2259
Status: NEW → RESOLVED
Closed: 16 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: