Closed
Bug 1241278
Opened 8 years ago
Closed 8 years ago
`Notification.requestPermission()` should return a promise
Categories
(Core :: DOM: Push Subscriptions, defect)
Core
DOM: Push Subscriptions
Tracking
()
RESOLVED
FIXED
mozilla47
People
(Reporter: lina, Assigned: lina)
References
(Blocks 1 open bug)
Details
(Keywords: dev-doc-complete, site-compat)
Attachments
(1 file, 1 obsolete file)
Per https://notifications.spec.whatwg.org/#dom-notification-permission, the callback argument is deprecated. `Notification.requestPermission` should return a promise fulfilled with the permission, invoking the callback if given.
Assignee | ||
Updated•8 years ago
|
Assignee: nobody → kcambridge
Status: NEW → ASSIGNED
Assignee | ||
Comment 1•8 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/31671/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/31671/
Attachment #8710151 -
Flags: review?(amarchesini)
Updated•8 years ago
|
Attachment #8710151 -
Flags: review?(amarchesini) → review+
Comment 2•8 years ago
|
||
Comment on attachment 8710151 [details] MozReview Request: Bug 1241278 - Change `Notification.requestPermission()` to return a promise. r=baku https://reviewboard.mozilla.org/r/31671/#review28459 Do we have any plan to remove the callback completely? In case, file a bug as follow up. ::: dom/notification/Notification.cpp:254 (Diff revision 1) > { MOZ_ASSERT(aPromise) ::: dom/notification/Notification.cpp:650 (Diff revision 1) > NotificationPermissionRequest::CallCallback() rename this to ResolvePromise()
Assignee | ||
Comment 3•8 years ago
|
||
Comment on attachment 8710151 [details] MozReview Request: Bug 1241278 - Change `Notification.requestPermission()` to return a promise. r=baku Review request updated; see interdiff: https://reviewboard.mozilla.org/r/31671/diff/1-2/
Attachment #8710151 -
Attachment description: MozReview Request: Bug 1241278 - Change `Notification.requestPermission()` to return a promise. r?baku → MozReview Request: Bug 1241278 - Change `Notification.requestPermission()` to return a promise. r=baku
Assignee | ||
Comment 4•8 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/31791/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/31791/
Attachment #8710545 -
Flags: review?(vladan.bugzilla)
Assignee | ||
Comment 5•8 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=ccf7235de46d
Assignee | ||
Updated•8 years ago
|
Keywords: leave-open
Comment 7•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/86d2d6d0500e
Comment 8•8 years ago
|
||
Comment on attachment 8710545 [details] MozReview Request: Bug 1241278 - Record telemetry for notification permission callback usage. r?vladan https://reviewboard.mozilla.org/r/31791/#review28965 ::: toolkit/components/telemetry/Histograms.json:10019 (Diff revision 1) > + "kind": "count", This will generate a histogram of the # of times the callback version of this API was called per Firefox session. Due to the nature of count histograms, the 0 bucket will be omitted, so you will actually get a distribution of the # of times this version of the function was called per session (among sessions that called this version of the function at least once). Will that be enough to gauge its popularity? Would it be better to count these with a boolean histogram, so that you end up with a ratio of sessions that used the callback version vs the promise version? ::: toolkit/components/telemetry/Histograms.json:10020 (Diff revision 1) > + "description": "Usage of the deprecated Notification.requestPermission() callback argument" add an alert_emails field
Attachment #8710545 -
Flags: review?(vladan.bugzilla)
Assignee | ||
Comment 9•8 years ago
|
||
https://reviewboard.mozilla.org/r/31791/#review28965 > This will generate a histogram of the # of times the callback version of this API was called per Firefox session. > > Due to the nature of count histograms, the 0 bucket will be omitted, so you will actually get a distribution of the # of times this version of the function was called per session (among sessions that called this version of the function at least once). > > Will that be enough to gauge its popularity? Would it be better to count these with a boolean histogram, so that you end up with a ratio of sessions that used the callback version vs the promise version? You're right; I'd like to know which version is used, not the number of callback uses. Thank you!
Assignee | ||
Comment 10•8 years ago
|
||
Comment on attachment 8710545 [details] MozReview Request: Bug 1241278 - Record telemetry for notification permission callback usage. r?vladan Review request updated; see interdiff: https://reviewboard.mozilla.org/r/31791/diff/1-2/
Attachment #8710545 -
Flags: review?(vladan.bugzilla)
Assignee | ||
Updated•8 years ago
|
Attachment #8710151 -
Attachment is obsolete: true
Updated•8 years ago
|
Attachment #8710545 -
Flags: review?(vladan.bugzilla) → review+
Comment 11•8 years ago
|
||
Comment on attachment 8710545 [details] MozReview Request: Bug 1241278 - Record telemetry for notification permission callback usage. r?vladan https://reviewboard.mozilla.org/r/31791/#review29479
Assignee | ||
Updated•8 years ago
|
Keywords: leave-open
Comment 13•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/76f015b2176f
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox47:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Comment 14•8 years ago
|
||
Posted the site compatibility doc: https://www.fxsitecompat.com/en-CA/docs/2016/callback-function-of-notification-requestpermission-has-been-deprecated/
Keywords: dev-doc-needed,
site-compat
Comment 15•8 years ago
|
||
Thanks for the help in updating the MDN docs, Kit! I've expanded the details a little bit, to include browser compat information, and showing the older syntax alongside the promise just for completeness: https://developer.mozilla.org/en-US/docs/Web/API/Notification/requestPermission I've also updated compat info and code syntax in other places: https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API https://developer.mozilla.org/en-US/docs/Web/API/notification https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API I've also updated my silly emogotchi demo to use the new syntax: http://mdn.github.io/emogotchi/ And finally, I've added a note to the relevant release notes:
Keywords: dev-doc-needed → dev-doc-complete
Comment 16•8 years ago
|
||
*ahem* ... And finally, I've added a note to the relevant release notes: https://developer.mozilla.org/en-US/Firefox/Releases/47#Others
You need to log in
before you can comment on or make changes to this bug.
Description
•