RESOLVED FIXED 108196
Notification.requestPermission callback should be optional
https://bugs.webkit.org/show_bug.cgi?id=108196
Summary Notification.requestPermission callback should be optional
Jake Archibald
Reported 2013-01-29 08:05:52 PST
Currently, a DOM error is thrown if the callback is omitted. Spec: http://notifications.spec.whatwg.org/#api Spec change discussion: https://github.com/whatwg/notifications/pull/1
Attachments
Patch (4.84 KB, patch)
2013-02-22 15:27 PST, Kaustubh Atrawalkar
no flags
Patch (21.39 KB, patch)
2013-02-25 16:50 PST, Kaustubh Atrawalkar
no flags
Patch (23.25 KB, patch)
2013-02-26 15:56 PST, Kaustubh Atrawalkar
no flags
Patch (9.70 KB, patch)
2013-02-27 14:51 PST, Kaustubh Atrawalkar
no flags
Patch (22.56 KB, patch)
2013-02-27 15:55 PST, Kaustubh Atrawalkar
no flags
Patch (39.78 KB, patch)
2013-02-28 12:45 PST, Kaustubh Atrawalkar
no flags
Kaustubh Atrawalkar
Comment 1 2013-02-22 15:22:25 PST
As per the discussion, I agree with making requestPermssion optional. Providing patch to make the proposed changes.
Kaustubh Atrawalkar
Comment 2 2013-02-22 15:27:09 PST
Adam Barth
Comment 3 2013-02-23 09:46:39 PST
Comment on attachment 189847 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=189847&action=review > Source/WebCore/Modules/notifications/Notification.idl:54 > - [Custom] static void requestPermission(in NotificationPermissionCallback callback); > + [Custom] static void requestPermission(in [Optional, Callback] NotificationPermissionCallback callback); Why does it need to be [Custom]? It looks like it just needs [CallWith=ScriptExecutionContext].
Adam Barth
Comment 4 2013-02-23 09:47:24 PST
Comment on attachment 189847 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=189847&action=review > LayoutTests/fast/notifications/notifications-request-permission-optional.html:18 > + shouldThrow('window.Notification.requestPermission()', notEnoughArguments); Doesn't this show that the argument is not optional? /me is confused.
Kaustubh Atrawalkar
Comment 5 2013-02-23 12:12:32 PST
(In reply to comment #3) > Why does it need to be [Custom]? It looks like it just needs [CallWith=ScriptExecutionContext]. Yes, seems fine to me as well. I just kept the semantics as it is and added optional. But changing it as suggested would be better. Will do that. (In reply to comment #4) > > LayoutTests/fast/notifications/notifications-request-permission-optional.html:18 > > + shouldThrow('window.Notification.requestPermission()', notEnoughArguments); > > Doesn't this show that the argument is not optional? /me is confused. Basically it will throw error if the argument is not optional. When requestPermission() is called without any arguments it should work as it is. If the compiler detects the argument is missing, it will throw error. in this case, as the argument is optional, it wont. I hope my understanding is right. please correct me if wrong.
Adam Barth
Comment 6 2013-02-23 12:23:48 PST
Comment on attachment 189847 [details] Patch I'm, sorry, but I don't understand what you are saying. Your patch doesn't actually change any behavior because this function has Custom bindings. I believe your test demonstrates that the argument is not optional.
Adam Barth
Comment 7 2013-02-23 12:24:14 PST
Comment on attachment 189847 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=189847&action=review > LayoutTests/fast/notifications/notifications-request-permission-optional.html:9 > +function runTests() I don't think this function is even called.
Kaustubh Atrawalkar
Comment 8 2013-02-25 16:50:12 PST
Kaustubh Atrawalkar
Comment 9 2013-02-25 16:52:15 PST
(In reply to comment #6) > (From update of attachment 189847 [details]) > I'm, sorry, but I don't understand what you are saying. Your patch doesn't actually change any behavior because this function has Custom bindings. I believe your test demonstrates that the argument is not optional. I removed the Custom bindings and updated the idl file with [CallWith=ScriptExecutionContext]. Also updated the test case to make a call. Can you review once?
Adam Barth
Comment 10 2013-02-25 16:57:55 PST
Comment on attachment 190156 [details] Patch this looks much better
Early Warning System Bot
Comment 11 2013-02-25 17:13:30 PST
Kaustubh Atrawalkar
Comment 12 2013-02-25 17:16:06 PST
(In reply to comment #10) > (From update of attachment 190156 [details]) > this looks much better Thank you for the quick review. This is still not final patch. Seems there are few build breaks. I will fix those and put up patch again.
Early Warning System Bot
Comment 13 2013-02-25 17:17:11 PST
Build Bot
Comment 14 2013-02-25 17:30:42 PST
Comment on attachment 190156 [details] Patch Attachment 190156 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://queues.webkit.org/results/16743632
Build Bot
Comment 15 2013-02-25 18:02:58 PST
WebKit Review Bot
Comment 16 2013-02-26 13:55:01 PST
Comment on attachment 190156 [details] Patch Attachment 190156 [details] did not pass chromium-ews (chromium-xvfb): Output: http://webkit-commit-queue.appspot.com/results/16780353 New failing tests: fast/notifications/notifications-rtl.html
Kaustubh Atrawalkar
Comment 17 2013-02-26 15:56:52 PST
Kentaro Hara
Comment 18 2013-02-26 16:06:50 PST
Comment on attachment 190382 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=190382&action=review The change looks good. A couple of comments on the test. > LayoutTests/fast/notifications/notifications-request-permission-optional.html:9 > +function log(message) > +{ > + document.getElementById("result").innerHTML += message + "<br>"; > +} Nit: Remove this. > LayoutTests/fast/notifications/notifications-request-permission-optional.html:14 > + if (window.testRunner) > + testRunner.dumpAsText(); > + Nit: This is not needed. > LayoutTests/fast/notifications/notifications-request-permission-optional.html:16 > + if (!window.webkitNotifications) > + log("FAIL: No webkitNotification interface!"); You can write: shouldNotBe('!window.webkitNotifications'); > LayoutTests/fast/notifications/notifications-request-permission-optional.html:25 > +runTests(); Nit: Now the test is just two lines. You can directly write the test here. > LayoutTests/fast/notifications/notifications-request-permission-optional.html:27 > +</body> Please add <script src="../js/resources/js-test-post.js"></script>
Kaustubh Atrawalkar
Comment 19 2013-02-26 16:40:37 PST
(In reply to comment #18) > (From update of attachment 190382 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=190382&action=review > > The change looks good. A couple of comments on the test. Thanks :) I made those change. Will be landing patch soon.
Kaustubh Atrawalkar
Comment 20 2013-02-26 16:55:03 PST
Stephen Chenney
Comment 21 2013-02-26 18:43:43 PST
Reopening. This is causing crashes in fast/notifications/notifications-request-permission.html http://test-results.appspot.com/dashboards/flakiness_dashboard.html#tests=fast%2Fnotifications%2Fnotifications-request-permission.html Expectations added in r144134.
Stephen Chenney
Comment 22 2013-02-26 18:44:54 PST
Why on earth can't I reopen this bug?
Adam Barth
Comment 23 2013-02-26 21:02:55 PST
Reopening
Adam Barth
Comment 24 2013-02-26 21:03:09 PST
Hum... Seems to work for me...
Adam Barth
Comment 25 2013-02-26 21:04:34 PST
Stephen, I just ran a script to give you canconfirm and editbugs. You probably already had them, however. :)
Vsevolod Vlasov
Comment 26 2013-02-27 00:35:24 PST
Layout test fast/notifications/notifications-request-permission-optional.html is also crashing flakily. Filed https://bugs.webkit.org/show_bug.cgi?id=110956 and marked as crashing in http://trac.webkit.org/changeset/144153
Thiago Marcos P. Santos
Comment 27 2013-02-27 01:33:50 PST
Just a nit, remember to fix the bindings generator tests that is failing after this patch.
Kaustubh Atrawalkar
Comment 28 2013-02-27 11:05:10 PST
I will try to fix these asap. Thank you.
Stephen Chenney
Comment 29 2013-02-27 11:39:22 PST
I fixed the bindings generator test in http://trac.webkit.org/changeset/144176
Kaustubh Atrawalkar
Comment 30 2013-02-27 14:51:57 PST
Early Warning System Bot
Comment 31 2013-02-27 15:10:26 PST
Kaustubh Atrawalkar
Comment 32 2013-02-27 15:25:48 PST
Thats what i was trying to find the JS Custom bindings file for NotificationCenter. It was with different name. Adding new patch.
Kaustubh Atrawalkar
Comment 33 2013-02-27 15:55:00 PST
Zoltan Arvai
Comment 34 2013-02-28 02:48:23 PST
On Qt fast/notifications/notifications-request-permission-optional.html test causes other test to crash: 02:19:50.168 16160 worker/0 fast/notifications/notifications-request-permission-optional.html passed 02:19:50.294 16160 worker/0 fast/notifications/notifications-rtl.html crashed, (stderr lines): http://build.webkit.sed.hu/builders/x86-64%20Linux%20Qt%20Release/builds/48658/steps/layout-test/logs/stdio
Adam Barth
Comment 35 2013-02-28 11:27:55 PST
If this patch is causing crashes, we should roll it out.
Kaustubh Atrawalkar
Comment 36 2013-02-28 12:45:40 PST
Kaustubh Atrawalkar
Comment 37 2013-02-28 12:58:49 PST
Merged both patches together. It required NotificationCenter class as well to have requestPermission callback as optional. Removed both custom bindings from Notification.idl & NotificationCenter.idl. Please review once.
Kentaro Hara
Comment 38 2013-02-28 13:17:45 PST
What is the current status? The patch that caused the crashes was rolled out, and now you are going to reland the patch with proper fixes, right?
Kaustubh Atrawalkar
Comment 39 2013-02-28 13:45:09 PST
Yes that's correct. I have merged both patches together. Can you review?
Kentaro Hara
Comment 40 2013-02-28 13:46:18 PST
Comment on attachment 190786 [details] Patch LGTM. Please keep watching the build tree when landing.
Kaustubh Atrawalkar
Comment 41 2013-02-28 13:55:29 PST
(In reply to comment #40) > (From update of attachment 190786 [details]) > LGTM. Please keep watching the build tree when landing. Sure I will keep eye on build tree. Thanks.
WebKit Review Bot
Comment 42 2013-02-28 14:59:48 PST
Comment on attachment 190786 [details] Patch Clearing flags on attachment: 190786 Committed r144376: <http://trac.webkit.org/changeset/144376>
WebKit Review Bot
Comment 43 2013-02-28 14:59:55 PST
All reviewed patches have been landed. Closing bug.
Kaustubh Atrawalkar
Comment 44 2013-02-28 17:28:31 PST
*** Bug 110956 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.