Closed Bug 1826825 Opened 2 years ago Closed 4 months ago

runtime.onInstalled event is not fired on a browser restart if an extensions update is delayed.

Categories

(WebExtensions :: Untriaged, defect, P3)

Firefox 113
defect

Tracking

(firefox112 affected, firefox113 affected)

RESOLVED DUPLICATE of bug 1700797
Tracking Status
firefox112 --- affected
firefox113 --- affected

People

(Reporter: anonymous30901032, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0

Steps to reproduce:

If an extension is listening to the runtime.onUpdateAvailable event, an update might not be applied until the browser is restarted. If that is the case, the runtime.onInstalled event does not fire after the browser restarts and the extension updates to the newer version.

1 - Install this extension that listens to the runtime.onInstalled event: ( https://addons.mozilla.org/firefox/downloads/file/4091771/runtime_oninstalled_test-1.0.xpi ). It will log a message to the console when the event fires. It will also open a new tab if the runtime.OnInstalledReason is "update" or "install". This is an older version of the extension, so it can be updated.

2 - Close the new tab that was created after installing the extension.

3 - Run 'Check for Updates' in the about:addons page with 'Update Add-ons Automatically' selected. The extensions update will be delayed as it listens to the runtime.onUpdateAvailable event.

4 - Select the 'View Available Updates' button. The extension should have an 'Update Now' button under it with a notice that it will be updated when the browser restarts.

5 - Restart the browser without selecting the 'Update Now' button.

6 - After the restart, a new tab will not open, signaling the event did not fire for an "update" or "install". The extensions console may also be checked in about:debugging. There will be no message for the runtime.onInstalled event (assuming there was no browser update).

Expected results:

The runtime.onInstalled event should probably be able to fire multiple times when a browser is restarted. There is the possibility of an extension updating ("update"), a browser updating ("browser_update"), and an extension with a shared module updating ("shared_module_update") after the restart.

The Bugbug bot thinks this bug should belong to the 'WebExtensions::Untriaged' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Product: Firefox → WebExtensions

Hello,

I reproduced the issue on the latest Nightly (113.0a1/20230409095525), Beta (112.0/20230406114409) and Release (111.0.1/20230321111920) under Windows 10 x64 and macOS11.3.1

As per Comment 0, initially installing the extension, logs an onInstalled: install in the browser console and opens a new tab.
Proceeding with the STR i.e closing the tab, checking for updates (onUpdateAvailable is logged to console) and restarting the browser without selecting the “Update Now” button, the tab that was opened previously is not opened again i.e. the event did not fire after the browser was restarted.

The extension debug console shows a onStartup log after restart and the extension is indeed updated.

Status: UNCONFIRMED → NEW
Ever confirmed: true

Please attach the extension. The link points to a non-existent destination (404 not found).

Flags: needinfo?(anonymous30901032)
Flags: needinfo?(anonymous30901032)
Flags: needinfo?(rob)

I can confirm this is the case, we have investigated for some other ongoing work and it is due to the staged update (which when it is then completed on browser restart, the startupReason passed as part of the addonData is currently the app startup one instead of the addon install one).

Flags: needinfo?(rob)
Severity: -- → S3
Priority: -- → P3
Whiteboard: [addons-jira]
Status: NEW → RESOLVED
Closed: 4 months ago
Duplicate of bug: 1700797
Resolution: --- → DUPLICATE

(moved ticket to the duplicate)

Whiteboard: [addons-jira]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: