mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Make type
argument as optional and ignore it in open method
This commit is contained in:
parent
8028ee3d24
commit
65da9b5acb
2 changed files with 5 additions and 17 deletions
|
@ -132,7 +132,7 @@ use style::invalidation::element::restyle_hints::RestyleHint;
|
||||||
use style::media_queries::{Device, MediaList, MediaType};
|
use style::media_queries::{Device, MediaList, MediaType};
|
||||||
use style::selector_parser::{RestyleDamage, Snapshot};
|
use style::selector_parser::{RestyleDamage, Snapshot};
|
||||||
use style::shared_lock::{SharedRwLock as StyleSharedRwLock, SharedRwLockReadGuard};
|
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::stylesheet_set::DocumentStylesheetSet;
|
||||||
use style::stylesheets::{Stylesheet, StylesheetContents, Origin, OriginSet};
|
use style::stylesheets::{Stylesheet, StylesheetContents, Origin, OriginSet};
|
||||||
use task_source::TaskSource;
|
use task_source::TaskSource;
|
||||||
|
@ -3675,7 +3675,7 @@ impl DocumentMethods for Document {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-document-open
|
// 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() {
|
if !self.is_html_document() {
|
||||||
// Step 1.
|
// Step 1.
|
||||||
return Err(Error::InvalidState);
|
return Err(Error::InvalidState);
|
||||||
|
@ -3709,8 +3709,6 @@ impl DocumentMethods for Document {
|
||||||
// Step 6.
|
// Step 6.
|
||||||
// TODO: ignore-opens-during-unload counter check.
|
// TODO: ignore-opens-during-unload counter check.
|
||||||
|
|
||||||
// Step 7: first argument already bound to `type_`.
|
|
||||||
|
|
||||||
// Step 8.
|
// Step 8.
|
||||||
// TODO: check session history's state.
|
// TODO: check session history's state.
|
||||||
let replace = replace.eq_ignore_ascii_case("replace");
|
let replace = replace.eq_ignore_ascii_case("replace");
|
||||||
|
@ -3777,22 +3775,12 @@ impl DocumentMethods for Document {
|
||||||
// Step 24.
|
// Step 24.
|
||||||
// TODO: mute iframe load.
|
// 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 25.
|
||||||
let resource_threads =
|
let resource_threads =
|
||||||
self.window.upcast::<GlobalScope>().resource_threads().clone();
|
self.window.upcast::<GlobalScope>().resource_threads().clone();
|
||||||
*self.loader.borrow_mut() =
|
*self.loader.borrow_mut() =
|
||||||
DocumentLoader::new_with_threads(resource_threads, Some(url.clone()));
|
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 26.
|
||||||
self.ready_state.set(DocumentReadyState::Interactive);
|
self.ready_state.set(DocumentReadyState::Interactive);
|
||||||
|
@ -3851,7 +3839,7 @@ impl DocumentMethods for Document {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
// Step 5.
|
// Step 5.
|
||||||
self.Open("text/html".into(), "".into())?;
|
self.Open(None, "".into())?;
|
||||||
self.get_current_parser().unwrap()
|
self.get_current_parser().unwrap()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -118,7 +118,7 @@ partial /*sealed*/ interface Document {
|
||||||
|
|
||||||
// dynamic markup insertion
|
// dynamic markup insertion
|
||||||
[CEReactions, Throws]
|
[CEReactions, Throws]
|
||||||
Document open(optional DOMString type = "text/html", optional DOMString replace = "");
|
Document open(optional DOMString type, optional DOMString replace = "");
|
||||||
// WindowProxy open(DOMString url, DOMString name, DOMString features, optional boolean replace = false);
|
// WindowProxy open(DOMString url, DOMString name, DOMString features, optional boolean replace = false);
|
||||||
[CEReactions, Throws]
|
[CEReactions, Throws]
|
||||||
void close();
|
void close();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue