Pass the Document's origin to its constructor.

CC #10963.
This commit is contained in:
Ms2ger 2016-11-28 18:27:23 +01:00
parent 01e336f691
commit ec5d08c887
9 changed files with 34 additions and 17 deletions

View file

@ -1822,6 +1822,7 @@ impl Document {
pub fn new_inherited(window: &Window,
browsing_context: Option<&BrowsingContext>,
url: Option<ServoUrl>,
origin: Origin,
is_html_document: IsHTMLDocument,
content_type: Option<DOMString>,
last_modified: Option<String>,
@ -1838,15 +1839,6 @@ impl Document {
(DocumentReadyState::Complete, true)
};
// Incomplete implementation of Document origin specification at
// https://html.spec.whatwg.org/multipage/#origin:document
let origin = if url_has_network_scheme(&url) {
Origin::new(&url)
} else {
// Default to DOM standard behaviour
Origin::opaque_identifier()
};
Document {
node: Node::new_document_node(),
window: JS::from_ref(window),
@ -1932,6 +1924,7 @@ impl Document {
Ok(Document::new(window,
None,
None,
doc.origin().alias(),
IsHTMLDocument::NonHTMLDocument,
None,
None,
@ -1944,6 +1937,7 @@ impl Document {
pub fn new(window: &Window,
browsing_context: Option<&BrowsingContext>,
url: Option<ServoUrl>,
origin: Origin,
doctype: IsHTMLDocument,
content_type: Option<DOMString>,
last_modified: Option<String>,
@ -1955,6 +1949,7 @@ impl Document {
let document = reflect_dom_object(box Document::new_inherited(window,
browsing_context,
url,
origin,
doctype,
content_type,
last_modified,
@ -2026,6 +2021,8 @@ impl Document {
let new_doc = Document::new(self.window(),
None,
None,
// https://github.com/whatwg/html/issues/2109
Origin::opaque_identifier(),
doctype,
None,
None,