mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Enable resetable and String prefs.
This allows both boolean and string-type preferences. It also implements a system where prefs that are read from a configuration file can be reset back to their initial value, which is useful in a number of cases e.g. when running tests to ensure that each test starts with the same values for the prefs.
This commit is contained in:
parent
d811f2d1ba
commit
79e548905e
10 changed files with 174 additions and 33 deletions
|
@ -905,7 +905,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
containing_pipeline_id: PipelineId,
|
||||
subpage_id: SubpageId,
|
||||
event: MozBrowserEvent) {
|
||||
assert!(prefs::get_pref("dom.mozbrowser.enabled").unwrap_or(false));
|
||||
assert!(prefs::get_pref("dom.mozbrowser.enabled").as_boolean().unwrap_or(false));
|
||||
|
||||
// Find the script channel for the given parent pipeline,
|
||||
// and pass the event to that script task.
|
||||
|
@ -1387,7 +1387,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserlocationchange
|
||||
fn trigger_mozbrowserlocationchange(&self, pipeline_id: PipelineId) {
|
||||
if prefs::get_pref("dom.mozbrowser.enabled").unwrap_or(false) {
|
||||
if prefs::get_pref("dom.mozbrowser.enabled").as_boolean().unwrap_or(false) {
|
||||
// Work around borrow checker
|
||||
let event_info = {
|
||||
let pipeline = self.pipeline(pipeline_id);
|
||||
|
|
|
@ -289,7 +289,7 @@ impl Pipeline {
|
|||
pub fn trigger_mozbrowser_event(&self,
|
||||
subpage_id: SubpageId,
|
||||
event: MozBrowserEvent) {
|
||||
assert!(prefs::get_pref("dom.mozbrowser.enabled").unwrap_or(false));
|
||||
assert!(prefs::get_pref("dom.mozbrowser.enabled").as_boolean().unwrap_or(false));
|
||||
|
||||
let event = ConstellationControlMsg::MozBrowserEvent(self.id,
|
||||
subpage_id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue