Open Bug 2078422 Opened 1 month ago Updated 9 days ago

Implement a system for cross pane preference/setting dependencies

Categories

(Firefox :: Settings UI, task)

task

Tracking

()

ASSIGNED

People

(Reporter: hjones, Assigned: hjones)

References

(Blocks 1 open bug)

Details

(Whiteboard: [recomp])

Attachments

(2 external files)

We occasionally run into a scenario in about:preferences where code in one pane relies on a setting that was registered in another pane. Currently we don't have proper support for the case where:

  • we have two panes, paneOne and paneTwo
  • paneOne registers a setting that depends on a pref added in paneTwo
  • paneOne loads before paneTwo
// paneOne.mjs
Preferences.addSetting({
  id: "paneOnePref",
  pref: "pane.one.pref",
  deps: ["pane.two.pref"],
});

// paneTwo.mjs
Preferences.addSetting({
  id: "paneTwoPref",
  pref: "pane.two.pref",
});

When this happens currently we don't get reliable values/updates for the dependency in paneA.

As a workaround, we have been adding prefs/registering settings that are needed by more than one pane in main.js - these prefs are added here, and the settings are registered like this.

We should implement a better system to support this kind of cross pane dependency. Some things to consider:

  • settings will effectively need some way to subscribe to prefs that are added/settings that are registered in a pane that loads later - we will need some way to notify subscribers that a pref/setting value is available
  • we may need some way to determine and load the pane that is associated with a give pref
Summary: Implement a system for cross pref pane dependencies → Implement a system for cross pane preference/setting dependencies

This patch makes the settings dependency system a bit more flexible by adding a mechanism to handle the case where settingA depends on settingB, but settingB gets loaded after settingA.

Assignee: nobody → hjones
Status: NEW → ASSIGNED

This patch makes it possible to specify when settings panes depend on additional panes being loaded to work as expected.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: