Closed Bug 1941792 Opened 1 month ago Closed 1 month ago

Stop using weak ref in DownloadsCommon.sys.mjs

Categories

(Firefox :: Downloads Panel, task)

task

Tracking

()

RESOLVED FIXED
136 Branch
Tracking Status
firefox136 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(1 file)

The PrefObserver uses aHoldWeak parameter of the addObserver, but the PrefObserver lives longer than the observer list, given
the list is cleared at xpcom-shutdown, but the system modules are unloaded after that.

Thus, using strong reference there doesn't leak the observer, and using strong reference is necessary after bug 1941472 to explicitly keep the observer alive.

https://searchfox.org/mozilla-central/rev/86c208f86f35d53dc824f18f8e540fe5b0663870/browser/components/downloads/DownloadsCommon.sys.mjs#93-97,113,115

var PrefObserver = {
  QueryInterface: ChromeUtils.generateQI([
    "nsIObserver",
    "nsISupportsWeakReference",
  ]),
...
  register(prefs) {
...
    kPrefBranch.addObserver("", this, true);
Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/8d8e22d0e7be Stop using weak ref in DownloadsCommon.sys.mjs. r=Gijs
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 136 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: