Open Bug 836194 Opened 12 years ago Updated 1 year ago

Remove Notification.reshow and replace calls to it with PopupNotifications.Show

Categories

(Toolkit :: PopupNotifications and Notification Bars, defect)

defect

Tracking

()

People

(Reporter: jaws, Unassigned)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch WIP patch (obsolete) (deleted) — Splinter Review
The Notification.show method wasn't super necessary. The nice thing about it was that it meant that the caller didn't need to build up all the of the details about the notification if all it wanted to do is pop out the notification from a dismissed state.

However, this function isn't really necessary. If there are multiple places where show() would have been called, the calling of show() can just be refactored to reduce this duplication.

This patch attempts to remove the duplication and go back to just using PopupNotifications.show().
Attachment #708000 - Flags: feedback?(dkeeler)
Comment on attachment 708000 [details] [diff] [review]
WIP patch

Review of attachment 708000 [details] [diff] [review]:
-----------------------------------------------------------------

This seems like a reasonable solution.

::: browser/base/content/browser-plugins.js
@@ +278,5 @@
>        return !isInvisible;
>      });
>  
>      let notification = PopupNotifications.getNotification("click-to-play-plugins", aBrowser);
> +    if (notification && plugins.length > 0 && !haveVisibleCTPPlugin && !this._notificationDisplayedOnce)

We probably don't need 'notification' here anymore.

::: toolkit/content/PopupNotifications.jsm
@@ -70,5 @@
>      return anchorElement;
>    },
> -
> -  reshow: function() {
> -    this.owner._reshowNotificationForAnchor(this.anchorElement);

I think _reshowNotificationForAnchor was added along with this function, so you can probably revert that, too.
Attachment #708000 - Flags: feedback?(dkeeler) → feedback+
Attached patch Patch v.1 (deleted) — Splinter Review
This patch is almost ready, but is failing two tests that I need to look in to.
Attachment #708000 - Attachment is obsolete: true
Blocks: 820678
Saneyuki, would you be able to help fix the two failing tests (browser_plugnnotifications.js and browser_plugins_added_dynamically.js)?
Flags: needinfo?(saneyuki.s.snyk)
I haven't read their codes well yet, but I'll saying my opinion is that:

I seem the new code sometimes calls PopupNotifications.show() with |dismissed = true|. But test files assumes that browser always show the doorhanger popup (This means always pass |dismissed = false|.) Thus the doorhanger's event callback are not called.

The patch part 3 which I proposed in bug 820678 always show the doorhanger popup with passing |dismissed = false| for avoiding this test's assumption.
However, the new codes don't continues PopupNotifications::Notification object. We cannot use this hack.

So we might need to change the test codes to non-depend on the doorhanger popup, or... continues the PopupNotifications::Notification object after calls PopupNotifications.show() via gPluginHandler.showClickToPlayNotification().

(Incidentally, I wrote my stance about removing Notification.reshow() is bug 820678's Comment38, the part of replying to Gavin.)
Flags: needinfo?(saneyuki.s.snyk)
Unassigning as I haven't been working on this and I don't want to hold people up.
Assignee: jaws → nobody
Status: ASSIGNED → NEW
Bulk move to Toolkit::Notifications and Alerts

Filter on notifications-and-alerts-component.
Component: General → Notifications and Alerts
Product: Firefox → Toolkit
Version: Trunk → unspecified
Severity: normal → S3
Component: Notifications and Alerts → PopupNotifications and Notification Bars
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: