issue #10141 : Document::location set null for documents without a browsing context. r=Ms2ger

This commit is contained in:
shubham_jain 2016-03-29 11:33:25 +05:30
parent 32e53b80e2
commit 6626c5cfd4
9 changed files with 6 additions and 27 deletions

View file

@ -2423,8 +2423,8 @@ impl DocumentMethods for Document {
}
// https://html.spec.whatwg.org/multipage/#dom-document-location
fn Location(&self) -> Root<Location> {
self.location.or_init(|| Location::new(&self.window))
fn GetLocation(&self) -> Option<Root<Location>> {
self.browsing_context().map(|_| self.location.or_init(|| Location::new(&self.window)))
}
// https://dom.spec.whatwg.org/#dom-parentnode-children
@ -2777,4 +2777,3 @@ pub enum FocusEventType {
Focus, // Element gained focus. Doesn't bubble.
Blur, // Element lost focus. Doesn't bubble.
}

View file

@ -81,7 +81,7 @@ enum DocumentReadyState { "loading", "interactive", "complete" };
partial /*sealed*/ interface Document {
// resource metadata management
[/*PutForwards=href, */Unforgeable]
readonly attribute Location/*?*/ location;
readonly attribute Location? location;
readonly attribute DOMString domain;
// readonly attribute DOMString referrer;
[Throws]

View file

@ -441,7 +441,7 @@ impl WindowMethods for Window {
// https://html.spec.whatwg.org/multipage/#dom-location
fn Location(&self) -> Root<Location> {
self.Document().Location()
self.Document().GetLocation().unwrap()
}
// https://html.spec.whatwg.org/multipage/#dom-sessionstorage

View file

@ -76,8 +76,8 @@ impl XMLDocument {
impl XMLDocumentMethods for XMLDocument {
// https://html.spec.whatwg.org/multipage/#dom-document-location
fn Location(&self) -> Root<Location> {
self.document.Location()
fn GetLocation(&self) -> Option<Root<Location>> {
self.document.GetLocation()
}
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:supported-property-names