Closed
Bug 723951
Opened 14 years ago
Closed 12 years ago
Popup notification does not continue when the tab move to other window.
Categories
(Firefox :: General, defect)
Firefox
General
Tracking
()
RESOLVED
FIXED
Firefox 29
People
(Reporter: tetsuharu, Assigned: florian)
References
Details
(Whiteboard: [doorhanger] )
Attachments
(3 files, 9 obsolete files)
6.83 KB,
patch
|
Details | Diff | Splinter Review | |
19.86 KB,
patch
|
Felipe
:
review+
|
Details | Diff | Splinter Review |
19.87 KB,
patch
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0a1) Gecko/20120202 Firefox/13.0a1
Build ID: 20120202031238
Steps to reproduce:
When the tab move to other window from the current window, Popup notification doesn't continue.
Step to reproduce:
1. Open a new tab and show popup notification at the tab on window (A).
2. Move the tab to an other window (B) from the window (A).
This bug occurs in either case, whether the window which user moves the tab to is a new window or a window opened already.
Actual results:
Popup notification does not continue in the window (B).
This bug caused by not passing xul:browser.popupNotifications from window(A) to window(B).
Expected results:
Popup notifications continues in new window.
Updated•14 years ago
|
Component: Untriaged → General
QA Contact: untriaged → general
Reporter | ||
Comment 1•14 years ago
|
||
Reporter | ||
Updated•14 years ago
|
Whiteboard: [doorhanger]
Comment 2•14 years ago
|
||
Comment on attachment 594191 [details] [diff] [review]
proposed patch v1.0
Thank you for the patch!
Attachment #594191 -
Flags: review?
Reporter | ||
Comment 3•14 years ago
|
||
I fixed a few typos, the parameter name of function passed to otherBrowser.popupNotifications.forEach().
I did not change other part.
Updated•14 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Reporter | ||
Updated•14 years ago
|
Attachment #594199 -
Flags: review?(josh)
Reporter | ||
Updated•14 years ago
|
Attachment #594191 -
Flags: review?
Reporter | ||
Comment 5•14 years ago
|
||
Rebase the patch on http://hg.mozilla.org/mozilla-central/rev/6fbaf8cf139c
Attachment #594191 -
Attachment is obsolete: true
Attachment #594199 -
Attachment is obsolete: true
Attachment #594199 -
Flags: review?(josh)
Attachment #600674 -
Flags: review?(josh)
Updated•14 years ago
|
Attachment #600674 -
Flags: review?(josh) → review?(gavin.sharp)
Reporter | ||
Comment 6•14 years ago
|
||
When moving a tab from other window, call stack (from Venkman):
#0: function swapBrowsersAndCloseOther() in <chrome://browser/content/tabbrowser.xml> line 1871
#1: function BrowserStartup() in <chrome://browser/content/browser.js> line 4847
#2: function onload() in <chrome://browser/content/browser.xul> line 1
Comment 7•14 years ago
|
||
Comment on attachment 600674 [details] [diff] [review]
proposed patch v1.2
Let's see if Felipe can use his new review powers to speed this process along.
Attachment #600674 -
Flags: review?(gavin.sharp) → review?(felipc)
Comment 8•14 years ago
|
||
This is going to be trickier than I thought - there are popupnotifications objects that hold on to their own windows via their "options" object, e.g. the XPI install ones:
http://hg.mozilla.org/mozilla-central/annotate/c4eb6151a3bf/browser/base/content/browser.js#l774
We can't reasonably update those references automatically, and not doing so will result in a broken notification, so the status quo (no notifications) seems like a better state...
Comment 9•14 years ago
|
||
Comment on attachment 600674 [details] [diff] [review]
proposed patch v1.2
This might need to be WONTFIX, unless we can figure out a way to have the notifications re-fire "naturally"... :(
Attachment #600674 -
Flags: review?(felipc) → review-
Reporter | ||
Comment 10•14 years ago
|
||
(In reply to Gavin Sharp (use gavin@gavinsharp.com for email) from comment #8~#9)
> This is going to be trickier than I thought - there are popupnotifications
> objects that hold on to their own windows via their "options" object, e.g.
> the XPI install ones:
>
> http://hg.mozilla.org/mozilla-central/annotate/c4eb6151a3bf/browser/base/
> content/browser.js#l774
>
> We can't reasonably update those references automatically, and not doing so
> will result in a broken notification, so the status quo (no notifications)
> seems like a better state...
>
>
> This might need to be WONTFIX, unless we can figure out a way to have the
> notifications re-fire "naturally"... :(
Current Firefox can detach tab between another windows without reloading browser's content window. (This behavior is based on http://hg.mozilla.org/mozilla-central/rev/48191fdcf8a7, isn't it?)
Accordingly, I think that references of "options" object properties are updated automatically by existing implementation. In fact, with using my proposed patch v 1.2, it success the XPI install one when move to new window after starting XPI installation.
I think some approach to this bugs:
1. Use current approach.
This reason is above and this approach will be fix certainly. But this behavior may be tricky. If we apply this patch, other latent bugs may be found.
2. Use current approach but limit continued popup notifications.
This approach does not take off some risky notifications (e.g. XPI install).
So this approach take off *safe* notifications.
But this may be broken if user defined notifications are *risky*.
3. WONTFIX this bug & Make a way to re-fire the notifications "naturally":
This approach will cancel the notifications fired on old window.
For example:
1. Fire geolocation notification in tab which is on window(A).
2. Detach the tab from window(A), and Move to window(B).
3. Cancel geolocation notification as user canceled it.
This approach needs adding the canceling process to exiting notifications. And we may need to make a prompt for users.
Which approach should we take?
Reporter | ||
Comment 11•14 years ago
|
||
I thought about above approaches.
I note them:
> 1. Use current approach.
> This reason is above and this approach will be fix certainly. But this
> behavior may be tricky. If we apply this patch, other latent bugs may be
> found.
This approach will be tricky. Even if we fix this bug with this approach, the patch code will be tricky & this may leak objects. e.g. Gavin's comment( https://bugzilla.mozilla.org/show_bug.cgi?id=723951#c8)
> 2. Use current approach but limit continued popup notifications.
> This approach does not take off some risky notifications (e.g. XPI install).
> So this approach take off *safe* notifications.
> But this may be broken if user defined notifications are *risky*.
This approach will not be good. We cannot know all user defined *risky* notifications if we use a white list for this approach. As black list, we need to have the list. It's too bad.
> 3. WONTFIX this bug & Make a way to re-fire the notifications "naturally":
> This approach will cancel the notifications fired on old window.
> For example:
> 1. Fire geolocation notification in tab which is on window(A).
> 2. Detach the tab from window(A), and Move to window(B).
> 3. Cancel geolocation notification as user canceled it.
> This approach needs adding the canceling process to exiting notifications.
> And we may need to make a prompt for users.
I thought, implementing a new notification event which describes notifications are swapped from other window, and caring existing notifications with using the new event.
Reporter | ||
Comment 12•14 years ago
|
||
For implement a new notifications event (https://developer.mozilla.org/en/JavaScript_code_modules/PopupNotifications.jsm#Notification_events), we need an API to hook tabbrowser.swapBrowsersAndCloseOther() (http://mxr.mozilla.org/mozilla-central/source/browser/base/content/tabbrowser.xml#1836).
We can create the new notification event with changing only tabbrowser.swapBrowsersAndCloseOther(). But the notification event should be created in PopupNotifications.jsm.
Reporter | ||
Comment 13•14 years ago
|
||
I filed Bug 740362 for implement to hook tabbrowser.swapBrowsersAndCloseOther().
Reporter | ||
Comment 14•14 years ago
|
||
We need to swap browser.popupNotifications for treating them on new xul:browser element.
Attachment #600674 -
Attachment is obsolete: true
Reporter | ||
Comment 15•14 years ago
|
||
Implement the notification event to notify notifications are swapped.
This patch is *working draft*.
The patch part 2 or later, it depend on bug 740362.
And we need to think the event name.
Reporter | ||
Comment 16•13 years ago
|
||
I merges patches from bug 740369.
This approach need to handle the new event for existing doorhanger notifications.
But I have not implemented yet.
Attachment #611161 -
Attachment is obsolete: true
Attachment #611162 -
Attachment is obsolete: true
Attachment #637090 -
Flags: feedback?(gavin.sharp)
Reporter | ||
Comment 17•13 years ago
|
||
(In reply to :Gavin Sharp (use gavin@gavinsharp.com for email) from comment #8)
> This is going to be trickier than I thought - there are popupnotifications
> objects that hold on to their own windows via their "options" object, e.g.
> the XPI install ones:
>
> http://hg.mozilla.org/mozilla-central/annotate/c4eb6151a3bf/browser/base/
> content/browser.js#l774
>
> We can't reasonably update those references automatically, and not doing so
> will result in a broken notification, so the status quo (no notifications)
> seems like a better state...
Gavin, I re-think about calling PopupNotifications.show() in mozilla sorce tree.
Your pointed tha part ( http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser-addons.js#103 ) is an exception case, and its case will be resolved by intoroducing new popnotification event. (Its case releases the contentWindow when fire PopupNotification event callback).
Reporter | ||
Comment 18•13 years ago
|
||
This wip does not work well in some cases which pass |xul:tabbrowser.updateCurrentBrowser()| because of swap docshell to new browser.
Do you have any good ideas?
Attachment #637090 -
Attachment is obsolete: true
Attachment #637090 -
Flags: feedback?(gavin.sharp)
Reporter | ||
Updated•13 years ago
|
Attachment #690202 -
Flags: feedback?(gavin.sharp)
Reporter | ||
Comment 19•13 years ago
|
||
(In reply to Tetsuharu OHZEKI [:saneyuki_s] from comment #18)
> Created attachment 690202 [details] [diff] [review]
> wip v2
>
> This wip does not work well in some cases which pass
> |xul:tabbrowser.updateCurrentBrowser()| because of swap docshell to new
> browser.
>
> Do you have any good ideas?
Sorry. This have my mis-understanding.
This is related to http://hg.mozilla.org/mozilla-central/file/3905010a2346/browser/base/content/browser.js#l4062.
Comment 20•13 years ago
|
||
Comment on attachment 690202 [details] [diff] [review]
wip v2
This looks good - I had a few concerns:
- should TabImport be fired before _swapBrowserDocShells?
- can we fire TabImport on the old browser, rather than the new one, to remove the need to initialize PopupNotifications in the new window manually?
We'll also need to update http://hg.mozilla.org/mozilla-central/annotate/3905010a2346/browser/base/content/browser-addons.js#l93 to observe for the "swapped" event and update its "contentWindow" reference, right?
Attachment #690202 -
Flags: feedback?(gavin.sharp) → feedback+
Reporter | ||
Comment 21•13 years ago
|
||
Thank you feedback!
(In reply to :Gavin Sharp (use gavin@gavinsharp.com for email) from comment #20)
>
> - should TabImport be fired before _swapBrowserDocShells?
(I have not tested yet, but) We can change it. However, it may not be useful when using TabImport event for other purpose. Firefox has not completed a swapping step before _swapBrowserDocShells.
> - can we fire TabImport on the old browser, rather than the new one, to
> remove the need to initialize PopupNotifications in the new window manually?
Umm... It might be difficult by the current design of PopupNotifications.
The current design need to listen "activate" event necessarily by an instance of PopupNotifications constructor in the new window, for showing doorhanger icon.
I'll try to think changing the design about updating & showing notifications.
> We'll also need to update
> http://hg.mozilla.org/mozilla-central/annotate/3905010a2346/browser/base/
> content/browser-addons.js#l93 to observe for the "swapped" event and update
> its "contentWindow" reference, right?
We need add the 3rd parameter as an object (Map, Array, or simple object) to PopupNotifications._fireCallback (http://hg.mozilla.org/mozilla-central/file/3905010a2346/toolkit/content/PopupNotifications.jsm#l593).
I think it will resolve this.
Reporter | ||
Comment 22•13 years ago
|
||
Sorry. Gavin's feedback have not been reflected to this yet.
Change from wip v2:
* Fix that when notifications are not continued when swapping tab to a new window.
Attachment #690202 -
Attachment is obsolete: true
Reporter | ||
Comment 23•13 years ago
|
||
(In reply to Tetsuharu OHZEKI [:saneyuki_s] from comment #21)
> (In reply to :Gavin Sharp (use gavin@gavinsharp.com for email) from comment
> #20)
> > - can we fire TabImport on the old browser, rather than the new one, to
> > remove the need to initialize PopupNotifications in the new window manually?
>
> Umm... It might be difficult by the current design of PopupNotifications.
> The current design need to listen "activate" event necessarily by an
> instance of PopupNotifications constructor in the new window, for showing
> doorhanger icon.
> I'll try to think changing the design about updating & showing notifications.
I thought about it. This is my thought:
Even if changing the design of PopupNotifications, we need to listen some kind of event/observer-notifying on a instance of PopupNotifications, in the new window.
Also, if we import the browser element which has some doorhanger from other window to the new one, the new one must handle its doorhanger notification in either case. So we need to accept this compelling call which initialize the instance of PopupNotification in the new window.
Comment 24•13 years ago
|
||
(In reply to Tetsuharu OHZEKI [:saneyuki_s] from comment #21)
> (In reply to :Gavin Sharp (use gavin@gavinsharp.com for email) from comment
> #20)
> >
> > - should TabImport be fired before _swapBrowserDocShells?
>
> (I have not tested yet, but) We can change it. However, it may not be useful
> when using TabImport event for other purpose. Firefox has not completed a
> swapping step before _swapBrowserDocShells.
Because tab progress listeners are unregistered/restored automatically before/after _swapBrowserDocShells, addons don't need events like "BeforeTabImport" for unregister/re-register custom progress listeners anymore, for progress listeners.
However, if possible, two events "BeforeTabImport/TabImport" (or "TabImport/TabImported") are still useful, because there can be rare problems which require unregsitering/re-registering something before/after _swapBrowserDocShells manually.
If only one new event type is acceptable, then, "before" event can work both before and after, with simple setTimeout hack.
Comment 25•13 years ago
|
||
OK, sounds like we should only have the before event. I think we should try to avoid initializing PopupNotifications in the new window if it is not initialized in the old window.
Reporter | ||
Comment 26•13 years ago
|
||
Thank you for your comment, SHIMODA-san.
Gavin, I'll try to avoid initializing PopupNotifications like you said.
But my main business is very busy now. The next patch may be next year. (Sorry!)
Comment 27•13 years ago
|
||
No worries! I appreciate you working on this.
Updated•12 years ago
|
Blocks: doorhanger
Assignee | ||
Comment 29•12 years ago
|
||
Patch from bug 883326, moved here per Gavin's request. See bug 883326 for the context and discussion about previous iterations of this patch.
Attachment #810551 -
Flags: review?(dao)
Comment 30•12 years ago
|
||
Bug 919835 ended up adding a "SwapDocShells" event.
Assignee | ||
Comment 31•12 years ago
|
||
Attachment #810551 -
Attachment is obsolete: true
Attachment #810551 -
Flags: review?(dao)
Attachment #8333899 -
Flags: review?(dao)
Assignee | ||
Comment 32•12 years ago
|
||
Comment on attachment 8333899 [details] [diff] [review]
Patch v4 from bug 883326 - unbitrotted
I've just verified that this patch still applies and that the browser_popupNotification.js test still passes after the Australis landing.
Assignee | ||
Comment 33•12 years ago
|
||
Comment on attachment 8333899 [details] [diff] [review]
Patch v4 from bug 883326 - unbitrotted
This patch has been waiting for months, so trying another reviewer.
Attachment #8333899 -
Flags: review?(dao) → review?(felipc)
Comment 34•12 years ago
|
||
Comment on attachment 8333899 [details] [diff] [review]
Patch v4 from bug 883326 - unbitrotted
Review of attachment 8333899 [details] [diff] [review]:
-----------------------------------------------------------------
close, only two small changes and a question..
::: browser/modules/webrtcUI.jsm
@@ +134,5 @@
> accessKey: stringBundle.getString("getUserMedia.shareSelectedDevices.accesskey"),
> + // The real callback will be set during the "showing" event. The
> + // empty function here is so that PopupNotifications.show doesn't
> + // reject the action.
> + callback: function() {}
was it necessary to move the "showing" code outside of this callback and into the eventCallback? if so, why?
::: toolkit/modules/PopupNotifications.jsm
@@ +769,5 @@
> + let ourNotifications = this._getNotificationsForBrowser(ourBrowser);
> + let other = otherBrowser.ownerDocument.defaultView.PopupNotifications;
> + if (!other) {
> + if (ourNotifications.length > 0)
> + Components.utils.reportError("unable to swap notifications: otherBrowser doesn't support notifications");
nit: shorten it to Cu.reportError
@@ +780,5 @@
> + }
> +
> + otherNotifications = otherNotifications.filter(function (n) {
> + if (n.options.eventCallback &&
> + n.options.eventCallback.call(n, NOTIFICATION_EVENT_SWAPPING, ourBrowser)) {
it would be better if you also used _fireCallback here so that it can catch any errors thrown. You could use the ...spread operator to pass the optional argument that only this notification uses.
@@ +796,5 @@
> + n.browser = otherBrowser;
> + n.owner = other;
> + return true;
> + }
> + this._fireCallback(n, NOTIFICATION_EVENT_REMOVED);
is `this` correct here? I think it's not. use an arrow function to guarantee?
Attachment #8333899 -
Flags: review?(felipc) → feedback+
Assignee | ||
Comment 35•12 years ago
|
||
(In reply to :Felipe Gomes from comment #34)
Thanks for the feedback!
> ::: browser/modules/webrtcUI.jsm
> @@ +134,5 @@
> > accessKey: stringBundle.getString("getUserMedia.shareSelectedDevices.accesskey"),
> > + // The real callback will be set during the "showing" event. The
> > + // empty function here is so that PopupNotifications.show doesn't
> > + // reject the action.
> > + callback: function() {}
>
> was it necessary to move the "showing" code outside of this callback and
> into the eventCallback? if so, why?
Yes, so that 'chromeDoc' points to the correct chrome document, and not the chrome document where the notification was initially received.
> @@ +780,5 @@
> > + }
> > +
> > + otherNotifications = otherNotifications.filter(function (n) {
> > + if (n.options.eventCallback &&
> > + n.options.eventCallback.call(n, NOTIFICATION_EVENT_SWAPPING, ourBrowser)) {
>
> it would be better if you also used _fireCallback here so that it can catch
> any errors thrown.
I think I hadn't done it because _fireCallback didn't return the value. But I guess it wouldn't hurt to make it return the value.
> You could use the ...spread operator to pass the
> optional argument that only this notification uses.
Done in this updated patch. It's the first time I use it, so please check carefully that its usage is correct here (I verified that the patch works after the changes).
> @@ +796,5 @@
> > + n.browser = otherBrowser;
> > + n.owner = other;
> > + return true;
> > + }
> > + this._fireCallback(n, NOTIFICATION_EVENT_REMOVED);
>
> is `this` correct here? I think it's not. use an arrow function to guarantee?
It was correct, because I gave 'this' as value for the second optional parameter of Array.filter. The new patch uses arrow function, as I guess they make it easier to see that 'this' is correct :).
Assignee: nobody → florian
Attachment #8333899 -
Attachment is obsolete: true
Attachment #8350261 -
Flags: review?(felipc)
Comment 36•12 years ago
|
||
Comment on attachment 8350261 [details] [diff] [review]
Patch v5
Review of attachment 8350261 [details] [diff] [review]:
-----------------------------------------------------------------
::: toolkit/modules/PopupNotifications.jsm
@@ +812,3 @@
> try {
> if (n.options.eventCallback)
> + return n.options.eventCallback.call(n, ...args);
yep, this is correct. But you can also keep the 'event' argument named, and only ...args for the remaining ones.
like
_fireCallback: function(n, event, ...args) {
...call(n, event, ...args)
}
Attachment #8350261 -
Flags: review?(felipc) → review+
Assignee | ||
Comment 37•12 years ago
|
||
Addressed comment 36.
Assignee | ||
Comment 38•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 29
Assignee | ||
Comment 40•12 years ago
|
||
Comment on attachment 810551 [details] [diff] [review]
Patch v4 from bug 883326
Not sure why bugzilla didn't remove this pending review flag when the attachment was marked obsolete.
Attachment #810551 -
Flags: review?(dao)
Assignee | ||
Updated•12 years ago
|
Flags: in-testsuite+
You need to log in
before you can comment on or make changes to this bug.
Description
•