зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #8008 - Update URL-related interfaces and their tests up to spec (from nox:url); r=jdm
The URL spec recently changed and the variour "mixins" interfaces are gone, this commit updates our code and WPT accordingly. The new expected failures related to HTMLAnchorElement and HTMLAreaElement's attributes are due to their moving to the HTMLHyperLinkElementUtils interface, which is not anymore in a separate `<script class=untested>` element. Source-Repo: https://github.com/servo/servo Source-Revision: f73cd40282ab79f53b38f2b057677b0423282f32
This commit is contained in:
Родитель
8be0065221
Коммит
e59d3711fa
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
//};
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
|
@ -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;
|
||||
};
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче