servoshell: Add button to toggle experimental web platform features. (#39125)

This makes it easier to experiment with the impact of experimental
features when browsing around in servoshell. The toggle is global and
causes all webviews to reload with the new preference values.

Testing: Manually tested; no UI testing for servoshell.

Not enabled:
<img width="317" height="82" alt="Screenshot 2025-09-03 at 9 34 30 PM"
src="https://github.com/user-attachments/assets/ca521ad5-ce1b-434e-a0c3-ea1b75d76d53"
/>

Enabled:
<img width="320" height="82" alt="Screenshot 2025-09-03 at 9 34 36 PM"
src="https://github.com/user-attachments/assets/7b6529b5-1055-4ae0-924a-96d57e115714"
/>

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-09-03 22:53:12 -04:00 committed by GitHub
parent 912b83b58f
commit aac6aa6c70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 45 additions and 2 deletions

View file

@ -98,6 +98,7 @@ use profile_traits::mem::MemoryReportResult;
use profile_traits::{mem, time};
use script::{JSEngineSetup, ServiceWorkerManager};
use servo_config::opts::Opts;
pub use servo_config::prefs::PrefValue;
use servo_config::prefs::Preferences;
use servo_config::{opts, pref, prefs};
use servo_delegate::DefaultServoDelegate;
@ -1083,6 +1084,12 @@ impl Servo {
.send(EmbedderToConstellationMessage::WebDriverCommand(command));
}
}
pub fn set_preference(&self, name: &str, value: PrefValue) {
let mut preferences = prefs::get().clone();
preferences.set_value(name, value);
prefs::set(preferences);
}
}
fn create_embedder_channel(