tabs.onActivate not fired when switching window

RESOLVED FIXED in 1.0

Status

Add-on SDK
General
P1
normal
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: Nicolas Côté-Nolin, Assigned: irakli)

Tracking

unspecified

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

7 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.151 Safari/534.16
Build Identifier: addon-sdk-1.0b4

The tabs.onActivate event isn't fired when switching from window to window and there is no window.onActivate event.

Reproducible: Always

Steps to Reproduce:
tabs.on('activate', function(tab) { 
   console.log("Tab activated!); 
}); 

1. Open a first window : event not fired (bug https://bugzilla.mozilla.org/show_bug.cgi?id=641396)
2. Open a tab : event fired -> OK
3. Open a new window : event fired -> OK
4. Go back to first window : event not fired. Active tab is still the tab from the 2nd window.


Expected Results:  
Either the tabs.onActivate event should fired or a new windows.onActivate should be fired. The active tab should also be the one with the focus and not the one from the second window.
(Reporter)

Updated

7 years ago
See Also: → bug 641396
(Reporter)

Updated

7 years ago
See Also: → bug 648241
(Reporter)

Updated

7 years ago
See Also: bug 648241
(Reporter)

Updated

7 years ago
See Also: → bug 648244
Priority: -- → P1
Target Milestone: --- → 1.0
Irakli: do you see this as well?
Assignee: nobody → rFobic
Created attachment 532621 [details]
Pointer to Github pull request: https://github.com/mozilla/addon-sdk/pull/164

Pointer to Github pull-request
Attachment #532621 - Flags: review?(dietrich)
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Also while working on this bug, I realized that emulating close / activate / deactivate events (gecko does not emits those events when window is closed / another window gets active) is not a good idea as we originally thought. Mainly because extensions will be mislead. Good example of this can be a panorama that builds alternative view associated with open tabs. If tab is closed view changes and associated metadata get's removed. Doing similar thing with our API, will not
be possible as metadata associated with tab would've gone away when app is closed as all the windows are closed and we would have emulated tab close events.

I would suggest moving away from this approach. I think it's better if we would expose "window.onActivate" and stop emulating "close" events.
(In reply to comment #3)
> I would suggest moving away from this approach. I think it's better if we
> would expose "window.onActivate" and stop emulating "close" events.

This sounds like the right approach to me.
OS: Linux → All
Hardware: x86_64 → All
Blocks: 641396
Comment on attachment 532621 [details]
Pointer to Github pull request: https://github.com/mozilla/addon-sdk/pull/164

a couple of nits noted on pull-request, but core changes look fine, r=me.
Attachment #532621 - Flags: review?(dietrich) → review+
https://github.com/mozilla/addon-sdk/commit/e01c95c84ae65c62774474a97474fd29716c16fb
Status: ASSIGNED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.