aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/servoparser.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/servoparser.rs')
-rw-r--r--components/script/dom/servoparser.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/components/script/dom/servoparser.rs b/components/script/dom/servoparser.rs
index 1cdef6de642..c5611a6364d 100644
--- a/components/script/dom/servoparser.rs
+++ b/components/script/dom/servoparser.rs
@@ -6,6 +6,7 @@ use dom::bindings::cell::DOMRefCell;
use dom::bindings::reflector::Reflector;
use dom::bindings::js::JS;
use dom::document::Document;
+use std::cell::Cell;
#[dom_struct]
pub struct ServoParser {
@@ -14,14 +15,17 @@ pub struct ServoParser {
document: JS<Document>,
/// Input chunks received but not yet passed to the parser.
pending_input: DOMRefCell<Vec<String>>,
+ /// Whether to expect any further input from the associated network request.
+ last_chunk_received: Cell<bool>,
}
impl ServoParser {
- pub fn new_inherited(document: &Document) -> Self {
+ pub fn new_inherited(document: &Document, last_chunk_received: bool) -> Self {
ServoParser {
reflector: Reflector::new(),
document: JS::from_ref(document),
pending_input: DOMRefCell::new(vec![]),
+ last_chunk_received: Cell::new(last_chunk_received),
}
}
@@ -45,4 +49,12 @@ impl ServoParser {
Some(pending_input.remove(0))
}
}
+
+ pub fn last_chunk_received(&self) -> bool {
+ self.last_chunk_received.get()
+ }
+
+ pub fn mark_last_chunk_received(&self) {
+ self.last_chunk_received.set(true)
+ }
}