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.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 94b6d2c7fb3..6394f01ef27 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -37,7 +37,7 @@ use gfx_traits::LayerId;
use ipc_channel::ipc::{self, IpcSender};
use js::jsapi::{Evaluate2, MutableHandleValue};
use js::jsapi::{HandleValue, JSContext};
-use js::jsapi::{JSAutoCompartment, JSAutoRequest, JS_GC, JS_GetRuntime};
+use js::jsapi::{JSAutoCompartment, JSAutoRequest, JS_GC, JS_GetRuntime, SetWindowProxy};
use js::rust::CompileOptionsWrapper;
use js::rust::Runtime;
use layout_interface::{ContentBoxResponse, ContentBoxesResponse, ResolvedStyleResponse, ScriptReflow};
@@ -1192,9 +1192,15 @@ impl Window {
self.layout_rpc.margin_style()
}
+ #[allow(unsafe_code)]
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 _ar = JSAutoRequest::new(cx);
+ let _ac = JSAutoCompartment::new(cx, window.get());
+ unsafe { SetWindowProxy(cx, window, browsing_context.reflector().get_jsobject()); }
}
/// Commence a new URL load which will either replace this window or scroll to a fragment.