Use origin for document.domain.

This commit is contained in:
Josh Matthews 2016-04-13 10:38:53 +02:00 committed by Ms2ger
parent a8233a135e
commit fa42b452a0
2 changed files with 12 additions and 8 deletions

View file

@ -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

View file

@ -1,5 +0,0 @@
[document_domain.html]
type: testharness
[new document]
expected: FAIL