aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_task.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r--components/script/script_task.rs37
1 files changed, 28 insertions, 9 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index e5463285200..a891455c0de 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -28,7 +28,7 @@ use dom::bindings::js::{JS, JSRef, Temporary, OptionalRootable, RootedReference}
use dom::bindings::js::{RootCollection, RootCollectionPtr, Unrooted};
use dom::bindings::refcounted::{LiveDOMReferences, Trusted, TrustedReference};
use dom::bindings::structuredclone::StructuredCloneData;
-use dom::bindings::trace::JSTraceable;
+use dom::bindings::trace::{JSTraceable, trace_collections};
use dom::bindings::utils::{wrap_for_same_compartment, pre_wrap};
use dom::document::{Document, IsHTMLDocument, DocumentHelpers, DocumentProgressHandler, DocumentProgressTask, DocumentSource};
use dom::element::{Element, AttributeHandlers};
@@ -461,6 +461,10 @@ impl ScriptTask {
!ptr.is_null()
});
+
+ unsafe {
+ JS_SetExtraGCRootsTracer((*js_runtime).ptr, Some(trace_collections), ptr::null_mut());
+ }
// Unconstrain the runtime's threshold on nominal heap size, to avoid
// triggering GC too often if operating continuously near an arbitrary
// finite threshold. This leaves the maximum-JS_malloc-bytes threshold
@@ -494,7 +498,7 @@ impl ScriptTask {
}
// Return the root page in the frame tree. Panics if it doesn't exist.
- fn root_page(&self) -> Rc<Page> {
+ pub fn root_page(&self) -> Rc<Page> {
self.page.borrow().as_ref().unwrap().clone()
}
@@ -574,13 +578,15 @@ impl ScriptTask {
}
};
- // Squash any pending resize and reflow events in the queue.
+ // Squash any pending resize, reflow, and mouse-move events in the queue.
+ let mut mouse_move_event_index = None;
loop {
match event {
// This has to be handled before the ResizeMsg below,
// otherwise the page may not have been added to the
// child list yet, causing the find() to fail.
- MixedMessage::FromConstellation(ConstellationControlMsg::AttachLayout(new_layout_info)) => {
+ MixedMessage::FromConstellation(ConstellationControlMsg::AttachLayout(
+ new_layout_info)) => {
self.handle_new_layout(new_layout_info);
}
MixedMessage::FromConstellation(ConstellationControlMsg::Resize(id, size)) => {
@@ -589,6 +595,19 @@ impl ScriptTask {
MixedMessage::FromConstellation(ConstellationControlMsg::Viewport(id, rect)) => {
self.handle_viewport(id, rect);
}
+ MixedMessage::FromConstellation(ConstellationControlMsg::SendEvent(
+ _,
+ MouseMoveEvent(_))) => {
+ match mouse_move_event_index {
+ None => {
+ mouse_move_event_index = Some(sequential.len());
+ sequential.push(event);
+ }
+ Some(index) => {
+ sequential[index] = event
+ }
+ }
+ }
_ => {
sequential.push(event);
}
@@ -846,7 +865,7 @@ impl ScriptTask {
}
/// Handles a notification that reflow completed.
- fn handle_reflow_complete_msg(&self, pipeline_id: PipelineId, reflow_id: uint) {
+ fn handle_reflow_complete_msg(&self, pipeline_id: PipelineId, reflow_id: u32) {
debug!("Script: Reflow {:?} complete for {:?}", reflow_id, pipeline_id);
let page = self.root_page();
let page = page.find(pipeline_id).expect(
@@ -1070,7 +1089,7 @@ impl ScriptTask {
window: JS::from_rooted(window.r()),
}));
- let is_javascript = incomplete.url.scheme.as_slice() == "javascript";
+ let is_javascript = incomplete.url.scheme == "javascript";
let parse_input = if is_javascript {
let evalstr = incomplete.url.non_relative_scheme_data().unwrap();
let jsval = window.r().evaluate_js_on_global_with_result(evalstr);
@@ -1097,7 +1116,7 @@ impl ScriptTask {
// https://html.spec.whatwg.org/multipage/#the-end step 4
let addr: Trusted<Document> = Trusted::new(self.get_cx(), document.r(), self.chan.clone());
- let handler = Box::new(DocumentProgressHandler::new(addr.clone(), DocumentProgressTask::DOMContentLoaded));
+ let handler = box DocumentProgressHandler::new(addr.clone(), DocumentProgressTask::DOMContentLoaded);
self.chan.send(ScriptMsg::RunnableMsg(handler)).unwrap();
// We have no concept of a document loader right now, so just dispatch the
@@ -1105,7 +1124,7 @@ impl ScriptTask {
// the initial load.
// https://html.spec.whatwg.org/multipage/#the-end step 7
- let handler = Box::new(DocumentProgressHandler::new(addr, DocumentProgressTask::Load));
+ let handler = box DocumentProgressHandler::new(addr, DocumentProgressTask::Load);
self.chan.send(ScriptMsg::RunnableMsg(handler)).unwrap();
window.r().set_fragment_name(final_url.fragment.clone());
@@ -1301,7 +1320,7 @@ impl ScriptTask {
let resource_task = self.resource_task.clone();
spawn_named(format!("fetch for {:?}", load_data.url.serialize()), move || {
- if load_data.url.scheme.as_slice() == "javascript" {
+ if load_data.url.scheme == "javascript" {
load_data.url = Url::parse("about:blank").unwrap();
}