Closed Bug 1361975 Opened 7 years ago Closed 7 years ago

window.location is not nullable (but is null in Gecko when the browsing context is discarded)

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: annevk, Assigned: baku)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch location.patch (obsolete) — Splinter Review
Assignee: nobody → amarchesini
Attachment #8864458 - Flags: review?(bzbarsky)
Comment on attachment 8864458 [details] [diff] [review]
location.patch

Won't this just crash if the first .location get happens after GetDocShell starts returning null?

What we should probably do is just have the "location" getter pass a null docshell to the Location constructor...

>+    mLocation->SetDocShell(nullptr);

Why is this needed, both places?

Seems to me like we should instead just remove Location::SetDocShell altogether.  It's dead code before this patch.
Attachment #8864458 - Flags: review?(bzbarsky) → review-
Attached patch location.patchSplinter Review
Attachment #8864458 - Attachment is obsolete: true
Attachment #8864813 - Flags: review?(bzbarsky)
Comment on attachment 8864813 [details] [diff] [review]
location.patch

> Location::GetURI(nsIURI** aURI, bool aGetInnermostURI)

So the behavior change here is to start returning NS_OK instead of an error result if Location has no docshell.  Why is that a desirable behavior change?  Might be good to explain that in the commit message.  Yes, the commit message says the change is being made, but not why.

My main problem with it is that it creates a thing that looks like an XPCOM getter but can in fact return null and NS_OK.  This needs to at least be clearly documented in the header, for both GetURI and GetWritableURI.  I did check that all callers are OK with it...
Attachment #8864813 - Flags: review?(bzbarsky) → review+
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/79890abc6ff5
window.location is not nullable, r=bz
https://hg.mozilla.org/integration/mozilla-inbound/rev/48282ae47cf7
Fixing tests in order to support window.location not nullable, r=me
Pushed by archaeopteryx@coole-files.de:
https://hg.mozilla.org/integration/mozilla-inbound/rev/dc4b235f7946
Fixing tests in order to support window.location not nullable: fix eslint complaint. r=eslint-fix
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: