mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Use origin for document.domain.
This commit is contained in:
parent
a8233a135e
commit
fa42b452a0
2 changed files with 12 additions and 8 deletions
|
@ -1881,9 +1881,18 @@ impl DocumentMethods for Document {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#relaxing-the-same-origin-restriction
|
||||
fn Domain(&self) -> DOMString {
|
||||
// TODO: This should use the effective script origin when it exists
|
||||
let origin = self.window.get_url();
|
||||
DOMString::from(origin.serialize_host().unwrap_or_else(|| "".to_owned()))
|
||||
// Step 1.
|
||||
if self.browsing_context().is_none() {
|
||||
return DOMString::new();
|
||||
}
|
||||
|
||||
if let Some(host) = self.origin.host() {
|
||||
// Step 4.
|
||||
DOMString::from(host.serialize())
|
||||
} else {
|
||||
// Step 3.
|
||||
DOMString::new()
|
||||
}
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-document-documenturi
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
[document_domain.html]
|
||||
type: testharness
|
||||
[new document]
|
||||
expected: FAIL
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue