constellation: Broadcast preference changes to all content processes (#38716)

Building on the preference observer work from #38649, we now
automatically install an observer when multiprocess mode is enabled.
This observer notifies the constellation of updated preferences, which
in turn notifies each content process so the changes will be reflected
into script/layout as expected. There's a unit test that verifies this
works correctly by checking a preference-gated WebIDL property before
and after the preference is toggled.

Testing: New unit test added.
Fixes: #35966

Depends on #38649.

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-08-20 02:43:16 -04:00 committed by GitHub
parent 61692b26c2
commit ed6bf196c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 191 additions and 60 deletions

View file

@ -31,6 +31,7 @@ net_traits = { workspace = true }
pixels = { path = "../../pixels" }
profile_traits = { workspace = true }
serde = { workspace = true }
servo_config = { path = "../../config" }
servo_url = { path = "../../url" }
strum = { workspace = true }
strum_macros = { workspace = true }

View file

@ -28,6 +28,7 @@ use ipc_channel::ipc::IpcSender;
use malloc_size_of_derive::MallocSizeOf;
use profile_traits::mem::MemoryReportResult;
use serde::{Deserialize, Serialize};
use servo_config::prefs::PrefValue;
use servo_url::{ImmutableOrigin, ServoUrl};
pub use structured_data::*;
use strum_macros::IntoStaticStr;
@ -102,6 +103,8 @@ pub enum EmbedderToConstellationMessage {
SendImageKeysForPipeline(PipelineId, Vec<ImageKey>),
/// Set WebDriver input event handled sender.
SetWebDriverResponseSender(IpcSender<WebDriverCommandResponse>),
/// A set of preferences were updated with the given new values.
PreferencesUpdated(Vec<(&'static str, PrefValue)>),
}
/// A description of a paint metric that is sent from the Servo renderer to the