Closed Bug 1651844 Opened 4 years ago Closed 4 years ago

Extension / WebExtensionPolicy stub is not unregistered when startup fails early

Categories

(WebExtensions :: General, defect, P1)

defect

Tracking

(firefox80 fixed)

RESOLVED FIXED
mozilla80
Tracking Status
firefox80 --- fixed

People

(Reporter: robwu, Assigned: robwu)

References

Details

Attachments

(2 files)

The Extension's startup() method has cleanup logic in a catch block, which consists of printing the error, unregistering the WebExtensionPolicy (stub) instance and cleaning up generated files.

This logic is skipped when startup() fails early because there is an early return when the manifest/localization initialization has failed.

As a result, there will be a stale, always-active WebExtensionPolicy without extension.
Due to bug 1651838, manifest initialization failed, which combined with this bug was responsible for causing bug 1651697 (https://github.com/mozilla-mobile/fenix/issues/12399).

To fix this part of the issue, we should ensure that the cleanup is always run.

In most cases, the presence of any errors causes an error to be thrown
at startup. Sometimes, that is not the case, and as a result the
extension is not properly unregistered.

This is necessary because otherwise callers of policy.readyPromise can
get stuck when an extension fails to start up.

Severity: -- → S2
Priority: -- → P1
Pushed by rob@robwu.nl:
https://hg.mozilla.org/integration/autoland/rev/75a4fa219844
Ensure that cleanup is run when startup() exits early r=rpl
https://hg.mozilla.org/integration/autoland/rev/39ab9832a71c
Ensure that readyPromise is resolved when startup() exits early r=rpl
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla80
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: