Closed Bug 1779926 Opened 3 years ago Closed 3 years ago

browser.tabs.onUpdated event stopped firing for "active" tab changes in Firefox 101

Categories

(WebExtensions :: Untriaged, defect)

Firefox 102
defect

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: reeywhaar, Unassigned)

Details

(Keywords: regressionwindow-wanted)

Attachments

(1 file)

Attached image TabSaver window

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Firefox/102.0

Steps to reproduce:

I have extension TabSaver: https://addons.mozilla.org/en-US/firefox/addon/vyrtsev-tab-saver/

Prior to Firefox 101 browser.tabs.onUpdated event worked correctly, but now I receive no events from tabs.

To reproduce:

  • Clone repository:
    #: git clone https://github.com/Reeywhaar/tabsaver.git
  • Install dependencies:
    #: npm install
  • Compile:
    #: npm run build:
  • Run:
    #: ./node_modules/.bin/web-ext run -s ext
  • Open two tabs: example.com and mozilla.org
  • Open TabSaver extension by clicking on it's icon.
  • Then try switch tabs inside extension by clicking on either example.com or mozilla.org
  • Active tab not marked as current on Firefox 101, but everything works fine on Firefox 100.

onUpdated handler can be found at https://github.com/Reeywhaar/tabsaver/blob/d4dd411094aed5ccbe7df73b0d3ffc580f56beff/src/store.js#L241-L247

I guess problem is not only with onUpdated event but whole tab events group, e.g. onCreated, onMoved, onRemoved etc...

If you want to debug, you can edit src/store.js in downloaded repo.

To enable hot reload you should run both commands simultaneously:

  • npm run watch
  • ./node_modules/.bin/web-ext run -s ext

My environment:
MacOS 12.4 on both M1 and Intel i9 Processors
Firefox 100 (works fine)
Firefox 101 (bug exists)
Firefox 102 (bug still exists)

Actual results:

TabSaver doesn't mark active tab as active because browser.tabs.onUpdated event not received when switching tabs.

Expected results:

browser.tabs.onUpdated event should be received when switching tabs.

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

Made minimal reproducible demo:

https://github.com/Reeywhaar/firefox-bug-1779926

Excerpt from readme:

How to debug:

  • Install npm dependencies
    #: npm install
  • Run extension with web ext
    #: npm run run
  • Open two tabs with arbitrary urls (example.com and mozilla.org for example)
  • Open Browser Console (on mac it is located in Tools -> Browser Tools -> Browser Console (shift-cmd-J))
  • Filter messages by "TABS"
  • Open extension panel by clicking extension icon in the top right corner of Firefox.
  • In browser console you should see "TABS START", "TABS ADD LISTENER", "TABS ADDED LISTENER", "TABS STARTED" messages.
  • Try to switch between tabs with buttons on extension panel: Select 1st tab, Select 2nd tab.
  • If you try it on Firefox < 101, you should see "TABS UPDATED" message. On Firefox >= 101 message is absent, which indicates that browser.tabs.onUpdated listener not called.
  • Code for extension panel is located in ext/dist/panel.js

A minimal reproduction would is to load the ext/ directory from comment 2 from about:debugging. No need to install npm dependencies / web-ext.

Could you use mozregression to identify the cause of the regression? - https://mozilla.github.io/mozregression/

Summary: browser.tabs.onUpdated event stopped firing in Firefox 101 → browser.tabs.onUpdated event stopped firing for "active" tab changes in Firefox 101

Thank you for such handy tool!

I guess something went wrong during test, but I was able to narrow down to nightly where regression appeared.

10:54.82 INFO: Last good revision: a33cd50e2f73a5626864cd88e14d9fbd2ab158c2 (2022-04-20)
10:54.82 INFO: First bad revision: 803285ca813f3520e8ca2d02669d96cab5c9d48e (2022-04-21)

Full log:
10:54.82 INFO: Narrowed nightly regression window from [2022-04-18, 2022-04-21] (3 days) to [2022-04-20, 2022-04-21] (1 days) (~0 steps left)
10:54.82 INFO: Got as far as we can go bisecting nightlies...
10:54.82 INFO: Last good revision: a33cd50e2f73a5626864cd88e14d9fbd2ab158c2 (2022-04-20)
10:54.82 INFO: First bad revision: 803285ca813f3520e8ca2d02669d96cab5c9d48e (2022-04-21)
10:54.82 INFO: Pushlog:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=a33cd50e2f73a5626864cd88e14d9fbd2ab158c2&tochange=803285ca813f3520e8ca2d02669d96cab5c9d48e

10:54.82 INFO: Switching bisection method to taskcluster
10:54.82 INFO: Getting mozilla-central builds between a33cd50e2f73a5626864cd88e14d9fbd2ab158c2 and 803285ca813f3520e8ca2d02669d96cab5c9d48e
10:59.04 INFO: Pushlog:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=a33cd50e2f73a5626864cd88e14d9fbd2ab158c2&tochange=803285ca813f3520e8ca2d02669d96cab5c9d48e

10:59.04 INFO: Downloading build from: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/XN6G-sk-SNKHcvsyyB96RA/runs/0/artifacts/public%2Fbuild%2Ftarget.dmg
===== Downloaded 100% =====
11:07.20 INFO: Running mozilla-central build built on 2022-04-21 11:20:29.955000, revision 302c06a3
11:09.17 WARNING: Skipping build 732f99a1316c: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.732f99a1316c70e23277945367901d1ec2c5dbed.firefox.macosx64-opt'
11:36.33 INFO: Launching /private/var/folders/rz/2cnv9trd56x5dm06f32rxmgh0000gn/T/tmp2uqyd4b0/Firefox Nightly.app/Contents/MacOS/firefox
11:36.33 INFO: Application command: /private/var/folders/rz/2cnv9trd56x5dm06f32rxmgh0000gn/T/tmp2uqyd4b0/Firefox Nightly.app/Contents/MacOS/firefox -foreground -profile /var/folders/rz/2cnv9trd56x5dm06f32rxmgh0000gn/T/tmpbfhafm8_.mozrunner
11:36.34 INFO: application_buildid: 20220421094346
11:36.34 INFO: application_changeset: 302c06a300eeff338f980babbb78951318fd0e00
11:36.34 INFO: application_name: Firefox
11:36.34 INFO: application_repository: https://hg.mozilla.org/mozilla-central
11:36.34 INFO: application_version: 101.0a1
Was this integration build good, bad, or broken? (type 'good', 'bad', 'skip', 'retry' or 'exit' and press Enter):
11:39.80 WARNING: Process exited with code -9

11:40.50 INFO: To resume, run:
11:40.50 INFO: /Users/reeywhaar/Desktop/mozreg/env/bin/mozregression --repo=mozilla-central --good=a33cd50e2f73a5626864cd88e14d9fbd2ab158c2 --bad=803285ca813f3520e8ca2d02669d96cab5c9d48e

(In reply to reeywhaar from comment #5)

I suspect this commit https://hg.mozilla.org/mozilla-central/rev/e64a440f0c8b9f2cd539929c77e611d2de49c6e2

That commit ensures that tabs.onUpdated is not fired when tab.attention's value has not changed.

I think that your test case or expectation is incorrect. tabs.onUpdated is not supposed to be fired when active changes, the tabs.onActivated event exists for that: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/onActivated

But that is what did happen in Firefox prior to 101. 🤔

Your suggestion helped me with my own problem, thank you!

Not sure what to do with a ticket, hence now I know this is a problem of expectation, but at the same time Firefox changed its behavior.

(In reply to reeywhaar from comment #8)

Not sure what to do with a ticket, hence now I know this is a problem of expectation, but at the same time Firefox changed its behavior.

I'll close the bug. The functionality in Firefox is working as intended. The add-on should have used a completely different event (tabs.onActivated) instead of relying on an unrelated event that was triggered only coincidentally.

Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: