mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Allow windows to share browsing contexts.
This commit is contained in:
parent
fc67878edf
commit
403499a9d5
11 changed files with 168 additions and 108 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue