diff options
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r-- | components/script/dom/document.rs | 58 |
1 files changed, 25 insertions, 33 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 49bc45b27c1..6895a71fddb 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -132,7 +132,7 @@ use style::invalidation::element::restyle_hints::RestyleHint; use style::media_queries::{Device, MediaList, MediaType}; use style::selector_parser::{RestyleDamage, Snapshot}; use style::shared_lock::{SharedRwLock as StyleSharedRwLock, SharedRwLockReadGuard}; -use style::str::{HTML_SPACE_CHARACTERS, split_html_space_chars, str_join}; +use style::str::{split_html_space_chars, str_join}; use style::stylesheet_set::DocumentStylesheetSet; use style::stylesheets::{Stylesheet, StylesheetContents, Origin, OriginSet}; use task_source::TaskSource; @@ -3675,7 +3675,7 @@ impl DocumentMethods for Document { } // https://html.spec.whatwg.org/multipage/#dom-document-open - fn Open(&self, type_: DOMString, replace: DOMString) -> Fallible<DomRoot<Document>> { + fn Open(&self, _type: Option<DOMString>, replace: DOMString) -> Fallible<DomRoot<Document>> { if !self.is_html_document() { // Step 1. return Err(Error::InvalidState); @@ -3709,9 +3709,7 @@ impl DocumentMethods for Document { // Step 6. // TODO: ignore-opens-during-unload counter check. - // Step 7: first argument already bound to `type_`. - - // Step 8. + // Step 7, 8. // TODO: check session history's state. let replace = replace.eq_ignore_ascii_case("replace"); @@ -3740,11 +3738,11 @@ impl DocumentMethods for Document { // Step 15. Node::replace_all(None, self.upcast::<Node>()); - // Steps 16-18. + // Steps 16, 17. // Let's not? // TODO: https://github.com/whatwg/html/issues/1698 - // Step 19. + // Step 18. self.implementation.set(None); self.images.set(None); self.embeds.set(None); @@ -3760,65 +3758,59 @@ impl DocumentMethods for Document { self.target_element.set(None); *self.last_click_info.borrow_mut() = None; + // Step 19. + // TODO: Set the active document of document's browsing context to document with window. + // Step 20. - self.set_encoding(UTF_8); + // TODO: Replace document's singleton objects with new instances of those objects, created in window's Realm. // Step 21. - // TODO: reload override buffer. + self.set_encoding(UTF_8); // Step 22. + // TODO: reload override buffer. + + // Step 23. // TODO: salvageable flag. let url = entry_responsible_document.url(); - // Step 23. + // Step 24. self.set_url(url.clone()); - // Step 24. + // Step 25. // TODO: mute iframe load. - // Step 27. - let type_ = if type_.eq_ignore_ascii_case("replace") { - "text/html" - } else if let Some(position) = type_.find(';') { - &type_[0..position] - } else { - &*type_ - }; - let type_ = type_.trim_matches(HTML_SPACE_CHARACTERS); - - // Step 25. + // Step 26. let resource_threads = self.window.upcast::<GlobalScope>().resource_threads().clone(); *self.loader.borrow_mut() = DocumentLoader::new_with_threads(resource_threads, Some(url.clone())); - ServoParser::parse_html_script_input(self, url, type_); + ServoParser::parse_html_script_input(self, url, "text/html"); - // Step 26. + // Step 27. self.ready_state.set(DocumentReadyState::Interactive); - // Step 28 is handled when creating the parser in step 25. + // Step 28. + // TODO: remove history traversal tasks. // Step 29. // TODO: truncate session history. // Step 30. - // TODO: remove history traversal tasks. - - // Step 31. // TODO: remove earlier entries. if !replace { - // Step 32. + // Step 31. // TODO: add history entry. } - // Step 33. + // Step 32. // TODO: clear fired unload flag. - // Step 34 is handled when creating the parser in step 25. + // Step 33 is handled when creating the parser in step 26. - // Step 35. + // Step 34. Ok(DomRoot::from_ref(self)) } @@ -3851,7 +3843,7 @@ impl DocumentMethods for Document { return Ok(()); } // Step 5. - self.Open("text/html".into(), "".into())?; + self.Open(None, "".into())?; self.get_current_parser().unwrap() } }; |