mirror of
https://github.com/servo/servo.git
synced 2025-09-19 11:20:09 +01:00
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:
parent
61692b26c2
commit
ed6bf196c9
16 changed files with 191 additions and 60 deletions
|
@ -63,7 +63,7 @@ impl XrDiscoveryWebXrRegistry {
|
|||
struct XrPrefObserver(Arc<AtomicBool>);
|
||||
|
||||
impl prefs::Observer for XrPrefObserver {
|
||||
fn prefs_changed(&self, changes: Vec<(&'static str, prefs::PrefValue)>) {
|
||||
fn prefs_changed(&self, changes: &[(&'static str, prefs::PrefValue)]) {
|
||||
if let Some((_, value)) = changes.iter().find(|(name, _)| *name == "dom_webxr_test") {
|
||||
let prefs::PrefValue::Bool(value) = value else {
|
||||
return;
|
||||
|
@ -79,7 +79,7 @@ impl WebXrRegistry for XrDiscoveryWebXrRegistry {
|
|||
|
||||
let mock_enabled = Arc::new(AtomicBool::new(pref!(dom_webxr_test)));
|
||||
xr.register_mock(HeadlessMockDiscovery::new(mock_enabled.clone()));
|
||||
prefs::set_observer(Box::new(XrPrefObserver(mock_enabled)));
|
||||
prefs::add_observer(Box::new(XrPrefObserver(mock_enabled)));
|
||||
|
||||
if let Some(xr_discovery) = self.xr_discovery.take() {
|
||||
match xr_discovery {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue