Closed
Bug 1230816
Opened 10 years ago
Closed 8 years ago
Tab deactivate event not fired for the first tab for the first deactivation
Categories
(Add-on SDK Graveyard :: General, defect)
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
People
(Reporter: saithis88, Unassigned)
Details
Attachments
(1 file)
|
519 bytes,
application/x-zip-compressed
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0
Build ID: 20151201004002
Steps to reproduce:
1. require "sdk/tabs"
2. attach a activate and deactivate event listener to the global tabs object and output the tab id to the console
3. run "jpm run"
4. open a new tab (here the activate event for the new tab is fired, but the deactivate event for the initial tab is not fired)
5. open another tab
6. siwtch to the first tab
7. switch to the second tab
Actual results:
Console output:
console.log: tab-deactivate-bug: activate tab: -5-2
console.log: tab-deactivate-bug: deactivate tab: -5-2
console.log: tab-deactivate-bug: activate tab: -5-3
console.log: tab-deactivate-bug: deactivate tab: -5-3
console.log: tab-deactivate-bug: activate tab: -5-1
console.log: tab-deactivate-bug: deactivate tab: -5-1
console.log: tab-deactivate-bug: activate tab: -5-2
Expected results:
Console output:
console.log: tab-deactivate-bug: deactivate tab: -5-1
console.log: tab-deactivate-bug: activate tab: -5-2
console.log: tab-deactivate-bug: deactivate tab: -5-2
console.log: tab-deactivate-bug: activate tab: -5-3
console.log: tab-deactivate-bug: deactivate tab: -5-3
console.log: tab-deactivate-bug: activate tab: -5-1
console.log: tab-deactivate-bug: deactivate tab: -5-1
console.log: tab-deactivate-bug: activate tab: -5-2
Comment 1•10 years ago
|
||
I am also having this issue.
Only difference is that I am attaching my 'deactivate' listener on the immediate activeTab itself. So:
==============================================
for (tab in tabs) {
if (tab.url.includes('my-url.com') {
tab.on('deactivate', deactivationHandler);
}
}
==============================================
Steps are pretty much same as above:
1. require('sdk/tabs')
2. get tab and attach listener as seen in above snippet.
3. switch to another tab, deactivationHandler is NOT run.
4. switch back to original tab ('my-url.com').
5. switch to another tab, deactivationHandler IS run.
Build: Firefox Dev Edition version 48.0a2
OS: Linux 4.2.0-35
Dist: Ubuntu (*sigh*) 15.10
This is for the Test Pilot project. https://github.com/mozilla/testpilot/tree/master/addon
Comment 2•10 years ago
|
||
There doesn't seem to be an nsIObserver event fired when the application itself loses focus.
Suggestion for an SDK-level fix: listen globally to 'deactivate' events on all open windows (might be doing this already?). When 'deactivate' fires, check the nsIFocusManager's activeWindow property; if it's null, the application has lost focus, so fire the tab deactivate event.
Comment 3•10 years ago
|
||
Hm, it looks like there's already code listening for the window to fire an 'activate' event
https://dxr.mozilla.org/mozilla-central/source/addon-sdk/source/lib/sdk/tabs/observer.js#80
so adding a parallel 'deactivate' listener seems to make sense.
Comment 4•8 years ago
|
||
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → INCOMPLETE
Comment 5•8 years ago
|
||
You need to log in
before you can comment on or make changes to this bug.
Description
•