aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/window.rs
diff options
context:
space:
mode:
authorDelan Azabani <dazabani@igalia.com>2023-03-23 18:02:35 +0800
committerDelan Azabani <dazabani@igalia.com>2023-03-23 18:02:35 +0800
commit4c7f198ee22ba5c6c1393395ceb9889d2d4decaa (patch)
tree62fec586aa5f9c0cfcf173af6d299dce1ee5ccf6 /components/script/dom/window.rs
parentfd1de05592f9ba2485af81505fa244c79395f2ed (diff)
downloadservo-4c7f198ee22ba5c6c1393395ceb9889d2d4decaa.tar.gz
servo-4c7f198ee22ba5c6c1393395ceb9889d2d4decaa.zip
apply yvt/servo/fix-named-window-getter
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r--components/script/dom/window.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 76dcc79424f..64ad1d72544 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -24,7 +24,7 @@ use crate::dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementType
use crate::dom::bindings::num::Finite;
use crate::dom::bindings::refcounted::Trusted;
use crate::dom::bindings::reflector::DomObject;
-use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
+use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom, MutNullableTransplantableDom};
use crate::dom::bindings::str::{DOMString, USVString};
use crate::dom::bindings::structuredclone;
use crate::dom::bindings::trace::{JSTraceable, RootedTraceableBox};
@@ -201,7 +201,7 @@ pub struct Window {
image_cache: Arc<dyn ImageCache>,
#[ignore_malloc_size_of = "channels are hard"]
image_cache_chan: Sender<ImageCacheMsg>,
- window_proxy: MutNullableDom<WindowProxy>,
+ window_proxy: MutNullableTransplantableDom<WindowProxy>,
document: MutNullableDom<Document>,
location: MutNullableDom<Location>,
history: MutNullableDom<History>,
@@ -382,7 +382,7 @@ impl Window {
pub fn clear_js_runtime_for_script_deallocation(&self) {
unsafe {
*self.js_runtime.borrow_for_script_deallocation() = None;
- self.window_proxy.set(None);
+ self.window_proxy.set(None, &self.global().upcast());
self.current_state.set(WindowState::Zombie);
self.ignore_all_tasks();
}
@@ -1682,7 +1682,7 @@ impl Window {
let pipeline_id = self.upcast::<GlobalScope>().pipeline_id();
if let Some(currently_active) = proxy.currently_active() {
if currently_active == pipeline_id {
- self.window_proxy.set(None);
+ self.window_proxy.set(None, &self.global());
}
}
}
@@ -2190,7 +2190,7 @@ impl Window {
#[allow(unsafe_code)]
pub fn init_window_proxy(&self, window_proxy: &WindowProxy) {
assert!(self.window_proxy.get().is_none());
- self.window_proxy.set(Some(&window_proxy));
+ self.window_proxy.set(Some(&window_proxy), &self.global());
}
#[allow(unsafe_code)]
@@ -2596,7 +2596,8 @@ impl Window {
location: Default::default(),
history: Default::default(),
custom_element_registry: Default::default(),
- window_proxy: Default::default(),
+ // Safety: This field won't be assigned until it's pinned
+ window_proxy: unsafe { MutNullableTransplantableDom::new() },
document: Default::default(),
performance: Default::default(),
navigation_start: Cell::new(navigation_start),