diff options
19 files changed, 394 insertions, 253 deletions
diff --git a/components/script/dom/location.rs b/components/script/dom/location.rs index 230cf2748da..a9e788a7b04 100644 --- a/components/script/dom/location.rs +++ b/components/script/dom/location.rs @@ -4,7 +4,6 @@ use dom::bindings::codegen::Bindings::LocationBinding; use dom::bindings::codegen::Bindings::LocationBinding::LocationMethods; -use dom::bindings::error::ErrorResult; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JS, Root}; use dom::bindings::str::USVString; @@ -48,11 +47,11 @@ impl Location { impl LocationMethods for Location { // https://html.spec.whatwg.org/multipage/#dom-location-assign - fn Assign(&self, url: DOMString) { + fn Assign(&self, url: USVString) { // TODO: per spec, we should use the _API base URL_ specified by the // _entry settings object_. let base_url = self.window.get_url(); - if let Ok(url) = UrlParser::new().base_url(&base_url).parse(&url) { + if let Ok(url) = UrlParser::new().base_url(&base_url).parse(&url.0) { self.window.load_url(url); } } @@ -62,111 +61,90 @@ impl LocationMethods for Location { self.window.load_url(self.get_url()); } - // https://url.spec.whatwg.org/#dom-urlutils-hash + // https://html.spec.whatwg.org/multipage/#dom-location-hash fn Hash(&self) -> USVString { UrlHelper::Hash(&self.get_url()) } - // https://url.spec.whatwg.org/#dom-urlutils-hash + // https://html.spec.whatwg.org/multipage/#dom-location-hash fn SetHash(&self, value: USVString) { self.set_url_component(value, UrlHelper::SetHash); } - // https://url.spec.whatwg.org/#dom-urlutils-host + // https://html.spec.whatwg.org/multipage/#dom-location-host fn Host(&self) -> USVString { UrlHelper::Host(&self.get_url()) } - // https://url.spec.whatwg.org/#dom-urlutils-host + // https://html.spec.whatwg.org/multipage/#dom-location-host fn SetHost(&self, value: USVString) { self.set_url_component(value, UrlHelper::SetHost); } - // https://url.spec.whatwg.org/#dom-urlutils-hostname + // https://html.spec.whatwg.org/multipage/#dom-location-hostname fn Hostname(&self) -> USVString { UrlHelper::Hostname(&self.get_url()) } - // https://url.spec.whatwg.org/#dom-urlutils-hostname + // https://html.spec.whatwg.org/multipage/#dom-location-hostname fn SetHostname(&self, value: USVString) { self.set_url_component(value, UrlHelper::SetHostname); } - // https://url.spec.whatwg.org/#dom-urlutils-href + // https://html.spec.whatwg.org/multipage/#dom-location-href fn Href(&self) -> USVString { UrlHelper::Href(&self.get_url()) } - // https://url.spec.whatwg.org/#dom-urlutils-href - fn SetHref(&self, value: USVString) -> ErrorResult { + // https://html.spec.whatwg.org/multipage/#dom-location-href + fn SetHref(&self, value: USVString) { if let Ok(url) = UrlParser::new().base_url(&self.window.get_url()).parse(&value.0) { self.window.load_url(url); - }; - Ok(()) - } - - // https://url.spec.whatwg.org/#dom-urlutils-password - fn Password(&self) -> USVString { - UrlHelper::Password(&self.get_url()) - } - - // https://url.spec.whatwg.org/#dom-urlutils-password - fn SetPassword(&self, value: USVString) { - self.set_url_component(value, UrlHelper::SetPassword); + } } - // https://url.spec.whatwg.org/#dom-urlutils-pathname + // https://html.spec.whatwg.org/multipage/#dom-location-pathname fn Pathname(&self) -> USVString { UrlHelper::Pathname(&self.get_url()) } - // https://url.spec.whatwg.org/#dom-urlutils-pathname + // https://html.spec.whatwg.org/multipage/#dom-location-pathname fn SetPathname(&self, value: USVString) { self.set_url_component(value, UrlHelper::SetPathname); } - // https://url.spec.whatwg.org/#dom-urlutils-port + // https://html.spec.whatwg.org/multipage/#dom-location-port fn Port(&self) -> USVString { UrlHelper::Port(&self.get_url()) } - // https://url.spec.whatwg.org/#dom-urlutils-port + // https://html.spec.whatwg.org/multipage/#dom-location-port fn SetPort(&self, value: USVString) { self.set_url_component(value, UrlHelper::SetPort); } - // https://url.spec.whatwg.org/#dom-urlutils-protocol + // https://html.spec.whatwg.org/multipage/#dom-location-protocol fn Protocol(&self) -> USVString { UrlHelper::Protocol(&self.get_url()) } - // https://url.spec.whatwg.org/#dom-urlutils-protocol + // https://html.spec.whatwg.org/multipage/#dom-location-protocol fn SetProtocol(&self, value: USVString) { self.set_url_component(value, UrlHelper::SetProtocol); } - // https://url.spec.whatwg.org/#URLUtils-stringification-behavior + // https://html.spec.whatwg.org/multipage/#dom-location-href fn Stringifier(&self) -> DOMString { self.Href().0 } - // https://url.spec.whatwg.org/#dom-urlutils-search + // https://html.spec.whatwg.org/multipage/#dom-location-search fn Search(&self) -> USVString { UrlHelper::Search(&self.get_url()) } - // https://url.spec.whatwg.org/#dom-urlutils-search + // https://html.spec.whatwg.org/multipage/#dom-location-search fn SetSearch(&self, value: USVString) { self.set_url_component(value, UrlHelper::SetSearch); } - - // https://url.spec.whatwg.org/#dom-urlutils-username - fn Username(&self) -> USVString { - UrlHelper::Username(&self.get_url()) - } - - // https://url.spec.whatwg.org/#dom-urlutils-username - fn SetUsername(&self, value: USVString) { - self.set_url_component(value, UrlHelper::SetUsername); - } } diff --git a/components/script/dom/url.rs b/components/script/dom/url.rs index 4a3bb19a776..9ff22b53597 100644 --- a/components/script/dom/url.rs +++ b/components/script/dom/url.rs @@ -88,42 +88,42 @@ impl URL { } impl URLMethods for URL { - // https://url.spec.whatwg.org/#dom-urlutils-hash + // https://url.spec.whatwg.org/#dom-url-hash fn Hash(&self) -> USVString { UrlHelper::Hash(&self.url.borrow()) } - // https://url.spec.whatwg.org/#dom-urlutils-hash + // https://url.spec.whatwg.org/#dom-url-hash fn SetHash(&self, value: USVString) { UrlHelper::SetHash(&mut self.url.borrow_mut(), value); } - // https://url.spec.whatwg.org/#dom-urlutils-host + // https://url.spec.whatwg.org/#dom-url-host fn Host(&self) -> USVString { UrlHelper::Host(&self.url.borrow()) } - // https://url.spec.whatwg.org/#dom-urlutils-host + // https://url.spec.whatwg.org/#dom-url-host fn SetHost(&self, value: USVString) { UrlHelper::SetHost(&mut self.url.borrow_mut(), value); } - // https://url.spec.whatwg.org/#dom-urlutils-hostname + // https://url.spec.whatwg.org/#dom-url-hostname fn Hostname(&self) -> USVString { UrlHelper::Hostname(&self.url.borrow()) } - // https://url.spec.whatwg.org/#dom-urlutils-hostname + // https://url.spec.whatwg.org/#dom-url-hostname fn SetHostname(&self, value: USVString) { UrlHelper::SetHostname(&mut self.url.borrow_mut(), value); } - // https://url.spec.whatwg.org/#dom-urlutils-href + // https://url.spec.whatwg.org/#dom-url-href fn Href(&self) -> USVString { UrlHelper::Href(&self.url.borrow()) } - // https://url.spec.whatwg.org/#dom-urlutils-href + // https://url.spec.whatwg.org/#dom-url-href fn SetHref(&self, value: USVString) -> ErrorResult { match parse_with_base(value, self.base.as_ref()) { Ok(url) => { @@ -136,67 +136,67 @@ impl URLMethods for URL { } } - // https://url.spec.whatwg.org/#dom-urlutils-password + // https://url.spec.whatwg.org/#dom-url-password fn Password(&self) -> USVString { UrlHelper::Password(&self.url.borrow()) } - // https://url.spec.whatwg.org/#dom-urlutils-password + // https://url.spec.whatwg.org/#dom-url-password fn SetPassword(&self, value: USVString) { UrlHelper::SetPassword(&mut self.url.borrow_mut(), value); } - // https://url.spec.whatwg.org/#dom-urlutils-pathname + // https://url.spec.whatwg.org/#dom-url-pathname fn Pathname(&self) -> USVString { UrlHelper::Pathname(&self.url.borrow()) } - // https://url.spec.whatwg.org/#dom-urlutils-pathname + // https://url.spec.whatwg.org/#dom-url-pathname fn SetPathname(&self, value: USVString) { UrlHelper::SetPathname(&mut self.url.borrow_mut(), value); } - // https://url.spec.whatwg.org/#dom-urlutils-port + // https://url.spec.whatwg.org/#dom-url-port fn Port(&self) -> USVString { UrlHelper::Port(&self.url.borrow()) } - // https://url.spec.whatwg.org/#dom-urlutils-port + // https://url.spec.whatwg.org/#dom-url-port fn SetPort(&self, value: USVString) { UrlHelper::SetPort(&mut self.url.borrow_mut(), value); } - // https://url.spec.whatwg.org/#dom-urlutils-protocol + // https://url.spec.whatwg.org/#dom-url-protocol fn Protocol(&self) -> USVString { UrlHelper::Protocol(&self.url.borrow()) } - // https://url.spec.whatwg.org/#dom-urlutils-protocol + // https://url.spec.whatwg.org/#dom-url-protocol fn SetProtocol(&self, value: USVString) { UrlHelper::SetProtocol(&mut self.url.borrow_mut(), value); } - // https://url.spec.whatwg.org/#dom-urlutils-search + // https://url.spec.whatwg.org/#dom-url-search fn Search(&self) -> USVString { UrlHelper::Search(&self.url.borrow()) } - // https://url.spec.whatwg.org/#dom-urlutils-search + // https://url.spec.whatwg.org/#dom-url-search fn SetSearch(&self, value: USVString) { UrlHelper::SetSearch(&mut self.url.borrow_mut(), value); } - // https://url.spec.whatwg.org/#URLUtils-stringification-behavior + // https://url.spec.whatwg.org/#dom-url-href fn Stringifier(&self) -> DOMString { self.Href().0 } - // https://url.spec.whatwg.org/#dom-urlutils-username + // https://url.spec.whatwg.org/#dom-url-username fn Username(&self) -> USVString { UrlHelper::Username(&self.url.borrow()) } - // https://url.spec.whatwg.org/#dom-urlutils-username + // https://url.spec.whatwg.org/#dom-url-username fn SetUsername(&self, value: USVString) { UrlHelper::SetUsername(&mut self.url.borrow_mut(), value); } diff --git a/components/script/dom/urlhelper.rs b/components/script/dom/urlhelper.rs index 8d6916c0551..d9e26e84263 100644 --- a/components/script/dom/urlhelper.rs +++ b/components/script/dom/urlhelper.rs @@ -12,7 +12,6 @@ use url::{SchemeData, Url, UrlParser}; pub struct UrlHelper; impl UrlHelper { - // https://url.spec.whatwg.org/#dom-urlutils-hash pub fn Hash(url: &Url) -> USVString { USVString(match url.fragment { None => "".to_owned(), @@ -21,13 +20,11 @@ impl UrlHelper { }) } - // https://url.spec.whatwg.org/#dom-urlutils-hash pub fn SetHash(url: &mut Url, value: USVString) { let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() }; let _ = wrapper.set_fragment(&value.0); } - // https://url.spec.whatwg.org/#dom-urlutils-host pub fn Host(url: &Url) -> USVString { USVString(match url.scheme_data { SchemeData::NonRelative(..) => "".to_owned(), @@ -41,40 +38,33 @@ impl UrlHelper { }) } - // https://url.spec.whatwg.org/#dom-urlutils-host pub fn SetHost(url: &mut Url, value: USVString) { let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() }; let _ = wrapper.set_host(&value.0); } - // https://url.spec.whatwg.org/#dom-urlutils-hostname pub fn Hostname(url: &Url) -> USVString { USVString(url.serialize_host().unwrap_or_else(|| "".to_owned())) } - // https://url.spec.whatwg.org/#dom-urlutils-hostname pub fn SetHostname(url: &mut Url, value: USVString) { let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() }; let _ = wrapper.set_host_and_port(&value.0); } - // https://url.spec.whatwg.org/#dom-urlutils-href pub fn Href(url: &Url) -> USVString { USVString(url.serialize()) } - // https://url.spec.whatwg.org/#dom-urlutils-password pub fn Password(url: &Url) -> USVString { USVString(url.password().unwrap_or("").to_owned()) } - // https://url.spec.whatwg.org/#dom-urlutils-password pub fn SetPassword(url: &mut Url, value: USVString) { let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() }; let _ = wrapper.set_password(&value.0); } - // https://url.spec.whatwg.org/#dom-urlutils-pathname pub fn Pathname(url: &Url) -> USVString { USVString(match url.scheme_data { SchemeData::NonRelative(ref scheme_data) => scheme_data.clone(), @@ -82,13 +72,11 @@ impl UrlHelper { }) } - // https://url.spec.whatwg.org/#dom-urlutils-pathname pub fn SetPathname(url: &mut Url, value: USVString) { let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() }; let _ = wrapper.set_path(&value.0); } - // https://url.spec.whatwg.org/#dom-urlutils-port pub fn Port(url: &Url) -> USVString { USVString(match url.port() { None => "".to_owned(), @@ -96,18 +84,15 @@ impl UrlHelper { }) } - // https://url.spec.whatwg.org/#dom-urlutils-port pub fn SetPort(url: &mut Url, value: USVString) { let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() }; let _ = wrapper.set_port(&value.0); } - // https://url.spec.whatwg.org/#dom-urlutils-protocol pub fn Protocol(url: &Url) -> USVString { USVString(format!("{}:", url.scheme.clone())) } - // https://url.spec.whatwg.org/#dom-urlutils-protocol pub fn SetProtocol(url: &mut Url, value: USVString) { let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() }; let _ = wrapper.set_scheme(&value.0); @@ -127,7 +112,6 @@ impl UrlHelper { true } - // https://url.spec.whatwg.org/#dom-urlutils-search pub fn Search(url: &Url) -> USVString { USVString(match url.query { None => "".to_owned(), @@ -136,18 +120,15 @@ impl UrlHelper { }) } - // https://url.spec.whatwg.org/#dom-urlutils-search pub fn SetSearch(url: &mut Url, value: USVString) { let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() }; let _ = wrapper.set_query(&value.0); } - // https://url.spec.whatwg.org/#dom-urlutils-username pub fn Username(url: &Url) -> USVString { USVString(url.username().unwrap_or("").to_owned()) } - // https://url.spec.whatwg.org/#dom-urlutils-username pub fn SetUsername(url: &mut Url, value: USVString) { let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() }; let _ = wrapper.set_username(&value.0); diff --git a/components/script/dom/webidls/HTMLAnchorElement.webidl b/components/script/dom/webidls/HTMLAnchorElement.webidl index f21e3dc6af7..6585e1ccc56 100644 --- a/components/script/dom/webidls/HTMLAnchorElement.webidl +++ b/components/script/dom/webidls/HTMLAnchorElement.webidl @@ -26,7 +26,7 @@ interface HTMLAnchorElement : HTMLElement { // also has obsolete members }; -//HTMLAnchorElement implements URLUtils; +//HTMLAnchorElement implements HTMLHyperlinkElementUtils; // https://html.spec.whatwg.org/multipage/#HTMLAnchorElement-partial partial interface HTMLAnchorElement { diff --git a/components/script/dom/webidls/HTMLAreaElement.webidl b/components/script/dom/webidls/HTMLAreaElement.webidl index 860e9af008a..a6568bd0b6b 100644 --- a/components/script/dom/webidls/HTMLAreaElement.webidl +++ b/components/script/dom/webidls/HTMLAreaElement.webidl @@ -13,12 +13,9 @@ interface HTMLAreaElement : HTMLElement { //[PutForwards=value] attribute DOMSettableTokenList ping; // attribute DOMString rel; readonly attribute DOMTokenList relList; - // attribute DOMString hreflang; - // attribute DOMString type; - - // also has obsolete members + // hreflang and type are not reflected }; -//HTMLAreaElement implements URLUtils; +//HTMLAreaElement implements HTMLHyperlinkElementUtils; // https://html.spec.whatwg.org/multipage/#HTMLAreaElement-partial partial interface HTMLAreaElement { diff --git a/components/script/dom/webidls/HTMLHyperlinkElementUtils.webidl b/components/script/dom/webidls/HTMLHyperlinkElementUtils.webidl new file mode 100644 index 00000000000..c8d7a35493d --- /dev/null +++ b/components/script/dom/webidls/HTMLHyperlinkElementUtils.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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/#htmlhyperlinkelementutils +//[NoInterfaceObject/*, Exposed=Window*/] +//interface HTMLHyperlinkElementUtils { +// stringifier attribute USVString href; +// attribute USVString origin; +// attribute USVString protocol; +// attribute USVString username; +// attribute USVString password; +// attribute USVString host; +// attribute USVString hostname; +// attribute USVString port; +// attribute USVString pathname; +// attribute USVString search; +// attribute USVString hash; +//}; diff --git a/components/script/dom/webidls/Location.webidl b/components/script/dom/webidls/Location.webidl index 70b496b00ec..f82031ac74b 100644 --- a/components/script/dom/webidls/Location.webidl +++ b/components/script/dom/webidls/Location.webidl @@ -5,8 +5,24 @@ // https://html.spec.whatwg.org/multipage/#location /*[Unforgeable]*/ interface Location { - void assign(DOMString url); - //void replace(DOMString url); + /*stringifier*/ attribute USVString href; + // attribute USVString origin; + attribute USVString protocol; + attribute USVString host; + attribute USVString hostname; + attribute USVString port; + attribute USVString pathname; + attribute USVString search; + attribute USVString hash; + + void assign(USVString url); + //void replace(USVString url); void reload(); + + //[SameObject] readonly attribute USVString[] ancestorOrigins; + + // This is only doing as well as gecko right now. + // https://github.com/servo/servo/issues/7590 is on file for + // adding attribute stringifier support. + stringifier; }; -Location implements URLUtils; diff --git a/components/script/dom/webidls/URL.webidl b/components/script/dom/webidls/URL.webidl index 2e03ea9b858..57ae34a3eba 100644 --- a/components/script/dom/webidls/URL.webidl +++ b/components/script/dom/webidls/URL.webidl @@ -8,5 +8,23 @@ interface URL { static USVString domainToASCII(USVString domain); // static USVString domainToUnicode(USVString domain); + + [SetterThrows] + /*stringifier*/ attribute USVString href; + // readonly attribute USVString origin; + attribute USVString protocol; + attribute USVString username; + attribute USVString password; + attribute USVString host; + attribute USVString hostname; + attribute USVString port; + attribute USVString pathname; + attribute USVString search; + // readonly attribute URLSearchParams searchParams; + attribute USVString hash; + + // This is only doing as well as gecko right now. + // https://github.com/servo/servo/issues/7590 is on file for + // adding attribute stringifier support. + stringifier; }; -URL implements URLUtils; diff --git a/components/script/dom/webidls/URLSearchParams.webidl b/components/script/dom/webidls/URLSearchParams.webidl index 1afdc30a352..4ab1cd43019 100644 --- a/components/script/dom/webidls/URLSearchParams.webidl +++ b/components/script/dom/webidls/URLSearchParams.webidl @@ -7,7 +7,7 @@ * https://url.spec.whatwg.org/#interface-urlsearchparams */ -[Constructor(optional (DOMString or URLSearchParams) init)] +[Constructor(optional (DOMString or URLSearchParams) init/* = ""*/)] interface URLSearchParams { void append(DOMString name, DOMString value); void delete(DOMString name); @@ -15,5 +15,7 @@ interface URLSearchParams { // sequence<DOMString> getAll(DOMString name); boolean has(DOMString name); void set(DOMString name, DOMString value); + // iterable<USVString, USVString>; stringifier; }; + diff --git a/components/script/dom/webidls/URLUtils.webidl b/components/script/dom/webidls/URLUtils.webidl deleted file mode 100644 index bb32fb82e5e..00000000000 --- a/components/script/dom/webidls/URLUtils.webidl +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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://url.spec.whatwg.org/#urlutils -[NoInterfaceObject] -interface URLUtils { - //stringifier attribute USVString href; - [SetterThrows] - attribute USVString href; - //readonly attribute USVString origin; - attribute USVString protocol; - attribute USVString username; - attribute USVString password; - attribute USVString host; - attribute USVString hostname; - attribute USVString port; - attribute USVString pathname; - attribute USVString search; - // attribute URLSearchParams searchParams; - attribute USVString hash; - - // This is only doing as well as gecko right now. - // https://github.com/servo/servo/issues/7590 is on file for - // adding attribute stringifier support. - stringifier; -}; diff --git a/components/script/dom/webidls/URLUtilsReadOnly.webidl b/components/script/dom/webidls/URLUtilsReadOnly.webidl deleted file mode 100644 index a919986bbbe..00000000000 --- a/components/script/dom/webidls/URLUtilsReadOnly.webidl +++ /dev/null @@ -1,26 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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://url.spec.whatwg.org/#urlutilsreadonly -[NoInterfaceObject/*, - Exposed=(Window,Worker)*/] -interface URLUtilsReadOnly { - //stringifier readonly attribute USVString href; - readonly attribute USVString href; - //readonly attribute USVString origin; - - readonly attribute USVString protocol; - readonly attribute USVString host; - readonly attribute USVString hostname; - readonly attribute USVString port; - readonly attribute USVString pathname; - readonly attribute USVString search; - readonly attribute USVString hash; - - // This is only doing as well as gecko right now. - // https://github.com/servo/servo/issues/7590 is on file for - // adding attribute stringifier support. - stringifier; -}; diff --git a/components/script/dom/webidls/WorkerLocation.webidl b/components/script/dom/webidls/WorkerLocation.webidl index 7d624118271..598e210de44 100644 --- a/components/script/dom/webidls/WorkerLocation.webidl +++ b/components/script/dom/webidls/WorkerLocation.webidl @@ -5,5 +5,19 @@ // https://html.spec.whatwg.org/multipage/#worker-locations //[Exposed=Worker] -interface WorkerLocation { }; -WorkerLocation implements URLUtilsReadOnly; +interface WorkerLocation { + /*stringifier*/ readonly attribute USVString href; + // readonly attribute USVString origin; + readonly attribute USVString protocol; + readonly attribute USVString host; + readonly attribute USVString hostname; + readonly attribute USVString port; + readonly attribute USVString pathname; + readonly attribute USVString search; + readonly attribute USVString hash; + + // This is only doing as well as gecko right now. + // https://github.com/servo/servo/issues/7590 is on file for + // adding attribute stringifier support. + stringifier; +}; diff --git a/components/script/dom/workerlocation.rs b/components/script/dom/workerlocation.rs index 467d2fef7ee..477c329cf75 100644 --- a/components/script/dom/workerlocation.rs +++ b/components/script/dom/workerlocation.rs @@ -36,47 +36,47 @@ impl WorkerLocation { } impl WorkerLocationMethods for WorkerLocation { - // https://url.spec.whatwg.org/#dom-urlutils-hash + // https://html.spec.whatwg.org/multipage/#dom-workerlocation-hash fn Hash(&self) -> USVString { UrlHelper::Hash(&self.url) } - // https://url.spec.whatwg.org/#dom-urlutils-host + // https://html.spec.whatwg.org/multipage/#dom-workerlocation-host fn Host(&self) -> USVString { UrlHelper::Host(&self.url) } - // https://url.spec.whatwg.org/#dom-urlutils-hostname + // https://html.spec.whatwg.org/multipage/#dom-workerlocation-hostname fn Hostname(&self) -> USVString { UrlHelper::Hostname(&self.url) } - // https://url.spec.whatwg.org/#dom-urlutils-href + // https://html.spec.whatwg.org/multipage/#dom-workerlocation-href fn Href(&self) -> USVString { UrlHelper::Href(&self.url) } - // https://url.spec.whatwg.org/#dom-urlutils-pathname + // https://html.spec.whatwg.org/multipage/#dom-workerlocation-pathname fn Pathname(&self) -> USVString { UrlHelper::Pathname(&self.url) } - // https://url.spec.whatwg.org/#dom-urlutils-port + // https://html.spec.whatwg.org/multipage/#dom-workerlocation-port fn Port(&self) -> USVString { UrlHelper::Port(&self.url) } - // https://url.spec.whatwg.org/#dom-urlutils-protocol + // https://html.spec.whatwg.org/multipage/#dom-workerlocation-protocol fn Protocol(&self) -> USVString { UrlHelper::Protocol(&self.url) } - // https://url.spec.whatwg.org/#dom-urlutils-search + // https://html.spec.whatwg.org/multipage/#dom-workerlocation-search fn Search(&self) -> USVString { UrlHelper::Search(&self.url) } - // https://url.spec.whatwg.org/#URLUtils-stringification-behavior + // https://html.spec.whatwg.org/multipage/#dom-workerlocation-href fn Stringifier(&self) -> DOMString { self.Href().0 } diff --git a/tests/wpt/metadata/html/dom/interfaces.html.ini b/tests/wpt/metadata/html/dom/interfaces.html.ini index 8308aad5885..561b37584bd 100644 --- a/tests/wpt/metadata/html/dom/interfaces.html.ini +++ b/tests/wpt/metadata/html/dom/interfaces.html.ini @@ -4395,12 +4395,6 @@ [HTMLAreaElement interface: attribute rel] expected: FAIL - [HTMLAreaElement interface: attribute hreflang] - expected: FAIL - - [HTMLAreaElement interface: attribute type] - expected: FAIL - [HTMLAreaElement interface: attribute noHref] expected: FAIL @@ -4425,12 +4419,6 @@ [HTMLAreaElement interface: document.createElement("area") must inherit property "rel" with the proper type (6)] expected: FAIL - [HTMLAreaElement interface: document.createElement("area") must inherit property "hreflang" with the proper type (8)] - expected: FAIL - - [HTMLAreaElement interface: document.createElement("area") must inherit property "type" with the proper type (9)] - expected: FAIL - [HTMLAreaElement interface: document.createElement("area") must inherit property "noHref" with the proper type (10)] expected: FAIL @@ -9363,3 +9351,177 @@ [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onwaiting" with the proper type (156)] expected: FAIL + [HTMLAnchorElement interface: attribute href] + expected: FAIL + + [HTMLAnchorElement interface: attribute origin] + expected: FAIL + + [HTMLAnchorElement interface: attribute protocol] + expected: FAIL + + [HTMLAnchorElement interface: attribute username] + expected: FAIL + + [HTMLAnchorElement interface: attribute password] + expected: FAIL + + [HTMLAnchorElement interface: attribute host] + expected: FAIL + + [HTMLAnchorElement interface: attribute hostname] + expected: FAIL + + [HTMLAnchorElement interface: attribute port] + expected: FAIL + + [HTMLAnchorElement interface: attribute pathname] + expected: FAIL + + [HTMLAnchorElement interface: attribute search] + expected: FAIL + + [HTMLAnchorElement interface: attribute hash] + expected: FAIL + + [HTMLAnchorElement interface: document.createElement("a") must inherit property "href" with the proper type (13)] + expected: FAIL + + [HTMLAnchorElement interface: document.createElement("a") must inherit property "origin" with the proper type (14)] + expected: FAIL + + [HTMLAnchorElement interface: document.createElement("a") must inherit property "protocol" with the proper type (15)] + expected: FAIL + + [HTMLAnchorElement interface: document.createElement("a") must inherit property "username" with the proper type (16)] + expected: FAIL + + [HTMLAnchorElement interface: document.createElement("a") must inherit property "password" with the proper type (17)] + expected: FAIL + + [HTMLAnchorElement interface: document.createElement("a") must inherit property "host" with the proper type (18)] + expected: FAIL + + [HTMLAnchorElement interface: document.createElement("a") must inherit property "hostname" with the proper type (19)] + expected: FAIL + + [HTMLAnchorElement interface: document.createElement("a") must inherit property "port" with the proper type (20)] + expected: FAIL + + [HTMLAnchorElement interface: document.createElement("a") must inherit property "pathname" with the proper type (21)] + expected: FAIL + + [HTMLAnchorElement interface: document.createElement("a") must inherit property "search" with the proper type (22)] + expected: FAIL + + [HTMLAnchorElement interface: document.createElement("a") must inherit property "hash" with the proper type (23)] + expected: FAIL + + [HTMLAreaElement interface: attribute href] + expected: FAIL + + [HTMLAreaElement interface: attribute origin] + expected: FAIL + + [HTMLAreaElement interface: attribute protocol] + expected: FAIL + + [HTMLAreaElement interface: attribute username] + expected: FAIL + + [HTMLAreaElement interface: attribute password] + expected: FAIL + + [HTMLAreaElement interface: attribute host] + expected: FAIL + + [HTMLAreaElement interface: attribute hostname] + expected: FAIL + + [HTMLAreaElement interface: attribute port] + expected: FAIL + + [HTMLAreaElement interface: attribute pathname] + expected: FAIL + + [HTMLAreaElement interface: attribute search] + expected: FAIL + + [HTMLAreaElement interface: attribute hash] + expected: FAIL + + [HTMLAreaElement interface: document.createElement("area") must inherit property "noHref" with the proper type (8)] + expected: FAIL + + [HTMLAreaElement interface: document.createElement("area") must inherit property "href" with the proper type (9)] + expected: FAIL + + [HTMLAreaElement interface: document.createElement("area") must inherit property "origin" with the proper type (10)] + expected: FAIL + + [HTMLAreaElement interface: document.createElement("area") must inherit property "protocol" with the proper type (11)] + expected: FAIL + + [HTMLAreaElement interface: document.createElement("area") must inherit property "username" with the proper type (12)] + expected: FAIL + + [HTMLAreaElement interface: document.createElement("area") must inherit property "password" with the proper type (13)] + expected: FAIL + + [HTMLAreaElement interface: document.createElement("area") must inherit property "host" with the proper type (14)] + expected: FAIL + + [HTMLAreaElement interface: document.createElement("area") must inherit property "hostname" with the proper type (15)] + expected: FAIL + + [HTMLAreaElement interface: document.createElement("area") must inherit property "port" with the proper type (16)] + expected: FAIL + + [HTMLAreaElement interface: document.createElement("area") must inherit property "pathname" with the proper type (17)] + expected: FAIL + + [HTMLAreaElement interface: document.createElement("area") must inherit property "search" with the proper type (18)] + expected: FAIL + + [HTMLAreaElement interface: document.createElement("area") must inherit property "hash" with the proper type (19)] + expected: FAIL + + [Location interface: window.location must have own property "href"] + expected: FAIL + + [Location interface: window.location must have own property "origin"] + expected: FAIL + + [Location interface: window.location must have own property "protocol"] + expected: FAIL + + [Location interface: window.location must have own property "host"] + expected: FAIL + + [Location interface: window.location must have own property "hostname"] + expected: FAIL + + [Location interface: window.location must have own property "port"] + expected: FAIL + + [Location interface: window.location must have own property "pathname"] + expected: FAIL + + [Location interface: window.location must have own property "search"] + expected: FAIL + + [Location interface: window.location must have own property "hash"] + expected: FAIL + + [Location interface: calling assign(USVString) on window.location with too few arguments must throw TypeError] + expected: FAIL + + [Location interface: calling replace(USVString) on window.location with too few arguments must throw TypeError] + expected: FAIL + + [Location interface: window.location must have own property "ancestorOrigins"] + expected: FAIL + + [WorkerLocation interface: attribute origin] + expected: FAIL + diff --git a/tests/wpt/metadata/url/interfaces.html.ini b/tests/wpt/metadata/url/interfaces.html.ini index 17a665ab572..1b3c30bdfb3 100644 --- a/tests/wpt/metadata/url/interfaces.html.ini +++ b/tests/wpt/metadata/url/interfaces.html.ini @@ -15,9 +15,12 @@ [URL interface: new URL("http://foo") must inherit property "searchParams" with the proper type (12)] expected: FAIL - [URLSearchParams interface: existence and properties of interface object] + [URLSearchParams interface: operation getAll(ScalarValueString)] expected: FAIL - [URLSearchParams interface: operation getAll(ScalarValueString)] + [URL interface: operation domainToUnicode(USVString)] + expected: FAIL + + [URLSearchParams interface: operation getAll(USVString)] expected: FAIL diff --git a/tests/wpt/web-platform-tests/html/dom/elements-embedded.js b/tests/wpt/web-platform-tests/html/dom/elements-embedded.js index a948b62ff83..4966abdcf8e 100644 --- a/tests/wpt/web-platform-tests/html/dom/elements-embedded.js +++ b/tests/wpt/web-platform-tests/html/dom/elements-embedded.js @@ -141,7 +141,7 @@ var embeddedElements = { hreflang: "string", type: "string", - //URLUtils + // HTMLHyperlinkElementUtils href: "url", // Obsolete diff --git a/tests/wpt/web-platform-tests/html/dom/elements-text.js b/tests/wpt/web-platform-tests/html/dom/elements-text.js index bcfcb8f00ff..96c1d923702 100644 --- a/tests/wpt/web-platform-tests/html/dom/elements-text.js +++ b/tests/wpt/web-platform-tests/html/dom/elements-text.js @@ -10,7 +10,7 @@ var textElements = { hreflang: "string", type: "string", - // URLUtils + // HTMLHyperlinkElementUtils href: "url", // Obsolete diff --git a/tests/wpt/web-platform-tests/html/dom/interfaces.html b/tests/wpt/web-platform-tests/html/dom/interfaces.html index cc5945f2461..69d81ccb0eb 100644 --- a/tests/wpt/web-platform-tests/html/dom/interfaces.html +++ b/tests/wpt/web-platform-tests/html/dom/interfaces.html @@ -11,16 +11,6 @@ <h1>HTML IDL tests</h1> <div id=log></div> -<!-- URLUtils* stubs --> -<script type=text/plain class=untested> -interface URLUtils { - stringifier; -}; -interface URLUtilsReadOnly { - stringifier; -}; -</script> -<!-- DOM IDLs --> <script type=text/plain class=untested> [Constructor(DOMString type, optional EventInit eventInitDict)/*, Exposed=(Window,Worker)*/] @@ -868,6 +858,21 @@ typedef (Int8Array or Uint8Array or Uint8ClampedArray or Float32Array or Float64Array or DataView) ArrayBufferView; +[NoInterfaceObject, Exposed=Window] +interface HTMLHyperlinkElementUtils { + stringifier attribute USVString href; + attribute USVString origin; + attribute USVString protocol; + attribute USVString username; + attribute USVString password; + attribute USVString host; + attribute USVString hostname; + attribute USVString port; + attribute USVString pathname; + attribute USVString search; + attribute USVString hash; +}; + interface HTMLAllCollection : HTMLCollection { // inherits length and 'getter' Element? item(unsigned long index); @@ -1125,19 +1130,17 @@ interface HTMLDivElement : HTMLElement { }; interface HTMLAnchorElement : HTMLElement { - attribute DOMString target; - attribute DOMString download; - [PutForwards=value] attribute DOMSettableTokenList ping; - attribute DOMString rel; + attribute DOMString target; + attribute DOMString download; + [PutForwards=value] readonly attribute DOMSettableTokenList ping; + attribute DOMString rel; readonly attribute DOMTokenList relList; - attribute DOMString hreflang; - attribute DOMString type; - - attribute DOMString text; + attribute DOMString hreflang; + attribute DOMString type; - // also has obsolete members + attribute DOMString text; }; -HTMLAnchorElement implements URLUtils; +HTMLAnchorElement implements HTMLHyperlinkElementUtils; interface HTMLDataElement : HTMLElement { attribute DOMString value; @@ -1494,20 +1497,17 @@ interface HTMLMapElement : HTMLElement { }; interface HTMLAreaElement : HTMLElement { - attribute DOMString alt; - attribute DOMString coords; - attribute DOMString shape; - attribute DOMString target; - attribute DOMString download; - [PutForwards=value] attribute DOMSettableTokenList ping; - attribute DOMString rel; + attribute DOMString alt; + attribute DOMString coords; + attribute DOMString shape; + attribute DOMString target; + attribute DOMString download; + [PutForwards=value] readonly attribute DOMSettableTokenList ping; + attribute DOMString rel; readonly attribute DOMTokenList relList; - attribute DOMString hreflang; - attribute DOMString type; - - // also has obsolete members + // hreflang and type are not reflected }; -HTMLAreaElement implements URLUtils; +HTMLAreaElement implements HTMLHyperlinkElementUtils; interface HTMLTableElement : HTMLElement { attribute HTMLTableCaptionElement? caption; @@ -2320,11 +2320,22 @@ interface History { }; [Unforgeable] interface Location { - void assign(DOMString url); - void replace(DOMString url); + stringifier attribute USVString href; + attribute USVString origin; + attribute USVString protocol; + attribute USVString host; + attribute USVString hostname; + attribute USVString port; + attribute USVString pathname; + attribute USVString search; + attribute USVString hash; + + void assign(USVString url); + void replace(USVString url); void reload(); + + [SameObject] readonly attribute USVString[] ancestorOrigins; }; -Location implements URLUtils; [Constructor(DOMString type, optional PopStateEventInit eventInitDict), Exposed=Window,Worker] interface PopStateEvent : Event { @@ -2816,8 +2827,17 @@ WorkerNavigator implements NavigatorLanguage; WorkerNavigator implements NavigatorOnLine; [Exposed=Worker] -interface WorkerLocation { }; -WorkerLocation implements URLUtilsReadOnly; +interface WorkerLocation { + stringifier readonly attribute USVString href; + readonly attribute USVString origin; + readonly attribute USVString protocol; + readonly attribute USVString host; + readonly attribute USVString hostname; + readonly attribute USVString port; + readonly attribute USVString pathname; + readonly attribute USVString search; + readonly attribute USVString hash; +}; interface Storage { readonly attribute unsigned long length; diff --git a/tests/wpt/web-platform-tests/url/interfaces.html b/tests/wpt/web-platform-tests/url/interfaces.html index 4cae46732be..254242fb884 100644 --- a/tests/wpt/web-platform-tests/url/interfaces.html +++ b/tests/wpt/web-platform-tests/url/interfaces.html @@ -9,54 +9,38 @@ <div id=log></div> <script type=text/plain> -[Constructor(DOMString url, optional DOMString base = "about:blank"), - Exposed=Window,Worker] +[Constructor(USVString url, optional USVString base), + Exposed=(Window,Worker)] interface URL { - static DOMString domainToASCII(ScalarValueString domain); - static DOMString domainToUnicode(ScalarValueString domain); -}; -URL implements URLUtils; - -[NoInterfaceObject] -interface URLUtils { - stringifier attribute ScalarValueString href; - readonly attribute DOMString origin; + static USVString domainToASCII(USVString domain); + static USVString domainToUnicode(USVString domain); - attribute ScalarValueString protocol; - attribute ScalarValueString username; - attribute ScalarValueString password; - attribute ScalarValueString host; - attribute ScalarValueString hostname; - attribute ScalarValueString port; - attribute ScalarValueString pathname; - attribute ScalarValueString search; - readonly attribute URLSearchParams searchParams; - attribute ScalarValueString hash; + stringifier attribute USVString href; + readonly attribute USVString origin; + attribute USVString protocol; + attribute USVString username; + attribute USVString password; + attribute USVString host; + attribute USVString hostname; + attribute USVString port; + attribute USVString pathname; + attribute USVString search; + readonly attribute URLSearchParams searchParams; + attribute USVString hash; }; -[NoInterfaceObject] -interface URLUtilsReadOnly { - stringifier readonly attribute DOMString href; - readonly attribute DOMString origin; - - readonly attribute DOMString protocol; - readonly attribute DOMString host; - readonly attribute DOMString hostname; - readonly attribute DOMString port; - readonly attribute DOMString pathname; - readonly attribute DOMString search; - readonly attribute DOMString hash; -}; +[Constructor(optional (USVString or URLSearchParams) init = ""), + Exposed=(Window,Worker)] interface URLSearchParams { - void append(ScalarValueString name, ScalarValueString value); - void delete(ScalarValueString name); - DOMString? get(ScalarValueString name); - sequence<DOMString> getAll(ScalarValueString name); - boolean has(ScalarValueString name); - void set(ScalarValueString name, ScalarValueString value); + void append(USVString name, USVString value); + void delete(USVString name); + USVString? get(USVString name); + sequence<USVString> getAll(USVString name); + boolean has(USVString name); + void set(USVString name, USVString value); + iterable<USVString, USVString>; stringifier; }; -typedef DOMString ScalarValueString; </script> <script> "use strict"; |