Closed Bug 697314 Opened 13 years ago Closed 11 years ago

Defer importing xpinstall permissions until necessary

Categories

(Toolkit :: Add-ons Manager, defect)

8 Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: mossop, Assigned: Unfocused)

References

Details

(Whiteboard: [qa-])

Attachments

(1 file)

Currently on the startup of a new version of an app we import any xpinstall whitelist prefs into the permissions manager. This is obviously causing the permissions manager to spin up its database because the single pref we currently import on first run is costing us 100ms.
Additionally Fennec frequently doesn't save prefs when quitting so we attempt to re-import on most startups, after the first run this only costs 15ms but still.

Of course if the permissions manager has to come up at some point during startup then it probably doesn't matter that we do it in the add-ons manager
Is there any downside to deferring this to when there's a requested addon install? Aside from the management UI, of course - I figure that could send an observer notification to flush any changes.
(In reply to Blair McBride (:Unfocused) from comment #2)
> Is there any downside to deferring this to when there's a requested addon
> install? Aside from the management UI, of course - I figure that could send
> an observer notification to flush any changes.

No downside, the only reason I did it on first startup is because previously there were three different places that were importing the prefs to the DB and I wanted to centralise it. Some signal to a central place seems like a good option.
Assignee: nobody → bmcbride
Status: NEW → ASSIGNED
Attached patch Patch v1Splinter Review
Attachment #818840 - Flags: review?(dtownsend+bugmail)
Comment on attachment 818840 [details] [diff] [review]
Patch v1

Review of attachment 818840 [details] [diff] [review]:
-----------------------------------------------------------------

Since all importPermissions does now is call out to PermissionsUtils, wouldn't it be easier to just do that directly from each place rather than call the observer service to trigger it?

::: toolkit/mozapps/extensions/XPIProvider.jsm
@@ +1806,5 @@
>      this.enabledAddons = "";
>  
>      Services.prefs.addObserver(PREF_EM_MIN_COMPAT_APP_VERSION, this, false);
>      Services.prefs.addObserver(PREF_EM_MIN_COMPAT_PLATFORM_VERSION, this, false);
> +    Services.obs.addObserver(this, NOTIFICATION_FLUSH_PERMISSIONS, false);

false for a string?
Attachment #818840 - Flags: review?(dtownsend+bugmail) → review-
Comment on attachment 818840 [details] [diff] [review]
Patch v1

14:18 <•Mossop> So basically ignore everything I said in that review
Attachment #818840 - Flags: review- → review+
OS: Mac OS X → All
Hardware: x86 → All
Version: 8 Branch → unspecified
(In reply to Blair McBride [:Unfocused] from comment #6)
> 14:18 <•Mossop> So basically ignore everything I said in that review

Why?
https://hg.mozilla.org/mozilla-central/rev/3f41909b9433
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
(In reply to :Gavin Sharp (use gavin@gavinsharp.com for email) from comment #8)
> Why?

For the first point, he misunderstood what I was doing. For the second point, he misread addObserver as notifyObservers.
OS: All → Mac OS X
Hardware: All → x86
Target Milestone: mozilla27 → ---
Version: unspecified → 8 Branch
Marking as [qa-] based on the existing automated test in the patch.
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: