From 60976406cc6ddf99b3d3a512dce0b4fd01b686f1 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Mon, 12 Oct 2015 14:50:07 +0200 Subject: Implement [Unforgeable] This is mostly stolen from Gecko. As there, we define the unforgeable members on an object stored in the slots of the prototype object. They are then copied onto instance objects when they are instantiated. It should be noted that proxy objects see their unforgeable memebers defined on their expando object. Unforgeable attributes aren't properly inherited in codegen (in a similar fashion as getters and setters as filed in #5875) and require to be redefined in derived interfaces. Fortunately, there are currently no such interfaces. No unforgeable members can be included into the TestBinding interfaces for good measure because they are not compatible with setters. Given the unforgeable holder object has the same prototype as actual instances of the interface, the finalize hook needs to check its slot pointer for nullity before dropping it. The new failing test isn't related to Unforgeable attributes, but to the fact that all Document instances currently have a Location, even if their window isn't in a browsing context. --- components/script/dom/xmldocument.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'components/script/dom/xmldocument.rs') diff --git a/components/script/dom/xmldocument.rs b/components/script/dom/xmldocument.rs index 0553760ca6c..6f73ecbf8ea 100644 --- a/components/script/dom/xmldocument.rs +++ b/components/script/dom/xmldocument.rs @@ -12,6 +12,7 @@ use dom::bindings::inheritance::Castable; use dom::bindings::js::{Root, RootedReference}; use dom::bindings::reflector::{Reflectable, reflect_dom_object}; use dom::document::{Document, DocumentSource, IsHTMLDocument}; +use dom::location::Location; use dom::node::Node; use dom::window::Window; use js::jsapi::{JSContext, JSObject}; @@ -85,6 +86,11 @@ impl XMLDocument { } impl XMLDocumentMethods for XMLDocument { + // https://html.spec.whatwg.org/multipage/#dom-document-location + fn Location(&self) -> Root { + self.document.Location() + } + // https://html.spec.whatwg.org/multipage/#dom-tree-accessors:supported-property-names fn SupportedPropertyNames(&self) -> Vec { self.document.SupportedPropertyNames() -- cgit v1.2.3