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.rs35
1 files changed, 17 insertions, 18 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index ce290caabf7..6b3b51f9a79 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -8,7 +8,6 @@ use crate::dom::bindings::codegen::Bindings::DocumentBinding::{
};
use crate::dom::bindings::codegen::Bindings::HistoryBinding::HistoryBinding::HistoryMethods;
use crate::dom::bindings::codegen::Bindings::MediaQueryListBinding::MediaQueryListBinding::MediaQueryListMethods;
-use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionState;
use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestInit;
use crate::dom::bindings::codegen::Bindings::VoidFunctionBinding::VoidFunction;
use crate::dom::bindings::codegen::Bindings::WindowBinding::{
@@ -275,9 +274,6 @@ pub struct Window {
#[ignore_malloc_size_of = "defined in webxr"]
webxr_registry: webxr_api::Registry,
- /// A map for storing the previous permission state read results.
- permission_state_invocation_results: DomRefCell<HashMap<String, PermissionState>>,
-
/// All of the elements that have an outstanding image request that was
/// initiated by layout during a reflow. They are stored in the script thread
/// to ensure that the element can be marked dirty when the image data becomes
@@ -336,6 +332,8 @@ pub struct Window {
/// A mechanism to force the compositor to process events.
#[ignore_malloc_size_of = "traits are cumbersome"]
event_loop_waker: Option<Box<dyn EventLoopWaker>>,
+
+ visible: Cell<bool>,
}
impl Window {
@@ -476,12 +474,6 @@ impl Window {
Worklet::new(self, WorkletGlobalScopeType::Paint)
}
- pub fn permission_state_invocation_results(
- &self,
- ) -> &DomRefCell<HashMap<String, PermissionState>> {
- &self.permission_state_invocation_results
- }
-
pub fn pending_image_notification(&self, response: PendingImageResponse) {
//XXXjdm could be more efficient to send the responses to the layout thread,
// rather than making the layout thread talk to the image cache to
@@ -1403,10 +1395,12 @@ impl Window {
// We tear down the active document, which causes all the attached
// nodes to dispose of their layout data. This messages the layout
// thread, informing it that it can safely free the memory.
- self.Document().upcast::<Node>().teardown();
+ self.Document()
+ .upcast::<Node>()
+ .teardown(self.layout_chan());
- // Tell the constellation to drop the sender to our message-port router, if there is any.
- self.upcast::<GlobalScope>().remove_message_ports_router();
+ // Remove the infra for managing messageports and broadcast channels.
+ self.upcast::<GlobalScope>().remove_web_messaging_infra();
// Clean up any active promises
// https://github.com/servo/servo/issues/15318
@@ -1987,7 +1981,7 @@ impl Window {
.task_canceller(TaskSourceName::DOMManipulation)
.wrap_task(task),
),
- self.pipeline_id(),
+ Some(self.pipeline_id()),
TaskSourceName::DOMManipulation,
));
doc.set_url(load_data.url.clone());
@@ -2193,6 +2187,7 @@ impl Window {
/// Slow down/speed up timers based on visibility.
pub fn alter_resource_utilization(&self, visible: bool) {
+ self.visible.set(visible);
if visible {
self.upcast::<GlobalScope>().speed_up_timers();
} else {
@@ -2200,6 +2195,10 @@ impl Window {
}
}
+ pub fn visible(&self) -> bool {
+ self.visible.get()
+ }
+
pub fn unminified_js_dir(&self) -> Option<String> {
self.unminified_js_dir.borrow().clone()
}
@@ -2331,7 +2330,6 @@ impl Window {
webgl_chan,
webvr_chan,
webxr_registry,
- permission_state_invocation_results: Default::default(),
pending_layout_images: Default::default(),
unminified_js_dir: Default::default(),
test_worklet: Default::default(),
@@ -2348,13 +2346,14 @@ impl Window {
replace_surrogates,
player_context,
event_loop_waker,
+ visible: Cell::new(true),
});
unsafe { WindowBinding::Wrap(JSContext::from_ptr(runtime.cx()), win) }
}
- pub fn pipeline_id(&self) -> Option<PipelineId> {
- Some(self.upcast::<GlobalScope>().pipeline_id())
+ pub fn pipeline_id(&self) -> PipelineId {
+ self.upcast::<GlobalScope>().pipeline_id()
}
}
@@ -2485,7 +2484,7 @@ impl Window {
.task_canceller(TaskSourceName::DOMManipulation)
.wrap_task(task),
),
- self.pipeline_id(),
+ Some(self.pipeline_id()),
TaskSourceName::DOMManipulation,
));
}