Closed Bug 1657291 Opened 4 years ago Closed 4 years ago

Replace UrlbarPrefsObserver with an ordered list of weak observers internal to UrlbarPrefs

Categories

(Firefox :: Address Bar, task, P2)

task
Points:
2

Tracking

()

RESOLVED FIXED
81 Branch
Iteration:
81.1 - July 27 - Aug 09
Tracking Status
firefox81 --- fixed

People

(Reporter: adw, Assigned: adw)

References

Details

Attachments

(1 file)

This is spun out from https://phabricator.services.mozilla.com/D85904. Instead of having UrlbarPrefsObserver.observe call UrlbarPrefs._onPrefChanged as implemented in that revision, we can have UrlbarPrefs keep an ordered list of observers so we can guarantee that observers are called in the order they're added. The problem is that unless observers are held weakly, they have to be unregistered at some point (e.g., when windows go away if the observers are tied to windows). We can use weak references to avoid that.

Try looks good, no leaks or failures: https://treeherder.mozilla.org/#/jobs?repo=try&revision=7ec3d5afd64af8d7fdf3be63bf7a0024c1f3ddb2

Edit: This push includes a stripped-down version of https://phabricator.services.mozilla.com/D85904 that adds UrlbarInput as a pref observer, so that patch should be good to go as far as the pref observer portion is concerned.

Pushed by dwillcoxon@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/72a0b4184204
Replace UrlbarPrefsObserver with an ordered list of weak observers internal to UrlbarPrefs. r=harry
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 81 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: