Closed
Bug 882858
Opened 11 years ago
Closed 11 years ago
Add a "showing" notification to PopupNotifications
Categories
(Toolkit :: General, defect, P2)
Tracking
()
RESOLVED
FIXED
mozilla24
People
(Reporter: benjamin, Assigned: benjamin)
References
Details
(Keywords: dev-doc-complete)
Attachments
(1 file)
4.35 KB,
patch
|
jaws
:
review+
Gavin
:
review+
|
Details | Diff | Splinter Review |
Currently when showing a popup notification, you have to construct the entire notification when you create it, even if it's going to start out dismissed. For the plugins notification, I would like to be able to create it and populate it only when the user opens it, since populating it is a slightly involved process which walks all the plugins in a content tree and sorts/classifies them. I can implement this by adding a "beforeshown" notification event which modifies the notification object as necessary (in this case, setting up its "centerActions" item).
Assignee | ||
Comment 1•11 years ago
|
||
Attachment #762251 -
Flags: review?(jaws)
Updated•11 years ago
|
Attachment #762251 -
Flags: review?(jaws) → review+
Comment 2•11 years ago
|
||
Comment on attachment 762251 [details] [diff] [review] Add a "beforeshown" notification to PopupNotifications, r?jaws We should get a toolkit peer to see this too though.
Attachment #762251 -
Flags: review?(mak77)
Comment 3•11 years ago
|
||
Not really your fault (you're reusing the existing test setup), but the test is a bit hard to follow. Adding a "// checkPopup ensures that the set of this.mainAction.label in the beforeshown handler is reflected in the shown popup" before the call to checkPopup would help. It's also worth noting that the test only works because the mainAction object passed to show() by showNotification() is the same object referenced by this.notifyObj.mainAction (i.e. what checkPopup uses to compare), so the set of this.mainAction.label in the beforeshown handler affects both what the popup displays and what checkPopup checks for. I don't think any of these tests relied on that behavior before, but not sure the best way to point that out in a comment. I guess you could reference this.notifyObj via a closure in the beforeshown handler and also set its .mainAction.label, for clarity.
Comment 4•11 years ago
|
||
Comment on attachment 762251 [details] [diff] [review] Add a "beforeshown" notification to PopupNotifications, r?jaws >diff --git a/browser/base/content/test/browser_popupNotification.js b/browser/base/content/test/browser_popupNotification.js > function checkPopup(popup, notificationObj) { > info("[Test #" + gTestIndex + "] checking popup"); > >+ ok(notificationObj.beforeShownCallbackTriggered, "beforeshown callback was triggered"); > ok(notificationObj.shownCallbackTriggered, "shown callback was triggered"); It might be nice for the test to ensure ordering of these events (using a counter or something rather than just boolean flags), but I guess that's not a big deal (and not likely something we'd screw up).
Attachment #762251 -
Flags: review?(mak77) → review+
Comment 5•11 years ago
|
||
is there a reason this is called beforeShown instead of showing, that is a far more common name for this kind of notification?
Assignee | ||
Comment 6•11 years ago
|
||
No, I just didn't have any context that one name was better than another. Do you want the other name?
Flags: needinfo?(mak77)
Comment 7•11 years ago
|
||
well, I don't *want* it at any cost, I just think, since the most common naming for popup things is "hidden", "showing", "shown", using "showing" here will be easier to memorize for consumers.
Flags: needinfo?(mak77)
Comment 8•11 years ago
|
||
PopupNotifications event callbacks are somewhat different from normal panel events (there is no "hidden", there are other events that don't map to panels, etc.), so I don't think consistency is that important, but I don't have any objection to calling it "showing" instead of "beforeshown".
Updated•11 years ago
|
Summary: Add a "beforeshown" notification to PopupNotifications → Add a "showing" notification to PopupNotifications
Assignee | ||
Comment 10•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/d7a1b18447fe
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
Assignee | ||
Comment 12•11 years ago
|
||
https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/PopupNotifications.jsm
Keywords: dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•