aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/window.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r--components/script/dom/window.rs18
1 files changed, 13 insertions, 5 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 37c62543526..86957d943d9 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -50,7 +50,7 @@ use fetch;
use gfx_traits::ScrollRootId;
use ipc_channel::ipc::{self, IpcSender};
use js::jsapi::{HandleObject, HandleValue, JSAutoCompartment, JSContext};
-use js::jsapi::{JS_GC, JS_GetRuntime, SetWindowProxy};
+use js::jsapi::{JS_GC, JS_GetRuntime};
use js::jsval::UndefinedValue;
use js::rust::Runtime;
use msg::constellation_msg::{FrameType, PipelineId};
@@ -1375,10 +1375,6 @@ impl Window {
pub fn init_browsing_context(&self, browsing_context: &BrowsingContext) {
assert!(self.browsing_context.get().is_none());
self.browsing_context.set(Some(&browsing_context));
- let window = self.reflector().get_jsobject();
- let cx = self.get_cx();
- let _ac = JSAutoCompartment::new(cx, window.get());
- unsafe { SetWindowProxy(cx, window, browsing_context.reflector().get_jsobject()); }
}
#[allow(unsafe_code)]
@@ -1489,7 +1485,11 @@ impl Window {
}
pub fn suspend(&self) {
+ // Suspend timer events.
self.upcast::<GlobalScope>().suspend();
+
+ // TODO: set the window proxy to resolve to an object which throws security errors. #15233
+
// A hint to the JS runtime that now would be a good time to
// GC any unreachable objects generated by user script,
// or unattached DOM nodes. Attached DOM nodes can't be GCd yet,
@@ -1498,7 +1498,15 @@ impl Window {
}
pub fn resume(&self) {
+ // Resume timer events.
self.upcast::<GlobalScope>().resume();
+
+ // Set the window proxy to be this object.
+ self.browsing_context().set_window_proxy(&self);
+
+ // Push the document title to the compositor since we are
+ // activating this document due to a navigation.
+ self.Document().title_changed();
}
pub fn need_emit_timeline_marker(&self, timeline_type: TimelineMarkerType) -> bool {