haikuwebkit/Source/WebCore/Modules/notifications
Chris Dumez 129e9cc342 Notification.requestPermission() should return a Promise
https://bugs.webkit.org/show_bug.cgi?id=225712

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Drop manual test that should not have been imported from WPT. The test happened to be using Notification.requestPermission()
internally.

* web-platform-tests/service-workers/service-worker/fetch-event-within-sw-manual.https-expected.txt: Removed.
* web-platform-tests/service-workers/service-worker/fetch-event-within-sw-manual.https.html: Removed.

Source/WebCore:

Notification.requestPermission() should return a Promise as per the specification:
- https://notifications.spec.whatwg.org/#notification

Both Firefox and Chrome already support this.

Test: http/tests/notifications/request-with-promise.html

* Modules/notifications/Notification.cpp:
(WebCore::Notification::requestPermission):
* Modules/notifications/Notification.h:
* Modules/notifications/Notification.idl:
* Modules/notifications/NotificationClient.h:

Source/WebKit:

Update code now that WebCore passes a CompletionHandler instead of a
NotificationPermissionCallback.

* WebProcess/Notifications/NotificationPermissionRequestManager.cpp:
(WebKit::NotificationPermissionRequestManager::~NotificationPermissionRequestManager):
(WebKit::NotificationPermissionRequestManager::startRequest):
* WebProcess/Notifications/NotificationPermissionRequestManager.h:
* WebProcess/WebCoreSupport/WebNotificationClient.cpp:
(WebKit::WebNotificationClient::requestPermission):
* WebProcess/WebCoreSupport/WebNotificationClient.h:

Source/WebKitLegacy/mac:

Update code now that WebCore passes a CompletionHandler instead of a
NotificationPermissionCallback.

* WebCoreSupport/WebNotificationClient.h:
* WebCoreSupport/WebNotificationClient.mm:
(WebNotificationClient::requestPermission):
(-[WebNotificationPolicyListener initWithCompletionHandler:]):
(-[WebNotificationPolicyListener allow]):
(-[WebNotificationPolicyListener deny]):

Source/WebKitLegacy/win:

Update code now that WebCore passes a CompletionHandler instead of a
NotificationPermissionCallback.

* WebCoreSupport/WebDesktopNotificationsDelegate.cpp:
(WebDesktopNotificationsDelegate::requestPermission):
* WebCoreSupport/WebDesktopNotificationsDelegate.h:

LayoutTests:

* http/tests/notifications/notification-in-non-secure-context-expected.txt:
Rebaseline test now that we log an error message in the JS console when trying to call
Notification.requestPermission() in a non-secure context.

* http/tests/notifications/request-with-promise-expected.txt: Added.
* http/tests/notifications/request-with-promise.html: Added.
Add layout test coverage.


Canonical link: https://commits.webkit.org/237670@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277420 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-13 05:02:45 +00:00
..
Notification.cpp Notification.requestPermission() should return a Promise 2021-05-13 05:02:45 +00:00
Notification.h Notification.requestPermission() should return a Promise 2021-05-13 05:02:45 +00:00
Notification.idl Notification.requestPermission() should return a Promise 2021-05-13 05:02:45 +00:00
NotificationClient.h Notification.requestPermission() should return a Promise 2021-05-13 05:02:45 +00:00
NotificationController.cpp
NotificationController.h
NotificationDirection.h
NotificationPermission.h
NotificationPermission.idl
NotificationPermissionCallback.h
NotificationPermissionCallback.idl