mirror of
https://github.com/servo/servo.git
synced 2025-07-01 04:23:39 +01:00
Implement WindowOrWorkerGlobalScope.origin
The test document_domain_setter.html now fails, but AFAIK the origin comparison can never be true (document.origin is the unprefixed domain, while the loaded iframe is from www1.…), and that test fails in all major browsers because of security exceptions anyway.
This commit is contained in:
parent
88a0265c00
commit
73b5bf201f
7 changed files with 18 additions and 21 deletions
|
@ -9,7 +9,7 @@
|
|||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
interface WindowOrWorkerGlobalScope {
|
||||
// [Replaceable] readonly attribute USVString origin;
|
||||
[Replaceable] readonly attribute USVString origin;
|
||||
|
||||
// base64 utility methods
|
||||
[Throws] DOMString btoa(DOMString data);
|
||||
|
|
|
@ -22,7 +22,7 @@ use dom::bindings::num::Finite;
|
|||
use dom::bindings::refcounted::Trusted;
|
||||
use dom::bindings::reflector::DomObject;
|
||||
use dom::bindings::root::{Dom, DomRoot, MutNullableDom};
|
||||
use dom::bindings::str::DOMString;
|
||||
use dom::bindings::str::{DOMString, USVString};
|
||||
use dom::bindings::structuredclone::StructuredCloneData;
|
||||
use dom::bindings::trace::RootedTraceableBox;
|
||||
use dom::bindings::utils::{GlobalStaticData, WindowProxyHandler};
|
||||
|
@ -1038,6 +1038,11 @@ impl WindowMethods for Window {
|
|||
fn Name(&self) -> DOMString {
|
||||
self.window_proxy().get_name()
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-origin
|
||||
fn Origin(&self) -> USVString {
|
||||
USVString(self.origin().immutable().ascii_serialization())
|
||||
}
|
||||
}
|
||||
|
||||
impl Window {
|
||||
|
|
|
@ -12,7 +12,7 @@ use dom::bindings::inheritance::Castable;
|
|||
use dom::bindings::reflector::DomObject;
|
||||
use dom::bindings::root::{DomRoot, MutNullableDom};
|
||||
use dom::bindings::settings_stack::AutoEntryScript;
|
||||
use dom::bindings::str::DOMString;
|
||||
use dom::bindings::str::{DOMString, USVString};
|
||||
use dom::bindings::trace::RootedTraceableBox;
|
||||
use dom::crypto::Crypto;
|
||||
use dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScope;
|
||||
|
@ -328,6 +328,11 @@ impl WorkerGlobalScopeMethods for WorkerGlobalScope {
|
|||
self.navigation_start_precise)
|
||||
})
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-origin
|
||||
fn Origin(&self) -> USVString {
|
||||
USVString(self.upcast::<GlobalScope>().origin().immutable().ascii_serialization())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
[document_domain_setter.html]
|
||||
[same-origin-domain iframe]
|
||||
expected: FAIL
|
||||
|
|
@ -4973,9 +4973,6 @@
|
|||
[Window interface: attribute onmessageerror]
|
||||
expected: FAIL
|
||||
|
||||
[Window interface: attribute origin]
|
||||
expected: FAIL
|
||||
|
||||
[Window interface: operation createImageBitmap(ImageBitmapSource, ImageBitmapOptions)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -5075,9 +5072,6 @@
|
|||
[Window interface: window must inherit property "onmessageerror" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[Window interface: window must inherit property "origin" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[Window interface: window must inherit property "createImageBitmap(ImageBitmapSource, ImageBitmapOptions)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
[self-origin.any.worker.html]
|
||||
type: testharness
|
||||
[self.origin should be correct]
|
||||
expected: FAIL
|
||||
|
||||
|
||||
[self-origin.any.html]
|
||||
type: testharness
|
||||
[self.origin should be correct]
|
||||
expected: FAIL
|
||||
|
|
@ -260,7 +260,7 @@
|
|||
expected: FAIL
|
||||
|
||||
[WorkerGlobalScope interface: attribute origin]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[WorkerGlobalScope interface: operation createImageBitmap(ImageBitmapSource, ImageBitmapOptions)]
|
||||
expected: FAIL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue