mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Auto merge of #14164 - nox:write, r=Ms2ger
Update html5ever to 0.10.1 <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14164) <!-- Reviewable:end -->
This commit is contained in:
commit
990884be20
7 changed files with 35 additions and 36 deletions
|
@ -37,7 +37,7 @@ fnv = "1.0"
|
|||
gfx_traits = {path = "../gfx_traits"}
|
||||
heapsize = "0.3.6"
|
||||
heapsize_derive = "0.1"
|
||||
html5ever = {version = "0.9.0", features = ["heap_size", "unstable"]}
|
||||
html5ever = {version = "0.10.1", features = ["heap_size", "unstable"]}
|
||||
html5ever-atoms = {version = "0.1", features = ["heap_size"]}
|
||||
hyper = "0.9.9"
|
||||
hyper_serde = "0.1.4"
|
||||
|
|
|
@ -27,7 +27,6 @@ use dom::node::{document_from_node, window_from_node};
|
|||
use dom::virtualmethods::VirtualMethods;
|
||||
use encoding::label::encoding_from_whatwg_label;
|
||||
use encoding::types::{DecoderTrap, EncodingRef};
|
||||
use html5ever::tree_builder::NextParserState;
|
||||
use html5ever_atoms::LocalName;
|
||||
use ipc_channel::ipc;
|
||||
use ipc_channel::router::ROUTER;
|
||||
|
@ -275,10 +274,12 @@ fn fetch_a_classic_script(script: &HTMLScriptElement,
|
|||
|
||||
impl HTMLScriptElement {
|
||||
/// https://html.spec.whatwg.org/multipage/#prepare-a-script
|
||||
pub fn prepare(&self) -> NextParserState {
|
||||
///
|
||||
/// Returns true if tokenization should continue, false otherwise.
|
||||
pub fn prepare(&self) -> bool {
|
||||
// Step 1.
|
||||
if self.already_started.get() {
|
||||
return NextParserState::Continue;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Step 2.
|
||||
|
@ -296,17 +297,17 @@ impl HTMLScriptElement {
|
|||
// Step 4.
|
||||
let text = self.Text();
|
||||
if text.is_empty() && !element.has_attribute(&local_name!("src")) {
|
||||
return NextParserState::Continue;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Step 5.
|
||||
if !self.upcast::<Node>().is_in_doc() {
|
||||
return NextParserState::Continue;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Step 6.
|
||||
if !self.is_javascript() {
|
||||
return NextParserState::Continue;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Step 7.
|
||||
|
@ -321,12 +322,12 @@ impl HTMLScriptElement {
|
|||
// Step 9.
|
||||
let doc = document_from_node(self);
|
||||
if self.parser_inserted.get() && &*self.parser_document != &*doc {
|
||||
return NextParserState::Continue;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Step 10.
|
||||
if !doc.is_scripting_enabled() {
|
||||
return NextParserState::Continue;
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO(#4577): Step 11: CSP.
|
||||
|
@ -339,13 +340,13 @@ impl HTMLScriptElement {
|
|||
let for_value = for_attribute.value().to_ascii_lowercase();
|
||||
let for_value = for_value.trim_matches(HTML_SPACE_CHARACTERS);
|
||||
if for_value != "window" {
|
||||
return NextParserState::Continue;
|
||||
return true;
|
||||
}
|
||||
|
||||
let event_value = event_attribute.value().to_ascii_lowercase();
|
||||
let event_value = event_value.trim_matches(HTML_SPACE_CHARACTERS);
|
||||
if event_value != "onload" && event_value != "onload()" {
|
||||
return NextParserState::Continue;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
(_, _) => (),
|
||||
|
@ -380,7 +381,7 @@ impl HTMLScriptElement {
|
|||
// Step 18.2.
|
||||
if src.is_empty() {
|
||||
self.queue_error_event();
|
||||
return NextParserState::Continue;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Step 18.4-18.5.
|
||||
|
@ -388,7 +389,7 @@ impl HTMLScriptElement {
|
|||
Err(_) => {
|
||||
warn!("error parsing URL for script {}", &**src);
|
||||
self.queue_error_event();
|
||||
return NextParserState::Continue;
|
||||
return true;
|
||||
}
|
||||
Ok(url) => url,
|
||||
};
|
||||
|
@ -411,7 +412,7 @@ impl HTMLScriptElement {
|
|||
!async {
|
||||
doc.add_deferred_script(self);
|
||||
// Second part implemented in Document::process_deferred_scripts.
|
||||
return NextParserState::Continue;
|
||||
return true;
|
||||
// Step 20.b: classic, has src, was parser-inserted, is not async.
|
||||
} else if is_external &&
|
||||
was_parser_inserted &&
|
||||
|
@ -442,7 +443,7 @@ impl HTMLScriptElement {
|
|||
self.ready_to_be_parser_executed.set(true);
|
||||
*self.load.borrow_mut() = Some(Ok(ScriptOrigin::internal(text, base_url)));
|
||||
self.execute();
|
||||
return NextParserState::Continue;
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: make this suspension happen automatically.
|
||||
|
@ -451,7 +452,7 @@ impl HTMLScriptElement {
|
|||
parser.suspend();
|
||||
}
|
||||
}
|
||||
NextParserState::Suspend
|
||||
false
|
||||
}
|
||||
|
||||
pub fn is_ready_to_be_executed(&self) -> bool {
|
||||
|
|
|
@ -30,7 +30,7 @@ use html5ever::serialize::TraversalScope;
|
|||
use html5ever::serialize::TraversalScope::{ChildrenOnly, IncludeNode};
|
||||
use html5ever::tendril::StrTendril;
|
||||
use html5ever::tokenizer::{Tokenizer as H5ETokenizer, TokenizerOpts};
|
||||
use html5ever::tree_builder::{NextParserState, NodeOrText, QuirksMode};
|
||||
use html5ever::tree_builder::{NodeOrText, QuirksMode};
|
||||
use html5ever::tree_builder::{TreeBuilder, TreeBuilderOpts, TreeSink};
|
||||
use html5ever_atoms::QualName;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
|
@ -153,14 +153,6 @@ impl<'a> TreeSink for Sink {
|
|||
script.map(|script| script.set_already_started(true));
|
||||
}
|
||||
|
||||
fn complete_script(&mut self, node: JS<Node>) -> NextParserState {
|
||||
let script = node.downcast::<HTMLScriptElement>();
|
||||
if let Some(script) = script {
|
||||
return script.prepare();
|
||||
}
|
||||
NextParserState::Continue
|
||||
}
|
||||
|
||||
fn reparent_children(&mut self, node: JS<Node>, new_parent: JS<Node>) {
|
||||
while let Some(ref child) = node.GetFirstChild() {
|
||||
new_parent.AppendChild(&child).unwrap();
|
||||
|
|
|
@ -17,10 +17,11 @@ use dom::bindings::trace::JSTraceable;
|
|||
use dom::document::Document;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::htmlimageelement::HTMLImageElement;
|
||||
use dom::htmlscriptelement::HTMLScriptElement;
|
||||
use dom::node::Node;
|
||||
use encoding::all::UTF_8;
|
||||
use encoding::types::{DecoderTrap, Encoding};
|
||||
use html5ever::tokenizer::Tokenizer as H5ETokenizer;
|
||||
use html5ever::tokenizer::{Tokenizer as H5ETokenizer, TokenizerResult};
|
||||
use html5ever::tokenizer::buffer_queue::BufferQueue;
|
||||
use html5ever::tree_builder::Tracer as HtmlTracer;
|
||||
use html5ever::tree_builder::TreeBuilder as HtmlTreeBuilder;
|
||||
|
@ -247,8 +248,14 @@ impl HtmlTokenizer {
|
|||
self.run();
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
fn run(&mut self) {
|
||||
self.inner.feed(&mut self.input_buffer);
|
||||
while let TokenizerResult::Script(script) = self.inner.feed(&mut self.input_buffer) {
|
||||
let script = Root::from_ref(script.downcast::<HTMLScriptElement>().unwrap());
|
||||
if !script.prepare() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn end(&mut self) {
|
||||
|
|
|
@ -16,7 +16,6 @@ use dom::htmlscriptelement::HTMLScriptElement;
|
|||
use dom::node::Node;
|
||||
use dom::processinginstruction::ProcessingInstruction;
|
||||
use dom::text::Text;
|
||||
use html5ever;
|
||||
use html5ever_atoms::{Prefix, QualName};
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use std::borrow::Cow;
|
||||
|
@ -113,8 +112,8 @@ impl<'a> TreeSink for Sink {
|
|||
let script = node.downcast::<HTMLScriptElement>();
|
||||
if let Some(script) = script {
|
||||
return match script.prepare() {
|
||||
html5ever::tree_builder::NextParserState::Continue => NextParserState::Continue,
|
||||
html5ever::tree_builder::NextParserState::Suspend => NextParserState::Suspend
|
||||
true => NextParserState::Continue,
|
||||
false => NextParserState::Suspend,
|
||||
};
|
||||
}
|
||||
NextParserState::Continue
|
||||
|
|
6
components/servo/Cargo.lock
generated
6
components/servo/Cargo.lock
generated
|
@ -1029,7 +1029,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "html5ever"
|
||||
version = "0.9.0"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2096,7 +2096,7 @@ dependencies = [
|
|||
"gfx_traits 0.0.1",
|
||||
"heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever-atoms 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper_serde 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -3101,7 +3101,7 @@ dependencies = [
|
|||
"checksum heartbeats-simple 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "78c0810722eacd0bdd3f1f691524bd9900bf8fed1947f6b883c10ddecd2560b1"
|
||||
"checksum heartbeats-simple-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53c4b67617665d7f4172f381f9843c1bec6a4fccc9a9226529e5b1be40dc1301"
|
||||
"checksum hpack 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d2da7d3a34cf6406d9d700111b8eafafe9a251de41ae71d8052748259343b58"
|
||||
"checksum html5ever 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6a2e00f17a864dfee00d41b46fda2a669e10e96bf71f8c712b3c88f4977188d7"
|
||||
"checksum html5ever 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e8b18bb73cb3535597d23fbd1998fb45fe88cb12b9acf183a0188331f6d915"
|
||||
"checksum html5ever-atoms 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "daefa106438c66af58309c84842b5db1df2733fe35849f39adde6fdf63583d40"
|
||||
"checksum httparse 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "46534074dbb80b070d60a5cb8ecadd8963a00a438ae1a95268850a7ef73b67ae"
|
||||
"checksum hyper 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)" = "edd47c66782933e546a32ae89ca3c49263b2ba9bc29f3a0d5c52fff48e0ac67c"
|
||||
|
|
6
ports/cef/Cargo.lock
generated
6
ports/cef/Cargo.lock
generated
|
@ -919,7 +919,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "html5ever"
|
||||
version = "0.9.0"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1917,7 +1917,7 @@ dependencies = [
|
|||
"gfx_traits 0.0.1",
|
||||
"heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever-atoms 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper_serde 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2908,7 +2908,7 @@ dependencies = [
|
|||
"checksum heartbeats-simple 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "78c0810722eacd0bdd3f1f691524bd9900bf8fed1947f6b883c10ddecd2560b1"
|
||||
"checksum heartbeats-simple-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53c4b67617665d7f4172f381f9843c1bec6a4fccc9a9226529e5b1be40dc1301"
|
||||
"checksum hpack 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d2da7d3a34cf6406d9d700111b8eafafe9a251de41ae71d8052748259343b58"
|
||||
"checksum html5ever 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6a2e00f17a864dfee00d41b46fda2a669e10e96bf71f8c712b3c88f4977188d7"
|
||||
"checksum html5ever 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e8b18bb73cb3535597d23fbd1998fb45fe88cb12b9acf183a0188331f6d915"
|
||||
"checksum html5ever-atoms 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "daefa106438c66af58309c84842b5db1df2733fe35849f39adde6fdf63583d40"
|
||||
"checksum httparse 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "46534074dbb80b070d60a5cb8ecadd8963a00a438ae1a95268850a7ef73b67ae"
|
||||
"checksum hyper 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)" = "edd47c66782933e546a32ae89ca3c49263b2ba9bc29f3a0d5c52fff48e0ac67c"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue