Closed Bug 1796586 Opened 2 years ago Closed 2 years ago

browser.runtime.onStartup doesn't work

Categories

(WebExtensions :: Untriaged, defect, P1)

Firefox 108
defect

Tracking

(firefox106 wontfix, firefox107 verified, firefox108 verified)

VERIFIED FIXED
108 Branch
Tracking Status
firefox106 --- wontfix
firefox107 --- verified
firefox108 --- verified

People

(Reporter: eight04, Assigned: rpl)

References

(Blocks 1 open bug)

Details

(Whiteboard: [addons-jira])

Attachments

(6 files)

Attached file tabalanche-1.1.0.zip

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

Steps to reproduce:

  1. Download extensions - tabalanche-1.1.0.zip and tabalanche-no-pouchdb-1.1.0.zip in the attachment
  2. Turn off signature verification (about:config -> change xpinstall.signatures.required to false)
  3. Install extensions (Ctrl-Shift-A -> Top-right gear icon -> Install addon from files)
  4. Open about:debugging#/runtime/this-firefox
  5. Wait until all background scripts are stopped. https://i.imgur.com/B02QYcl.png
  6. Restart the browser.

Actual results:

The extension opens a new tab http://example.com/no-pouchdb

Expected results:

We should get two tabs. The one with pouchdb should also open a new tab http://example.com at startup.

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 (108.0a1/20221023100414) under Windows 10 x64 and Ubuntu 16.04 LTS.

I’ve also reproduced the issue on Beta Developer Edition (107.0b4/20221023190001) and an unbranded Beta (106.0b9/20221006191955) which should substitute a Firefox Release build. These builds were used as on normal Beta and Release I cannot turn off signature verification.

As per the original description, upon browser restart, only one tab is opened, with http://example.com/no-pouchdb. A second new tab with http://example.com is not opened at startup.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Severity: -- → S2
Priority: -- → P1
Whiteboard: [addons-jira]
Assignee: nobody → lgreco
Status: NEW → ASSIGNED
Blocks: 1797474
Pushed by luca.greco@alcacoop.it:
https://hg.mozilla.org/integration/autoland/rev/894694e2e7d5
Fix issue related to runtime.onStartup persistent listeners wrongly cleared on idle timeout. r=mixedpuppy
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch

Hello,

Verified as Fixed on the latest Nightly (108.0a1/20221026224258) under Windows 10 x64 and Ubuntu 16.04 LTS.

Following the STR in Comment 0, upon browser restart, two tabs are now opened, one with http://example.com/no-pouchdb and one with http://example.com/, confirming the fix.

See the attached screenshot for more details.

Status: RESOLVED → VERIFIED
Attached image two tabs.png

The patch landed in nightly and beta is affected.
:rpl, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox107 to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(lgreco)

Comment on attachment 9299987 [details]
Bug 1796586 - Fix issue related to runtime.onStartup persistent listeners wrongly cleared on idle timeout. r?mixedpuppy!

Beta/Release Uplift Approval Request

  • User impact if declined: Extensions using an event page (background script with persistent false set in the manifest) that are subscribing a runtime.onStartup listener will not be automatically started on the next browser startup (unless they have also subscribed some other WebExtensions API events and that events gets triggered)

As side notes related to Android builds (set to yes below):

  • The event pages support is technically enabled for MV2 extensions also on Android builds
  • Firefox for Android only support a subset of the recommended extensions and so it may be affected but only if any of the extensions currently available in Firefox for Android are matching the conditions that would be triggering the issue (MV2 extensions with background.persistent set to false in the manifest and background page registering runtime.onStartup event listener).
  • The patch landed is expected to fix the issue also on Android builds, if any of the extensions available on Firefox for Android is actually able to trigger the issue.
  • QA verify the issue on Firefox for Android would be possible, but way less straightforward than verify it on Desktop builds (and it wouldn't technically provide much more, verify it on Desktop builds should be enough to ensure that the same conditions would also be matched on Android because that part of the WebExtensions internals is defined at toolkit level and it is shared by both Desktop and GeckoView builds).
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: Same STR used to verify the fix on Nightly
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): The fix is small and restricted to the special runtime.onStartup event, only the MV2 extensions using an event page and the runtime.onStartup would be affected by the change, MV2 extensions with a persistent background page (which should be the majority of the MV2 extensions currently available on AMO) the issue nor the fix should make any difference.

The patch with the fix also include an additional test to cover the specific issue and its expected behavior with the fix.

  • String changes made/needed:
  • Is Android affected?: Yes
Flags: needinfo?(lgreco)
Attachment #9299987 - Flags: approval-mozilla-beta?
Flags: qe-verify+
QA Whiteboard: [qa-triaged]

Comment on attachment 9299987 [details]
Bug 1796586 - Fix issue related to runtime.onStartup persistent listeners wrongly cleared on idle timeout. r?mixedpuppy!

Approved for Desktop 107.0b7 and Fenix/Focus 107.0b5

Attachment #9299987 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Hello,

Verified as Fixed on the latest Beta Developer Edition (107.0b7/20221029133721) [Used Beta Developer Edition due to the requirement to turn off signature verification]. Tested on Windows 10 x64 and Ubuntu 16.04 LTS.

As per the STR in Comment 0, upon browser restart, two tabs are now opened, one with http://example.com/no-pouchdb and one with http://example.com/, confirming the fix.

See the attached screenshot for more details.

Flags: qe-verify+
Attached image 2022-10-31_08h59_41.png

I can confirm that it is fixed when I try to restart the browser manually i.e.

  1. Close and open the browser again.
  2. Ctrl-Shit-J -> Ctrl-Alt-R

However, it seems that it still doesn't work if the restart is triggered by browser update.

(In reply to eight04 from comment #17)

I can confirm that it is fixed when I try to restart the browser manually i.e.

  1. Close and open the browser again.
  2. Ctrl-Shit-J -> Ctrl-Alt-R

However, it seems that it still doesn't work if the restart is triggered by browser update.

I'm sorry eight04, I missed to notice your last comment until now.

If a similar issue is still consistently reproducible on browser updates, it may be worth filing a new bug, the underlying issue would be likely different
(on browser updates the persistent listeners are expected to be all cleared as part of the extensions startupCache being invalidated, and the background page to be started up as a side effect of no persistent listeners being available, see here in ext-backgroundPage.js).

Hi Alex, would you mind to confirm if you can still trigger the issue on browser updates?

Flags: needinfo?(acornestean)

Tested the browser update scenario by installing the required add-ons on Nightly 108 and then updating to the latest Nightly 109.

On my end, both the tabs with http://example.com/no-pouchdb and the one with http://example.com/ were opened after the browser restarted post-update.

See the attached video for more details.

Flags: needinfo?(acornestean)

Sorry, I forgot to update the comment. It is a different bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1741865#c60

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: