diff --git a/components/script/dom/htmldocument.rs b/components/script/dom/htmldocument.rs new file mode 100644 index 00000000000..91f112d19c3 --- /dev/null +++ b/components/script/dom/htmldocument.rs @@ -0,0 +1,36 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +use dom_struct::dom_struct; +use script_bindings::codegen::GenericBindings::DocumentBinding::DocumentMethods; +use script_bindings::codegen::GenericBindings::HTMLDocumentBinding::HTMLDocumentMethods; +use script_bindings::root::DomRoot; +use script_bindings::script_runtime::CanGc; +use script_bindings::str::DOMString; + +use super::types::{Document, Location}; +use crate::dom::bindings::codegen::Bindings::DocumentBinding::NamedPropertyValue; + +/// +#[dom_struct] +pub(crate) struct HTMLDocument { + document: Document, +} + +impl HTMLDocumentMethods for HTMLDocument { + /// + fn GetLocation(&self) -> Option> { + self.document.GetLocation() + } + + /// + fn SupportedPropertyNames(&self) -> Vec { + self.document.SupportedPropertyNames() + } + + /// + fn NamedGetter(&self, name: DOMString) -> Option { + self.document.NamedGetter(name, CanGc::note()) + } +} diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index b98cb689b11..57e16ad4941 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -362,6 +362,7 @@ pub(crate) mod htmldialogelement; pub(crate) mod htmldirectoryelement; pub(crate) mod htmldivelement; pub(crate) mod htmldlistelement; +pub(crate) mod htmldocument; pub(crate) mod htmlelement; pub(crate) mod htmlembedelement; pub(crate) mod htmlfieldsetelement; diff --git a/components/script_bindings/webidls/HTMLDocument.webidl b/components/script_bindings/webidls/HTMLDocument.webidl new file mode 100644 index 00000000000..df9b699be39 --- /dev/null +++ b/components/script_bindings/webidls/HTMLDocument.webidl @@ -0,0 +1,13 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +// https://html.spec.whatwg.org/multipage/#htmldocument + +[LegacyOverrideBuiltIns, + Exposed=Window] +interface HTMLDocument : Document { + // DOM tree accessors + getter NamedPropertyValue (DOMString name); +}; diff --git a/tests/wpt/meta/html/editing/dnd/historical.html.ini b/tests/wpt/meta/html/editing/dnd/historical.html.ini deleted file mode 100644 index 79d9a3db08e..00000000000 --- a/tests/wpt/meta/html/editing/dnd/historical.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[historical.html] - [ondragexit must not be present on the GlobalEventHandlers locations] - expected: FAIL diff --git a/tests/wpt/meta/html/semantics/interactive-elements/contextmenu-historical.html.ini b/tests/wpt/meta/html/semantics/interactive-elements/contextmenu-historical.html.ini deleted file mode 100644 index f3254dc9984..00000000000 --- a/tests/wpt/meta/html/semantics/interactive-elements/contextmenu-historical.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[contextmenu-historical.html] - [onshow must not be present on the GlobalEventHandlers locations] - expected: FAIL diff --git a/tests/wpt/meta/webidl/ecmascript-binding/interface-prototype-constructor-set-receiver.html.ini b/tests/wpt/meta/webidl/ecmascript-binding/interface-prototype-constructor-set-receiver.html.ini deleted file mode 100644 index a8812c9bd59..00000000000 --- a/tests/wpt/meta/webidl/ecmascript-binding/interface-prototype-constructor-set-receiver.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[interface-prototype-constructor-set-receiver.html] - [Direct [[Set\]\] preserves [[Enumerable\]\]: false property attribute] - expected: FAIL diff --git a/tests/wpt/meta/webidl/ecmascript-binding/invalid-this-value-cross-realm.html.ini b/tests/wpt/meta/webidl/ecmascript-binding/invalid-this-value-cross-realm.html.ini deleted file mode 100644 index 534f7d25950..00000000000 --- a/tests/wpt/meta/webidl/ecmascript-binding/invalid-this-value-cross-realm.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[invalid-this-value-cross-realm.html] - [Cross-realm operation throws when called on incompatible object] - expected: FAIL diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 014d6baa7d9..5fdfde6973e 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -13725,7 +13725,7 @@ ] ], "interfaces.https.html": [ - "efb780c382456b1fda514b33fe5b317c447fa09e", + "05ead2c3e2c362586506be77c8093c8bc4f0fb53", [ null, {} diff --git a/tests/wpt/mozilla/tests/mozilla/interfaces.https.html b/tests/wpt/mozilla/tests/mozilla/interfaces.https.html index efb780c3824..05ead2c3e2c 100644 --- a/tests/wpt/mozilla/tests/mozilla/interfaces.https.html +++ b/tests/wpt/mozilla/tests/mozilla/interfaces.https.html @@ -164,6 +164,7 @@ test_interfaces([ "HTMLDirectoryElement", "HTMLDivElement", "HTMLDListElement", + "HTMLDocument", "HTMLElement", "HTMLEmbedElement", "HTMLFieldSetElement",