Closed Bug 1345583 Opened 7 years ago Closed 7 years ago

Move code for startup and shutdown handling of preferences to ExtensionPreferencesManager

Categories

(WebExtensions :: General, enhancement, P1)

enhancement

Tracking

(firefox55 fixed)

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: bsilverberg, Assigned: bsilverberg)

References

Details

Attachments

(1 file)

The code that is currently in ext-privacy.js [1] for handling automatic enabling and disabling of preferences on extension startup and shutdown should be moved into ExtensionPreferencesManager.jsm.

It doesn't make sense to have this code in the individual ext- files and in fact causes a problem when more than one of those files includes the code.

[1] http://searchfox.org/mozilla-central/source/toolkit/components/extensions/ext-privacy.js#17-35
Comment on attachment 8845075 [details]
Bug 1345583 - Move code for startup and shutdown handling of preferences to ExtensionPreferencesManager,

https://reviewboard.mozilla.org/r/118286/#review120294

This would be good to add tests for too, but getting the change in to unblock other consumers seems like a higher priority.

::: toolkit/components/extensions/ExtensionPreferencesManager.jsm:37
(Diff revision 1)
>  
>  XPCOMUtils.defineLazyGetter(this, "defaultPreferences", function() {
>    return new Preferences({defaultBranch: true});
>  });
>  
> +const {Management} = Cu.import("resource://gre/modules/Extension.jsm", {});

please move this to the top of the file
Attachment #8845075 - Flags: review?(aswan) → review+
Comment on attachment 8845075 [details]
Bug 1345583 - Move code for startup and shutdown handling of preferences to ExtensionPreferencesManager,

https://reviewboard.mozilla.org/r/118286/#review120294

I wasn't that concerned about tests for this change, as it is covered by the tests for the privacy API, but I suppose it's possible for the implementation of privacy to change and leave this uncovered, so yes, it should have its own tests. I have opened https://bugzilla.mozilla.org/show_bug.cgi?id=1345847 as a follow-up.
Pushed by bsilverberg@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f12a9623b445
Move code for startup and shutdown handling of preferences to ExtensionPreferencesManager, r=aswan
https://hg.mozilla.org/mozilla-central/rev/f12a9623b445
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: