aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2023-05-20 17:14:45 -0400
committerJosh Matthews <josh@joshmatthews.net>2023-05-20 17:14:45 -0400
commit02a280dbe1f545a20500235842038851260b03d2 (patch)
treef518c33453c9b268c03a864b8d373106a25314b7 /components/script/script_thread.rs
parent864e072d5cd86c798349a69cbd9a352bd122aa73 (diff)
downloadservo-02a280dbe1f545a20500235842038851260b03d2.tar.gz
servo-02a280dbe1f545a20500235842038851260b03d2.zip
Enter realms when processing pre-sequential events.
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r--components/script/script_thread.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index fad1c7f7877..325944d33c2 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -1473,6 +1473,12 @@ impl ScriptThread {
let mut mouse_move_event_index = None;
let mut animation_ticks = HashSet::new();
loop {
+ let pipeline_id = self.message_to_pipeline(&event);
+ let _realm = pipeline_id.map(|id| {
+ let global = self.documents.borrow().find_global(id);
+ global.map(|global| enter_realm(&*global))
+ });
+
// https://html.spec.whatwg.org/multipage/#event-loop-processing-model step 7
match event {
// This has to be handled before the ResizeMsg below,
@@ -1764,7 +1770,9 @@ impl ScriptThread {
MixedMessage::FromConstellation(ref inner_msg) => match *inner_msg {
StopDelayingLoadEventsMode(id) => Some(id),
NavigationResponse(id, _) => Some(id),
- AttachLayout(ref new_layout_info) => Some(new_layout_info.new_pipeline_id),
+ AttachLayout(ref new_layout_info) => new_layout_info
+ .parent_info
+ .or(Some(new_layout_info.new_pipeline_id)),
Resize(id, ..) => Some(id),
ResizeInactive(id, ..) => Some(id),
UnloadDocument(id) => Some(id),