aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2025-04-04 21:39:38 +0200
committerGitHub <noreply@github.com>2025-04-04 19:39:38 +0000
commit5a35e1faec941b02291b33d10cd2f516e0464f01 (patch)
treee055335fd519e867079e3e6cfe9e2a620b182060 /components/script/dom
parentc7a7862574b4fca62bed35d958f0f363f0b6ab3f (diff)
downloadservo-5a35e1faec941b02291b33d10cd2f516e0464f01.tar.gz
servo-5a35e1faec941b02291b33d10cd2f516e0464f01.zip
constellation: Rename messages sent to the `Constellation` (#36341)
Messages that are sent to the `Constellation` have pretty ambiguous names. This change does two renames: - `ConstellationMsg` → `EmbedderToConstellationMessage` - `ScriptMsg` → `ScriptToConstellationMessage` This naming reflects that the `Constellation` stands in between the embedding layer and the script layer and can receive messages from both. Soon both of these message types will live in `constellation_traits`, reflecting the idea that the `_traits` variant for a crate is responsible for exposing the API for that crate. Testing: No new tests are necessary here as this just renames two enums. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/dissimilaroriginwindow.rs4
-rw-r--r--components/script/dom/document.rs36
-rw-r--r--components/script/dom/globalscope.rs85
-rw-r--r--components/script/dom/history.rs11
-rw-r--r--components/script/dom/htmlcanvaselement.rs4
-rw-r--r--components/script/dom/htmliframeelement.rs10
-rw-r--r--components/script/dom/mediasession.rs7
-rw-r--r--components/script/dom/serviceworker.rs12
-rw-r--r--components/script/dom/serviceworkercontainer.rs6
-rw-r--r--components/script/dom/servointernals.rs4
-rw-r--r--components/script/dom/storage.rs6
-rw-r--r--components/script/dom/webgpu/gpu.rs4
-rw-r--r--components/script/dom/window.rs18
-rw-r--r--components/script/dom/windowproxy.rs8
-rw-r--r--components/script/dom/workletglobalscope.rs4
15 files changed, 113 insertions, 106 deletions
diff --git a/components/script/dom/dissimilaroriginwindow.rs b/components/script/dom/dissimilaroriginwindow.rs
index e360e98e4c5..e5258daf2c1 100644
--- a/components/script/dom/dissimilaroriginwindow.rs
+++ b/components/script/dom/dissimilaroriginwindow.rs
@@ -7,7 +7,7 @@ use dom_struct::dom_struct;
use js::jsapi::{Heap, JSObject};
use js::jsval::UndefinedValue;
use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue, MutableHandleValue};
-use script_traits::{ScriptMsg, StructuredSerializedData};
+use script_traits::{ScriptToConstellationMessage, StructuredSerializedData};
use servo_url::ServoUrl;
use crate::dom::bindings::codegen::Bindings::DissimilarOriginWindowBinding;
@@ -236,7 +236,7 @@ impl DissimilarOriginWindow {
Err(_) => return Err(Error::Syntax),
},
};
- let msg = ScriptMsg::PostMessage {
+ let msg = ScriptToConstellationMessage::PostMessage {
target,
source: incumbent.pipeline_id(),
source_origin,
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index ba4befe6fc3..e7cd9521de2 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -54,7 +54,8 @@ use profile_traits::time::TimerMetadataFrameType;
use script_bindings::interfaces::DocumentHelpers;
use script_layout_interface::{PendingRestyle, TrustedNodeAddress};
use script_traits::{
- AnimationState, ConstellationInputEvent, DocumentActivity, ProgressiveWebMetricType, ScriptMsg,
+ AnimationState, ConstellationInputEvent, DocumentActivity, ProgressiveWebMetricType,
+ ScriptToConstellationMessage,
};
use servo_arc::Arc;
use servo_config::pref;
@@ -1178,7 +1179,8 @@ impl Document {
// Update the focus state for all elements in the focus chain.
// https://html.spec.whatwg.org/multipage/#focus-chain
if focus_type == FocusType::Element {
- self.window().send_to_constellation(ScriptMsg::Focus);
+ self.window()
+ .send_to_constellation(ScriptToConstellationMessage::Focus);
}
// Notify the embedder to display an input method.
@@ -1223,10 +1225,11 @@ impl Document {
if self.browsing_context().is_some() {
self.send_title_to_embedder();
let title = String::from(self.Title());
- self.window.send_to_constellation(ScriptMsg::TitleChanged(
- self.window.pipeline_id(),
- title.clone(),
- ));
+ self.window
+ .send_to_constellation(ScriptToConstellationMessage::TitleChanged(
+ self.window.pipeline_id(),
+ title.clone(),
+ ));
if let Some(chan) = self.window.as_global_scope().devtools_chan() {
let _ = chan.send(ScriptToDevtoolsControlMsg::TitleChanged(
self.window.pipeline_id(),
@@ -1665,7 +1668,7 @@ impl Document {
ClipboardEventType::Paste => {
let (sender, receiver) = ipc::channel().unwrap();
self.window
- .send_to_constellation(ScriptMsg::ForwardToEmbedder(
+ .send_to_constellation(ScriptToConstellationMessage::ForwardToEmbedder(
EmbedderMsg::GetClipboardText(self.window.webview_id(), sender),
));
let text_contents = receiver
@@ -2343,8 +2346,9 @@ impl Document {
// This reduces CPU usage by avoiding needless thread wakeups in the common case of
// repeated rAF.
- let event =
- ScriptMsg::ChangeRunningAnimationsState(AnimationState::AnimationCallbacksPresent);
+ let event = ScriptToConstellationMessage::ChangeRunningAnimationsState(
+ AnimationState::AnimationCallbacksPresent,
+ );
self.window().send_to_constellation(event);
}
@@ -2439,7 +2443,7 @@ impl Document {
// to expliclty trigger a OneshotTimerCallback for these queued callbacks.
self.schedule_fake_animation_frame();
}
- let event = ScriptMsg::ChangeRunningAnimationsState(
+ let event = ScriptToConstellationMessage::ChangeRunningAnimationsState(
AnimationState::NoAnimationCallbacksPresent,
);
self.window().send_to_constellation(event);
@@ -2448,10 +2452,11 @@ impl Document {
// If we were previously faking animation frames, we need to re-enable video refresh
// callbacks when we stop seeing spurious animation frames.
if was_faking_animation_frames && !self.is_faking_animation_frames() && !is_empty {
- self.window()
- .send_to_constellation(ScriptMsg::ChangeRunningAnimationsState(
+ self.window().send_to_constellation(
+ ScriptToConstellationMessage::ChangeRunningAnimationsState(
AnimationState::AnimationCallbacksPresent,
- ));
+ ),
+ );
}
}
@@ -2690,7 +2695,7 @@ impl Document {
if !self.salvageable.get() {
// Step 1 of clean-up steps.
global_scope.close_event_sources();
- let msg = ScriptMsg::DiscardDocument;
+ let msg = ScriptToConstellationMessage::DiscardDocument;
let _ = global_scope.script_to_constellation_chan().send(msg);
}
// https://w3c.github.io/FileAPI/#lifeTime
@@ -3064,7 +3069,8 @@ impl Document {
}
pub(crate) fn notify_constellation_load(&self) {
- self.window().send_to_constellation(ScriptMsg::LoadComplete);
+ self.window()
+ .send_to_constellation(ScriptToConstellationMessage::LoadComplete);
}
pub(crate) fn set_current_parser(&self, script: Option<&ServoParser>) {
diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs
index 6d5712291ac..a3f4f929ef8 100644
--- a/components/script/dom/globalscope.rs
+++ b/components/script/dom/globalscope.rs
@@ -58,7 +58,8 @@ use script_bindings::interfaces::GlobalScopeHelpers;
use script_traits::serializable::{BlobData, BlobImpl, FileBlob};
use script_traits::transferable::MessagePortImpl;
use script_traits::{
- BroadcastMsg, MessagePortMsg, PortMessageTask, ScriptMsg, ScriptToConstellationChan,
+ BroadcastMsg, MessagePortMsg, PortMessageTask, ScriptToConstellationChan,
+ ScriptToConstellationMessage,
};
use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
use timers::{TimerEventId, TimerEventRequest, TimerSource};
@@ -526,7 +527,7 @@ impl MessageListener {
// If not managing any ports, no transfer can succeed,
// so just send back everything.
let _ = global.script_to_constellation_chan().send(
- ScriptMsg::MessagePortTransferResult(None, vec![], ports),
+ ScriptToConstellationMessage::MessagePortTransferResult(None, vec![], ports),
);
return;
}
@@ -544,7 +545,7 @@ impl MessageListener {
}
}
let _ = global.script_to_constellation_chan().send(
- ScriptMsg::MessagePortTransferResult(Some(router_id), succeeded, failed),
+ ScriptToConstellationMessage::MessagePortTransferResult(Some(router_id), succeeded, failed),
);
})
);
@@ -916,9 +917,9 @@ impl GlobalScope {
if let MessagePortState::Managed(router_id, _message_ports) =
&*self.message_port_state.borrow()
{
- let _ = self
- .script_to_constellation_chan()
- .send(ScriptMsg::RemoveMessagePortRouter(*router_id));
+ let _ = self.script_to_constellation_chan().send(
+ ScriptToConstellationMessage::RemoveMessagePortRouter(*router_id),
+ );
}
*self.message_port_state.borrow_mut() = MessagePortState::UnManaged;
}
@@ -929,12 +930,12 @@ impl GlobalScope {
if let BroadcastChannelState::Managed(router_id, _channels) =
&*self.broadcast_channel_state.borrow()
{
- let _ =
- self.script_to_constellation_chan()
- .send(ScriptMsg::RemoveBroadcastChannelRouter(
- *router_id,
- self.origin().immutable().clone(),
- ));
+ let _ = self.script_to_constellation_chan().send(
+ ScriptToConstellationMessage::RemoveBroadcastChannelRouter(
+ *router_id,
+ self.origin().immutable().clone(),
+ ),
+ );
}
*self.broadcast_channel_state.borrow_mut() = BroadcastChannelState::UnManaged;
}
@@ -965,7 +966,7 @@ impl GlobalScope {
let _ = self
.script_to_constellation_chan()
- .send(ScriptMsg::EntanglePorts(port1, port2));
+ .send(ScriptToConstellationMessage::EntanglePorts(port1, port2));
}
/// Note that the entangled port of `port_id` has been removed in another global.
@@ -997,7 +998,7 @@ impl GlobalScope {
port_impl.set_has_been_shipped();
let _ = self
.script_to_constellation_chan()
- .send(ScriptMsg::MessagePortShipped(*port_id));
+ .send(ScriptToConstellationMessage::MessagePortShipped(*port_id));
port_impl
} else {
panic!("mark_port_as_transferred called on a global not managing any ports.");
@@ -1093,9 +1094,9 @@ impl GlobalScope {
/// If we don't know about the port,
/// send the message to the constellation for routing.
fn re_route_port_task(&self, port_id: MessagePortId, task: PortMessageTask) {
- let _ = self
- .script_to_constellation_chan()
- .send(ScriptMsg::RerouteMessagePort(port_id, task));
+ let _ = self.script_to_constellation_chan().send(
+ ScriptToConstellationMessage::RerouteMessagePort(port_id, task),
+ );
}
/// <https://html.spec.whatwg.org/multipage/#dom-broadcastchannel-postmessage>
@@ -1111,9 +1112,9 @@ impl GlobalScope {
//
// Note: for globals in the same script-thread,
// we could skip the hop to the constellation.
- let _ = self
- .script_to_constellation_chan()
- .send(ScriptMsg::ScheduleBroadcast(*router_id, msg));
+ let _ = self.script_to_constellation_chan().send(
+ ScriptToConstellationMessage::ScheduleBroadcast(*router_id, msg),
+ );
} else {
panic!("Attemps to broadcast a message via global not managing any channels.");
}
@@ -1286,12 +1287,9 @@ impl GlobalScope {
}
managed_port.pending = false;
}
- let _ =
- self.script_to_constellation_chan()
- .send(ScriptMsg::CompleteMessagePortTransfer(
- *router_id,
- to_be_added,
- ));
+ let _ = self.script_to_constellation_chan().send(
+ ScriptToConstellationMessage::CompleteMessagePortTransfer(*router_id, to_be_added),
+ );
} else {
warn!("maybe_add_pending_ports called on a global not managing any ports.");
}
@@ -1310,7 +1308,7 @@ impl GlobalScope {
// and to forward this message to the script-process where the entangled is found.
let _ = self
.script_to_constellation_chan()
- .send(ScriptMsg::RemoveMessagePort(*id));
+ .send(ScriptToConstellationMessage::RemoveMessagePort(*id));
Some(*id)
} else {
None
@@ -1340,7 +1338,7 @@ impl GlobalScope {
channels.retain(|chan| !chan.closed());
if channels.is_empty() {
let _ = self.script_to_constellation_chan().send(
- ScriptMsg::RemoveBroadcastChannelNameInRouter(
+ ScriptToConstellationMessage::RemoveBroadcastChannelNameInRouter(
*router_id,
name.to_string(),
self.origin().immutable().clone(),
@@ -1382,19 +1380,19 @@ impl GlobalScope {
);
let router_id = BroadcastChannelRouterId::new();
*current_state = BroadcastChannelState::Managed(router_id, HashMap::new());
- let _ = self
- .script_to_constellation_chan()
- .send(ScriptMsg::NewBroadcastChannelRouter(
+ let _ = self.script_to_constellation_chan().send(
+ ScriptToConstellationMessage::NewBroadcastChannelRouter(
router_id,
broadcast_control_sender,
self.origin().immutable().clone(),
- ));
+ ),
+ );
}
if let BroadcastChannelState::Managed(router_id, channels) = &mut *current_state {
let entry = channels.entry(dom_channel.Name()).or_insert_with(|| {
let _ = self.script_to_constellation_chan().send(
- ScriptMsg::NewBroadcastChannelNameInRouter(
+ ScriptToConstellationMessage::NewBroadcastChannelNameInRouter(
*router_id,
dom_channel.Name().to_string(),
self.origin().immutable().clone(),
@@ -1434,12 +1432,9 @@ impl GlobalScope {
);
let router_id = MessagePortRouterId::new();
*current_state = MessagePortState::Managed(router_id, HashMapTracedValues::new());
- let _ = self
- .script_to_constellation_chan()
- .send(ScriptMsg::NewMessagePortRouter(
- router_id,
- port_control_sender,
- ));
+ let _ = self.script_to_constellation_chan().send(
+ ScriptToConstellationMessage::NewMessagePortRouter(router_id, port_control_sender),
+ );
}
if let MessagePortState::Managed(router_id, message_ports) = &mut *current_state {
@@ -1478,12 +1473,12 @@ impl GlobalScope {
closed: false,
},
);
- let _ = self
- .script_to_constellation_chan()
- .send(ScriptMsg::NewMessagePort(
+ let _ = self.script_to_constellation_chan().send(
+ ScriptToConstellationMessage::NewMessagePort(
*router_id,
*dom_port.message_port_id(),
- ));
+ ),
+ );
};
} else {
panic!("track_message_port should have first switched the state to managed.");
@@ -2229,10 +2224,10 @@ impl GlobalScope {
}
pub(crate) fn send_to_embedder(&self, msg: EmbedderMsg) {
- self.send_to_constellation(ScriptMsg::ForwardToEmbedder(msg));
+ self.send_to_constellation(ScriptToConstellationMessage::ForwardToEmbedder(msg));
}
- pub(crate) fn send_to_constellation(&self, msg: ScriptMsg) {
+ pub(crate) fn send_to_constellation(&self, msg: ScriptToConstellationMessage) {
self.script_to_constellation_chan().send(msg).unwrap();
}
diff --git a/components/script/dom/history.rs b/components/script/dom/history.rs
index b4b6e44890f..316e9c86690 100644
--- a/components/script/dom/history.rs
+++ b/components/script/dom/history.rs
@@ -14,7 +14,7 @@ use js::rust::{HandleValue, MutableHandleValue};
use net_traits::{CoreResourceMsg, IpcSend};
use profile_traits::ipc;
use profile_traits::ipc::channel;
-use script_traits::{ScriptMsg, StructuredSerializedData};
+use script_traits::{ScriptToConstellationMessage, StructuredSerializedData};
use servo_url::ServoUrl;
use crate::dom::bindings::codegen::Bindings::HistoryBinding::HistoryMethods;
@@ -72,7 +72,7 @@ impl History {
if !self.window.Document().is_fully_active() {
return Err(Error::Security);
}
- let msg = ScriptMsg::TraverseHistory(direction);
+ let msg = ScriptToConstellationMessage::TraverseHistory(direction);
let _ = self
.window
.as_global_scope()
@@ -227,7 +227,7 @@ impl History {
PushOrReplace::Push => {
let state_id = HistoryStateId::new();
self.state_id.set(Some(state_id));
- let msg = ScriptMsg::PushHistoryState(state_id, new_url.clone());
+ let msg = ScriptToConstellationMessage::PushHistoryState(state_id, new_url.clone());
let _ = self
.window
.as_global_scope()
@@ -244,7 +244,8 @@ impl History {
state_id
},
};
- let msg = ScriptMsg::ReplaceHistoryState(state_id, new_url.clone());
+ let msg =
+ ScriptToConstellationMessage::ReplaceHistoryState(state_id, new_url.clone());
let _ = self
.window
.as_global_scope()
@@ -339,7 +340,7 @@ impl HistoryMethods<crate::DomTypeHolder> for History {
}
let (sender, recv) = channel(self.global().time_profiler_chan().clone())
.expect("Failed to create channel to send jsh length.");
- let msg = ScriptMsg::JointSessionHistoryLength(sender);
+ let msg = ScriptToConstellationMessage::JointSessionHistoryLength(sender);
let _ = self
.window
.as_global_scope()
diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs
index 7c5a5dd4725..547ee9d8ccd 100644
--- a/components/script/dom/htmlcanvaselement.rs
+++ b/components/script/dom/htmlcanvaselement.rs
@@ -21,7 +21,7 @@ use js::error::throw_type_error;
use js::rust::{HandleObject, HandleValue};
use script_layout_interface::{HTMLCanvasData, HTMLCanvasDataSource};
#[cfg(feature = "webgpu")]
-use script_traits::ScriptMsg;
+use script_traits::ScriptToConstellationMessage;
use script_traits::serializable::BlobImpl;
use servo_media::streams::MediaStreamType;
use servo_media::streams::registry::MediaStreamId;
@@ -334,7 +334,7 @@ impl HTMLCanvasElement {
let global_scope = self.owner_global();
let _ = global_scope
.script_to_constellation_chan()
- .send(ScriptMsg::GetWebGPUChan(sender));
+ .send(ScriptToConstellationMessage::GetWebGPUChan(sender));
receiver
.recv()
.expect("Failed to get WebGPU channel")
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index 9a680353ad9..bfef6cebbe6 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -15,7 +15,7 @@ use profile_traits::ipc as ProfiledIpc;
use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
use script_traits::{
IFrameLoadInfo, IFrameLoadInfoWithData, JsEvalResult, LoadData, LoadOrigin,
- NavigationHistoryBehavior, NewLayoutInfo, ScriptMsg, UpdatePipelineIdReason,
+ NavigationHistoryBehavior, NewLayoutInfo, ScriptToConstellationMessage, UpdatePipelineIdReason,
};
use servo_url::ServoUrl;
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
@@ -217,7 +217,7 @@ impl HTMLIFrameElement {
window
.as_global_scope()
.script_to_constellation_chan()
- .send(ScriptMsg::ScriptNewIFrame(load_info))
+ .send(ScriptToConstellationMessage::ScriptNewIFrame(load_info))
.unwrap();
let new_layout_info = NewLayoutInfo {
@@ -244,7 +244,9 @@ impl HTMLIFrameElement {
window
.as_global_scope()
.script_to_constellation_chan()
- .send(ScriptMsg::ScriptLoadedURLInIFrame(load_info))
+ .send(ScriptToConstellationMessage::ScriptLoadedURLInIFrame(
+ load_info,
+ ))
.unwrap();
},
}
@@ -782,7 +784,7 @@ impl VirtualMethods for HTMLIFrameElement {
};
debug!("Unbinding frame {}.", browsing_context_id);
- let msg = ScriptMsg::RemoveIFrame(browsing_context_id, sender);
+ let msg = ScriptToConstellationMessage::RemoveIFrame(browsing_context_id, sender);
window
.as_global_scope()
.script_to_constellation_chan()
diff --git a/components/script/dom/mediasession.rs b/components/script/dom/mediasession.rs
index fe5604daf85..f54335afb60 100644
--- a/components/script/dom/mediasession.rs
+++ b/components/script/dom/mediasession.rs
@@ -8,7 +8,7 @@ use dom_struct::dom_struct;
use embedder_traits::{
MediaMetadata as EmbedderMediaMetadata, MediaSessionActionType, MediaSessionEvent,
};
-use script_traits::ScriptMsg;
+use script_traits::ScriptToConstellationMessage;
use super::bindings::trace::HashMapTracedValues;
use crate::conversions::Convert;
@@ -106,7 +106,10 @@ impl MediaSession {
let global = self.global();
let window = global.as_window();
let pipeline_id = window.pipeline_id();
- window.send_to_constellation(ScriptMsg::MediaSessionEvent(pipeline_id, event));
+ window.send_to_constellation(ScriptToConstellationMessage::MediaSessionEvent(
+ pipeline_id,
+ event,
+ ));
}
pub(crate) fn update_title(&self, title: String) {
diff --git a/components/script/dom/serviceworker.rs b/components/script/dom/serviceworker.rs
index c3d677c5111..68c995f6ce3 100644
--- a/components/script/dom/serviceworker.rs
+++ b/components/script/dom/serviceworker.rs
@@ -8,7 +8,7 @@ use base::id::ServiceWorkerId;
use dom_struct::dom_struct;
use js::jsapi::{Heap, JSObject};
use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue};
-use script_traits::{DOMMessage, ScriptMsg};
+use script_traits::{DOMMessage, ScriptToConstellationMessage};
use servo_url::ServoUrl;
use crate::dom::abstractworker::SimpleWorkerErrorHandler;
@@ -109,13 +109,9 @@ impl ServiceWorker {
origin: incumbent.origin().immutable().clone(),
data,
};
- let _ = self
- .global()
- .script_to_constellation_chan()
- .send(ScriptMsg::ForwardDOMMessage(
- msg_vec,
- self.scope_url.clone(),
- ));
+ let _ = self.global().script_to_constellation_chan().send(
+ ScriptToConstellationMessage::ForwardDOMMessage(msg_vec, self.scope_url.clone()),
+ );
Ok(())
}
}
diff --git a/components/script/dom/serviceworkercontainer.rs b/components/script/dom/serviceworkercontainer.rs
index a1ef784bbad..b532714ec1a 100644
--- a/components/script/dom/serviceworkercontainer.rs
+++ b/components/script/dom/serviceworkercontainer.rs
@@ -8,7 +8,9 @@ use std::rc::Rc;
use dom_struct::dom_struct;
use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
-use script_traits::{Job, JobError, JobResult, JobResultValue, JobType, ScriptMsg};
+use script_traits::{
+ Job, JobError, JobResult, JobResultValue, JobType, ScriptToConstellationMessage,
+};
use crate::dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::{
RegistrationOptions, ServiceWorkerContainerMethods,
@@ -179,7 +181,7 @@ impl ServiceWorkerContainerMethods<crate::DomTypeHolder> for ServiceWorkerContai
// B: Step 14: schedule job.
let _ = global
.script_to_constellation_chan()
- .send(ScriptMsg::ScheduleJob(job));
+ .send(ScriptToConstellationMessage::ScheduleJob(job));
// A: Step 7
promise
diff --git a/components/script/dom/servointernals.rs b/components/script/dom/servointernals.rs
index 58d749d8227..87c0d246e6f 100644
--- a/components/script/dom/servointernals.rs
+++ b/components/script/dom/servointernals.rs
@@ -9,7 +9,7 @@ use js::rust::HandleObject;
use profile_traits::mem::MemoryReportResult;
use script_bindings::interfaces::ServoInternalsHelpers;
use script_bindings::script_runtime::JSContext;
-use script_traits::ScriptMsg;
+use script_traits::ScriptToConstellationMessage;
use crate::dom::bindings::codegen::Bindings::ServoInternalsBinding::ServoInternalsMethods;
use crate::dom::bindings::error::Error;
@@ -46,7 +46,7 @@ impl ServoInternalsMethods<crate::DomTypeHolder> for ServoInternals {
let sender = route_promise(&promise, self);
let script_to_constellation_chan = global.script_to_constellation_chan();
if script_to_constellation_chan
- .send(ScriptMsg::ReportMemory(sender))
+ .send(ScriptToConstellationMessage::ReportMemory(sender))
.is_err()
{
promise.reject_error(Error::Operation, can_gc);
diff --git a/components/script/dom/storage.rs b/components/script/dom/storage.rs
index 8b155a81dd2..03b59fb6c15 100644
--- a/components/script/dom/storage.rs
+++ b/components/script/dom/storage.rs
@@ -7,7 +7,7 @@ use ipc_channel::ipc::IpcSender;
use net_traits::IpcSend;
use net_traits::storage_thread::{StorageThreadMsg, StorageType};
use profile_traits::ipc;
-use script_traits::ScriptMsg;
+use script_traits::ScriptToConstellationMessage;
use servo_url::ServoUrl;
use crate::dom::bindings::codegen::Bindings::StorageBinding::StorageMethods;
@@ -195,7 +195,9 @@ impl Storage {
) {
let storage = self.storage_type;
let url = self.get_url();
- let msg = ScriptMsg::BroadcastStorageEvent(storage, url, key, old_value, new_value);
+ let msg = ScriptToConstellationMessage::BroadcastStorageEvent(
+ storage, url, key, old_value, new_value,
+ );
self.global()
.script_to_constellation_chan()
.send(msg)
diff --git a/components/script/dom/webgpu/gpu.rs b/components/script/dom/webgpu/gpu.rs
index 2f1a8085f47..e07224c8248 100644
--- a/components/script/dom/webgpu/gpu.rs
+++ b/components/script/dom/webgpu/gpu.rs
@@ -6,7 +6,7 @@ use std::rc::Rc;
use dom_struct::dom_struct;
use js::jsapi::Heap;
-use script_traits::ScriptMsg;
+use script_traits::ScriptToConstellationMessage;
use webgpu_traits::WebGPUAdapterResponse;
use wgpu_types::PowerPreference;
@@ -66,7 +66,7 @@ impl GPUMethods<crate::DomTypeHolder> for GPU {
let script_to_constellation_chan = global.script_to_constellation_chan();
if script_to_constellation_chan
- .send(ScriptMsg::RequestAdapter(
+ .send(ScriptToConstellationMessage::RequestAdapter(
sender,
wgpu_core::instance::RequestAdapterOptions {
power_preference,
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 57c90354dba..aff9d181081 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -63,8 +63,8 @@ use script_layout_interface::{
TrustedNodeAddress, combine_id_with_fragment_type,
};
use script_traits::{
- DocumentState, LoadData, LoadOrigin, NavigationHistoryBehavior, ScriptMsg, ScriptThreadMessage,
- ScriptToConstellationChan, StructuredSerializedData,
+ DocumentState, LoadData, LoadOrigin, NavigationHistoryBehavior, ScriptThreadMessage,
+ ScriptToConstellationChan, ScriptToConstellationMessage, StructuredSerializedData,
};
use selectors::attr::CaseSensitivity;
use servo_arc::Arc as ServoArc;
@@ -904,7 +904,7 @@ impl WindowMethods<crate::DomTypeHolder> for Window {
// which calls into https://html.spec.whatwg.org/multipage/#discard-a-document.
window.discard_browsing_context();
- window.send_to_constellation(ScriptMsg::DiscardTopLevelBrowsingContext);
+ window.send_to_constellation(ScriptToConstellationMessage::DiscardTopLevelBrowsingContext);
}
});
self.as_global_scope()
@@ -2047,7 +2047,7 @@ impl Window {
.iframes_mut()
.handle_new_iframe_sizes_after_layout(results.iframe_sizes);
if !size_messages.is_empty() {
- self.send_to_constellation(ScriptMsg::IFrameSizes(size_messages));
+ self.send_to_constellation(ScriptToConstellationMessage::IFrameSizes(size_messages));
}
document
.image_animation_manager_mut()
@@ -2145,7 +2145,7 @@ impl Window {
"{:?}: Sending DocumentState::Idle to Constellation",
self.pipeline_id()
);
- let event = ScriptMsg::SetDocumentState(DocumentState::Idle);
+ let event = ScriptToConstellationMessage::SetDocumentState(DocumentState::Idle);
self.send_to_constellation(event);
self.has_sent_idle_message.set(true);
}
@@ -2227,7 +2227,7 @@ impl Window {
self.pipeline_id()
);
let (sender, receiver) = ipc::channel().expect("Failed to create IPC channel!");
- let event = ScriptMsg::SetLayoutEpoch(epoch, sender);
+ let event = ScriptToConstellationMessage::SetLayoutEpoch(epoch, sender);
self.send_to_constellation(event);
let _ = receiver.recv();
}
@@ -2445,7 +2445,7 @@ impl Window {
// Step 6
// TODO: Fragment handling appears to have moved to step 13
if let Some(fragment) = load_data.url.fragment() {
- self.send_to_constellation(ScriptMsg::NavigatedToFragment(
+ self.send_to_constellation(ScriptToConstellationMessage::NavigatedToFragment(
load_data.url.clone(),
history_handling,
));
@@ -2769,10 +2769,10 @@ impl Window {
}
pub(crate) fn send_to_embedder(&self, msg: EmbedderMsg) {
- self.send_to_constellation(ScriptMsg::ForwardToEmbedder(msg));
+ self.send_to_constellation(ScriptToConstellationMessage::ForwardToEmbedder(msg));
}
- pub(crate) fn send_to_constellation(&self, msg: ScriptMsg) {
+ pub(crate) fn send_to_constellation(&self, msg: ScriptToConstellationMessage) {
self.as_global_scope()
.script_to_constellation_chan()
.send(msg)
diff --git a/components/script/dom/windowproxy.rs b/components/script/dom/windowproxy.rs
index 4bbdf271252..feeece3a8e8 100644
--- a/components/script/dom/windowproxy.rs
+++ b/components/script/dom/windowproxy.rs
@@ -31,7 +31,7 @@ use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use net_traits::request::Referrer;
use script_traits::{
AuxiliaryWebViewCreationRequest, LoadData, LoadOrigin, NavigationHistoryBehavior,
- NewLayoutInfo, ScriptMsg,
+ NewLayoutInfo, ScriptToConstellationMessage,
};
use serde::{Deserialize, Serialize};
use servo_url::{ImmutableOrigin, ServoUrl};
@@ -314,7 +314,7 @@ impl WindowProxy {
opener_pipeline_id: self.currently_active.get().unwrap(),
response_sender,
};
- let constellation_msg = ScriptMsg::CreateAuxiliaryWebView(load_info);
+ let constellation_msg = ScriptToConstellationMessage::CreateAuxiliaryWebView(load_info);
window.send_to_constellation(constellation_msg);
let response = response_receiver.recv().unwrap()?;
@@ -863,7 +863,7 @@ unsafe fn GetSubframeWindowProxy(
let (result_sender, result_receiver) = ipc::channel().unwrap();
let _ = win.as_global_scope().script_to_constellation_chan().send(
- ScriptMsg::GetChildBrowsingContextId(
+ ScriptToConstellationMessage::GetChildBrowsingContextId(
browsing_context_id,
index as usize,
result_sender,
@@ -882,7 +882,7 @@ unsafe fn GetSubframeWindowProxy(
let (result_sender, result_receiver) = ipc::channel().unwrap();
let _ = win.global().script_to_constellation_chan().send(
- ScriptMsg::GetChildBrowsingContextId(
+ ScriptToConstellationMessage::GetChildBrowsingContextId(
browsing_context_id,
index as usize,
result_sender,
diff --git a/components/script/dom/workletglobalscope.rs b/components/script/dom/workletglobalscope.rs
index 14a4b75470b..23a3f3a6528 100644
--- a/components/script/dom/workletglobalscope.rs
+++ b/components/script/dom/workletglobalscope.rs
@@ -14,7 +14,7 @@ use js::rust::Runtime;
use net_traits::ResourceThreads;
use net_traits::image_cache::ImageCache;
use profile_traits::{mem, time};
-use script_traits::{Painter, ScriptMsg, ScriptToConstellationChan};
+use script_traits::{Painter, ScriptToConstellationChan, ScriptToConstellationMessage};
use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
use stylo_atoms::Atom;
@@ -180,7 +180,7 @@ pub(crate) struct WorkletGlobalScopeInit {
/// Channel to devtools
pub(crate) devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
/// Messages to send to constellation
- pub(crate) to_constellation_sender: IpcSender<(PipelineId, ScriptMsg)>,
+ pub(crate) to_constellation_sender: IpcSender<(PipelineId, ScriptToConstellationMessage)>,
/// The image cache
pub(crate) image_cache: Arc<dyn ImageCache>,
/// Identity manager for WebGPU resources