aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/htmldetailselement.rs3
-rw-r--r--components/script/dom/htmlformelement.rs3
-rw-r--r--components/script/dom/htmlimageelement.rs3
-rw-r--r--components/script/dom/htmlmediaelement.rs11
-rw-r--r--components/script/dom/storage.rs11
-rw-r--r--components/script/script_thread.rs5
-rw-r--r--components/script/task_source/dom_manipulation.rs6
-rw-r--r--components/script/task_source/mod.rs6
-rw-r--r--components/script/task_source/user_interaction.rs4
9 files changed, 25 insertions, 27 deletions
diff --git a/components/script/dom/htmldetailselement.rs b/components/script/dom/htmldetailselement.rs
index 61f02d0899f..9a7cf6e13f8 100644
--- a/components/script/dom/htmldetailselement.rs
+++ b/components/script/dom/htmldetailselement.rs
@@ -5,7 +5,6 @@
use dom::attr::Attr;
use dom::bindings::codegen::Bindings::HTMLDetailsElementBinding;
use dom::bindings::codegen::Bindings::HTMLDetailsElementBinding::HTMLDetailsElementMethods;
-use dom::bindings::global::GlobalRef;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root;
use dom::bindings::refcounted::Trusted;
@@ -79,7 +78,7 @@ impl VirtualMethods for HTMLDetailsElement {
element: details,
toggle_number: counter
};
- let _ = task_source.queue(runnable, GlobalRef::Window(&window));
+ let _ = task_source.queue(runnable, window.upcast());
}
}
}
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs
index 58454eed0dc..e1c53a41e12 100644
--- a/components/script/dom/htmlformelement.rs
+++ b/components/script/dom/htmlformelement.rs
@@ -12,7 +12,6 @@ use dom::bindings::codegen::Bindings::HTMLFormElementBinding::HTMLFormElementMet
use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods;
use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaElementMethods;
use dom::bindings::conversions::DerivedFrom;
-use dom::bindings::global::GlobalRef;
use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::refcounted::Trusted;
@@ -444,7 +443,7 @@ impl HTMLFormElement {
};
// Step 3
- window.dom_manipulation_task_source().queue(nav, GlobalRef::Window(&window)).unwrap();
+ window.dom_manipulation_task_source().queue(nav, window.upcast()).unwrap();
}
/// Interactively validate the constraints of form elements
diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs
index 489a6821824..428cfb97343 100644
--- a/components/script/dom/htmlimageelement.rs
+++ b/components/script/dom/htmlimageelement.rs
@@ -9,7 +9,6 @@ use dom::bindings::codegen::Bindings::HTMLImageElementBinding;
use dom::bindings::codegen::Bindings::HTMLImageElementBinding::HTMLImageElementMethods;
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::error::Fallible;
-use dom::bindings::global::GlobalRef;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{LayoutJS, Root};
use dom::bindings::refcounted::Trusted;
@@ -192,7 +191,7 @@ impl HTMLImageElement {
src: src.into(),
};
let task = window.dom_manipulation_task_source();
- let _ = task.queue(runnable, GlobalRef::Window(window));
+ let _ = task.queue(runnable, window.upcast());
}
}
}
diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs
index 24ae7542880..31140185ce2 100644
--- a/components/script/dom/htmlmediaelement.rs
+++ b/components/script/dom/htmlmediaelement.rs
@@ -12,7 +12,6 @@ use dom::bindings::codegen::Bindings::HTMLMediaElementBinding::HTMLMediaElementC
use dom::bindings::codegen::Bindings::HTMLMediaElementBinding::HTMLMediaElementMethods;
use dom::bindings::codegen::Bindings::MediaErrorBinding::MediaErrorConstants::*;
use dom::bindings::codegen::Bindings::MediaErrorBinding::MediaErrorMethods;
-use dom::bindings::global::GlobalRef;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{Root, MutNullableHeap, JS};
use dom::bindings::refcounted::Trusted;
@@ -276,7 +275,7 @@ impl HTMLMediaElement {
elem: Trusted::new(self),
};
let win = window_from_node(self);
- let _ = win.dom_manipulation_task_source().queue(task, GlobalRef::Window(&win));
+ let _ = win.dom_manipulation_task_source().queue(task, win.upcast());
}
// https://html.spec.whatwg.org/multipage/#internal-pause-steps step 2.2
@@ -300,13 +299,13 @@ impl HTMLMediaElement {
elem: Trusted::new(self),
};
let win = window_from_node(self);
- let _ = win.dom_manipulation_task_source().queue(task, GlobalRef::Window(&win));
+ let _ = win.dom_manipulation_task_source().queue(task, win.upcast());
}
fn queue_fire_simple_event(&self, type_: &'static str) {
let win = window_from_node(self);
let task = box FireSimpleEventTask::new(self, type_);
- let _ = win.dom_manipulation_task_source().queue(task, GlobalRef::Window(&win));
+ let _ = win.dom_manipulation_task_source().queue(task, win.upcast());
}
fn fire_simple_event(&self, type_: &str) {
@@ -533,8 +532,8 @@ impl HTMLMediaElement {
fn queue_dedicated_media_source_failure_steps(&self) {
let window = window_from_node(self);
- let _ = window.dom_manipulation_task_source().queue(box DedicatedMediaSourceFailureTask::new(self),
- GlobalRef::Window(&window));
+ let _ = window.dom_manipulation_task_source().queue(
+ box DedicatedMediaSourceFailureTask::new(self), window.upcast());
}
// https://html.spec.whatwg.org/multipage/#dedicated-media-source-failure-steps
diff --git a/components/script/dom/storage.rs b/components/script/dom/storage.rs
index f19ac5ebbb6..83d9ab4bf61 100644
--- a/components/script/dom/storage.rs
+++ b/components/script/dom/storage.rs
@@ -150,13 +150,14 @@ impl Storage {
/// https://html.spec.whatwg.org/multipage/#send-a-storage-notification
fn broadcast_change_notification(&self, key: Option<String>, old_value: Option<String>,
new_value: Option<String>) {
- let global_root = self.global();
- let global_ref = global_root.r();
- let window = global_ref.as_global_scope().as_window();
+ let global = self.global_scope();
+ let window = global.as_window();
let task_source = window.dom_manipulation_task_source();
let trusted_storage = Trusted::new(self);
- task_source.queue(box StorageEventRunnable::new(trusted_storage, key, old_value, new_value),
- global_ref).unwrap();
+ task_source
+ .queue(
+ box StorageEventRunnable::new(trusted_storage, key, old_value, new_value), &global)
+ .unwrap();
}
}
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index bbdc766cea4..b495cbadd06 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -1192,7 +1192,7 @@ impl ScriptThread {
// https://html.spec.whatwg.org/multipage/#the-end step 7
let handler = box DocumentProgressHandler::new(Trusted::new(doc));
- self.dom_manipulation_task_source.queue(handler, GlobalRef::Window(doc.window())).unwrap();
+ self.dom_manipulation_task_source.queue(handler, doc.window().upcast()).unwrap();
if let Some(fragment) = doc.url().fragment() {
self.check_and_scroll_fragment(fragment, pipeline, doc);
@@ -2183,7 +2183,8 @@ impl ScriptThread {
pub fn flush_promise_jobs(global: GlobalRef) {
SCRIPT_THREAD_ROOT.with(|root| {
let script_thread = unsafe { &*root.get().unwrap() };
- let _ = script_thread.dom_manipulation_task_source.queue(box FlushPromiseJobs, global);
+ let _ = script_thread.dom_manipulation_task_source.queue(
+ box FlushPromiseJobs, global.as_global_scope());
})
}
diff --git a/components/script/task_source/dom_manipulation.rs b/components/script/task_source/dom_manipulation.rs
index 4f5384ae2ed..c5b4e4b5f73 100644
--- a/components/script/task_source/dom_manipulation.rs
+++ b/components/script/task_source/dom_manipulation.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-use dom::bindings::global::GlobalRef;
+use dom::bindings::inheritance::Castable;
use dom::bindings::refcounted::Trusted;
use dom::event::{EventBubbles, EventCancelable, EventRunnable, SimpleEventRunnable};
use dom::eventtarget::EventTarget;
@@ -41,7 +41,7 @@ impl DOMManipulationTaskSource {
bubbles: bubbles,
cancelable: cancelable,
};
- let _ = self.queue(runnable, GlobalRef::Window(window));
+ let _ = self.queue(runnable, window.upcast());
}
pub fn queue_simple_event(&self, target: &EventTarget, name: Atom, window: &Window) {
@@ -50,7 +50,7 @@ impl DOMManipulationTaskSource {
target: target,
name: name,
};
- let _ = self.queue(runnable, GlobalRef::Window(window));
+ let _ = self.queue(runnable, window.upcast());
}
}
diff --git a/components/script/task_source/mod.rs b/components/script/task_source/mod.rs
index bddc4f82173..6e2a9985fa0 100644
--- a/components/script/task_source/mod.rs
+++ b/components/script/task_source/mod.rs
@@ -8,7 +8,7 @@ pub mod history_traversal;
pub mod networking;
pub mod user_interaction;
-use dom::bindings::global::GlobalRef;
+use dom::globalscope::GlobalScope;
use script_thread::{Runnable, RunnableWrapper};
use std::result::Result;
@@ -18,7 +18,7 @@ pub trait TaskSource {
wrapper: &RunnableWrapper)
-> Result<(), ()>
where T: Runnable + Send + 'static;
- fn queue<T: Runnable + Send + 'static>(&self, msg: Box<T>, global: GlobalRef) -> Result<(), ()> {
- self.queue_with_wrapper(msg, &global.as_global_scope().get_runnable_wrapper())
+ fn queue<T: Runnable + Send + 'static>(&self, msg: Box<T>, global: &GlobalScope) -> Result<(), ()> {
+ self.queue_with_wrapper(msg, &global.get_runnable_wrapper())
}
}
diff --git a/components/script/task_source/user_interaction.rs b/components/script/task_source/user_interaction.rs
index cddafb80ee4..d3850e9f813 100644
--- a/components/script/task_source/user_interaction.rs
+++ b/components/script/task_source/user_interaction.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-use dom::bindings::global::GlobalRef;
+use dom::bindings::inheritance::Castable;
use dom::bindings::refcounted::Trusted;
use dom::event::{EventBubbles, EventCancelable, EventRunnable};
use dom::eventtarget::EventTarget;
@@ -41,7 +41,7 @@ impl UserInteractionTaskSource {
bubbles: bubbles,
cancelable: cancelable,
};
- let _ = self.queue(runnable, GlobalRef::Window(window));
+ let _ = self.queue(runnable, window.upcast());
}
}