Closed Bug 1409245 Opened 7 years ago Closed 7 years ago

Implement a bootstrap "update" method

Categories

(Toolkit :: Add-ons Manager, enhancement, P2)

56 Branch
enhancement

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox57 --- wontfix
firefox58 --- fixed

People

(Reporter: aswan, Assigned: aswan)

References

Details

Attachments

(3 files)

Right now, when a bootstrapped extension is updated, we call a series of bootstrap methods:

disable() on the old extension
uninstall() on the old extension
install() on the new extension
enable() on the new extension

In the WebExtensions code for handling preferences that can be affected by extensions, we have some elaborate code to try to handle this sequence of events but it has led to some bugs including bug 1407029 and bug 1404584.  The preferences code would be much simpler and those bugs would be easy to fix if we didn't make the WebExtensions framework split the work of an update across several handlers, but just generated a single update() event when we decide to go ahead with the update.

There are a bunch of problems with doing this for things that aren't WebExtensions so I propose that (at least for now) we limit this to the case where both the old and new extensions are WebExtensions.
Blocks: 1404584
Priority: -- → P2
In case this doesn't make sense by itself, I'll push my wip patches to bug 1404584 too, that might be useful context for reviewing the patches here.
Assignee: nobody → aswan
Attachment #8922426 - Flags: review?(kmaglione+bmo)
Attachment #8922427 - Flags: review?(kmaglione+bmo)
Attachment #8922424 - Flags: review?(kmaglione+bmo)
Comment on attachment 8922426 [details]
Bug 1409245 Part 1 Move temporary addon cleanup earlier in shutdown

https://reviewboard.mozilla.org/r/193456/#review199826

::: toolkit/mozapps/extensions/internal/XPIProvider.jsm:2386
(Diff revision 1)
>      } catch (err) {
>        this._shutdownError = err;
>      }
>    },
>  
> +  _cleanupTemporaryAddons() {

No need for underscore. This is a non-public class.
Attachment #8922426 - Flags: review?(kmaglione+bmo) → review+
Comment on attachment 8922427 [details]
Bug 1409245 Part 2 Implement bootstrap update() method

https://reviewboard.mozilla.org/r/193458/#review199828

::: toolkit/mozapps/extensions/internal/XPIInstall.jsm:1809
(Diff revision 1)
> +          if (isWebExtension(this.addon.type) && isWebExtension(this.existingAddon.type)) {
> +            callUpdate = true;
> +          }

Nit: `callUpdate = isWebExtension(...) ...;`

::: toolkit/mozapps/extensions/internal/XPIProvider.jsm:3590
(Diff revision 1)
> +        if (isWebExtension(oldAddon.type) && isWebExtension(addon.type)) {
> +          callUpdate = true;
> +        }

Nit: `callUpdate = ...`

::: toolkit/mozapps/extensions/internal/XPIProvider.jsm:4675
(Diff revision 1)
> +      if (isWebExtension(aAddon.type) && isWebExtension(existingAddon.type)) {
> +        callUpdate = true;
> +      }

Nit: ...
Attachment #8922427 - Flags: review?(kmaglione+bmo) → review+
Comment on attachment 8922424 [details]
Bug 1409245 Part 3 Handle update and uninstall events in WebExtensions

https://reviewboard.mozilla.org/r/193454/#review199830

::: toolkit/components/extensions/Extension.jsm:248
(Diff revision 1)
>    onUninstalling(addon) {
>      let extension = GlobalManager.extensionMap.get(addon.id);
>      if (extension) {
>        // Let any other interested listeners respond
>        // (e.g., display the uninstall URL)
> -      Management.emit("uninstall", extension);
> +      Management.emit("onUninstalling", extension);

No `on` in EventEmitter event names, please.
Attachment #8922424 - Flags: review?(kmaglione+bmo) → review+
Pushed by aswan@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fa2de963897c
Part 1 Move temporary addon cleanup earlier in shutdown r=kmag
https://hg.mozilla.org/integration/autoland/rev/ffa3f56ba479
Part 2 Implement bootstrap update() method r=kmag
https://hg.mozilla.org/integration/autoland/rev/652456ce8315
Part 3 Handle update and uninstall events in WebExtensions r=kmag
Is manual testing required on this bug? If yes, please provide some STR and the proper extension(if required) or set the “qe verify-“ flag.

Thanks!
Flags: qe-verify-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: