aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/history.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/history.rs')
-rw-r--r--components/script/dom/history.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/components/script/dom/history.rs b/components/script/dom/history.rs
index 5ced543d728..1a971eae009 100644
--- a/components/script/dom/history.rs
+++ b/components/script/dom/history.rs
@@ -6,9 +6,10 @@ use dom::bindings::codegen::Bindings::HistoryBinding;
use dom::bindings::codegen::Bindings::HistoryBinding::HistoryMethods;
use dom::bindings::codegen::Bindings::LocationBinding::LocationMethods;
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
-use dom::bindings::global::GlobalRef;
+use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, Root};
use dom::bindings::reflector::{Reflector, reflect_dom_object};
+use dom::globalscope::GlobalScope;
use dom::window::Window;
use ipc_channel::ipc;
use msg::constellation_msg::TraversalDirection;
@@ -31,26 +32,28 @@ impl History {
pub fn new(window: &Window) -> Root<History> {
reflect_dom_object(box History::new_inherited(window),
- GlobalRef::Window(window),
+ window,
HistoryBinding::Wrap)
}
}
impl History {
fn traverse_history(&self, direction: TraversalDirection) {
- let pipeline = self.window.pipeline_id();
+ let global_scope = self.window.upcast::<GlobalScope>();
+ let pipeline = global_scope.pipeline_id();
let msg = ConstellationMsg::TraverseHistory(Some(pipeline), direction);
- let _ = self.window.constellation_chan().send(msg);
+ let _ = global_scope.constellation_chan().send(msg);
}
}
impl HistoryMethods for History {
// https://html.spec.whatwg.org/multipage/#dom-history-length
fn Length(&self) -> u32 {
- let pipeline = self.window.pipeline_id();
+ let global_scope = self.window.upcast::<GlobalScope>();
+ let pipeline = global_scope.pipeline_id();
let (sender, recv) = ipc::channel().expect("Failed to create channel to send jsh length.");
let msg = ConstellationMsg::JointSessionHistoryLength(pipeline, sender);
- let _ = self.window.constellation_chan().send(msg);
+ let _ = global_scope.constellation_chan().send(msg);
recv.recv().unwrap()
}