mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Implement worker origin member of WorkerLocation
This commit is contained in:
parent
9d9fff3b0a
commit
05bef140bf
57 changed files with 157 additions and 445 deletions
|
@ -6,7 +6,7 @@
|
|||
[Exposed=Worker]
|
||||
interface WorkerLocation {
|
||||
/*stringifier*/ readonly attribute USVString href;
|
||||
// readonly attribute USVString origin;
|
||||
readonly attribute USVString origin;
|
||||
readonly attribute USVString protocol;
|
||||
readonly attribute USVString host;
|
||||
readonly attribute USVString hostname;
|
||||
|
|
|
@ -10,7 +10,7 @@ use crate::dom::bindings::str::{DOMString, USVString};
|
|||
use crate::dom::urlhelper::UrlHelper;
|
||||
use crate::dom::workerglobalscope::WorkerGlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use servo_url::ServoUrl;
|
||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#worker-locations
|
||||
#[dom_struct]
|
||||
|
@ -34,6 +34,12 @@ impl WorkerLocation {
|
|||
WorkerLocationBinding::Wrap,
|
||||
)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-origin
|
||||
#[allow(dead_code)]
|
||||
pub fn origin(&self) -> ImmutableOrigin {
|
||||
self.url.origin()
|
||||
}
|
||||
}
|
||||
|
||||
impl WorkerLocationMethods for WorkerLocation {
|
||||
|
@ -57,6 +63,11 @@ impl WorkerLocationMethods for WorkerLocation {
|
|||
UrlHelper::Href(&self.url)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-origin
|
||||
fn Origin(&self) -> USVString {
|
||||
UrlHelper::Origin(&self.url)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-pathname
|
||||
fn Pathname(&self) -> USVString {
|
||||
UrlHelper::Pathname(&self.url)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue