[webkit-changes] [WebKit/WebKit] aab63a: Expose the Notification API to dedicated workers

Chris Dumez noreply at github.com
Fri Sep 23 13:01:03 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: aab63a24c2e8666462d8ceb81083c54a102964bc
      https://github.com/WebKit/WebKit/commit/aab63a24c2e8666462d8ceb81083c54a102964bc
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2022-09-23 (Fri, 23 Sep 2022)

  Changed paths:
    A LayoutTests/http/tests/notifications/show-notification-worker.js
    A LayoutTests/http/tests/notifications/worker-show-notification-expected.txt
    A LayoutTests/http/tests/notifications/worker-show-notification.html
    M LayoutTests/imported/w3c/web-platform-tests/notifications/historical.any.worker-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/notifications/idlharness.https.any.worker-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/wasm/serialization/module/serialization-via-notifications-api.any.worker-expected.txt
    M Source/WebCore/Modules/notifications/Notification.cpp
    M Source/WebCore/Modules/notifications/Notification.h
    M Source/WebCore/Modules/notifications/Notification.idl
    M Source/WebCore/Modules/notifications/NotificationClient.h
    M Source/WebCore/Modules/notifications/NotificationData.cpp
    M Source/WebCore/Modules/notifications/NotificationData.h
    M Source/WebCore/Modules/notifications/NotificationDataCocoa.mm
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp
    M Source/WebCore/workers/DedicatedWorkerGlobalScope.h
    A Source/WebCore/workers/WorkerNotificationClient.cpp
    A Source/WebCore/workers/WorkerNotificationClient.h
    M Source/WebKit/WebProcess/Notifications/WebNotificationManager.cpp
    M Source/WebKit/WebProcess/Notifications/WebNotificationManager.h
    M Source/WebKit/WebProcess/WebCoreSupport/WebNotificationClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebNotificationClient.h
    M Source/WebKitLegacy/mac/WebCoreSupport/WebNotificationClient.h
    M Source/WebKitLegacy/mac/WebCoreSupport/WebNotificationClient.mm
    M Source/WebKitLegacy/mac/WebCoreSupport/WebSecurityOrigin.mm
    M Source/WebKitLegacy/mac/WebCoreSupport/WebSecurityOriginInternal.h
    M Source/WebKitLegacy/mac/WebView/WebNotification.h
    M Source/WebKitLegacy/mac/WebView/WebNotification.mm
    M Source/WebKitLegacy/mac/WebView/WebNotificationInternal.h
    M Source/WebKitLegacy/mac/WebView/WebView.mm
    M Source/WebKitLegacy/mac/WebView/WebViewPrivate.h
    M Tools/DumpRenderTree/mac/MockWebNotificationProvider.h
    M Tools/DumpRenderTree/mac/MockWebNotificationProvider.mm
    M Tools/DumpRenderTree/mac/TestRunnerMac.mm

  Log Message:
  -----------
  Expose the Notification API to dedicated workers
https://bugs.webkit.org/show_bug.cgi?id=245531

Reviewed by Geoffrey Garen.

Expose the Notification API to dedicated workers as per the specification:
- https://notifications.spec.whatwg.org/#api

Blink and Gecko already support this.

We're supposed to expose the API to shared workers as well but I haven't
done so in this patch to decrease patch complexity and size.

* LayoutTests/http/tests/notifications/show-notification-worker.js: Added.
(onmessage):
* LayoutTests/http/tests/notifications/worker-show-notification-expected.txt: Added.
* LayoutTests/http/tests/notifications/worker-show-notification.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/notifications/historical.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/notifications/idlharness.https.any.worker-expected.txt:
* Source/WebCore/Modules/notifications/Notification.cpp:
(WebCore::Notification::create):
(WebCore::Notification::Notification):
(WebCore::Notification::~Notification):
(WebCore::Notification::show):
(WebCore::Notification::close):
(WebCore::Notification::stop):
(WebCore::Notification::dispatchShowEvent):
(WebCore::Notification::dispatchClickEvent):
(WebCore::Notification::dispatchCloseEvent):
(WebCore::Notification::dispatchErrorEvent):
(WebCore::Notification::data const):
(WebCore::Notification::ensureOnNotificationThread):
* Source/WebCore/Modules/notifications/Notification.h:
* Source/WebCore/Modules/notifications/Notification.idl:
* Source/WebCore/Modules/notifications/NotificationClient.h:
* Source/WebCore/Modules/notifications/NotificationData.cpp:
(WebCore::NotificationData::isolatedCopy const):
(WebCore::NotificationData::isolatedCopy):
* Source/WebCore/Modules/notifications/NotificationData.h:
(WebCore::NotificationData::isPersistent const):
(WebCore::NotificationData::encode const):
(WebCore::NotificationData::decode):
* Source/WebCore/Modules/notifications/NotificationDataCocoa.mm:
(WebCore::NotificationData::fromDictionary):
(WebCore::NotificationData::dictionaryRepresentation const):
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp:
(WebCore::DedicatedWorkerGlobalScope::notificationClient):
* Source/WebCore/workers/DedicatedWorkerGlobalScope.h:
* Source/WebCore/workers/WorkerNotificationClient.cpp: Added.
(WebCore::WorkerNotificationClient::create):
(WebCore::WorkerNotificationClient::WorkerNotificationClient):
(WebCore::WorkerNotificationClient::show):
(WebCore::WorkerNotificationClient::cancel):
(WebCore::WorkerNotificationClient::notificationObjectDestroyed):
(WebCore::WorkerNotificationClient::notificationControllerDestroyed):
(WebCore::WorkerNotificationClient::requestPermission):
(WebCore::WorkerNotificationClient::checkPermission):
(WebCore::WorkerNotificationClient::postToMainThread):
(WebCore::WorkerNotificationClient::postToWorkerThread):
* Source/WebCore/workers/WorkerNotificationClient.h: Copied from Source/WebKit/WebProcess/WebCoreSupport/WebNotificationClient.h.
* Source/WebKit/WebProcess/Notifications/WebNotificationManager.cpp:
(WebKit::sendMessage):
(WebKit::WebNotificationManager::sendNotificationMessage):
(WebKit::WebNotificationManager::sendNotificationMessageWithAsyncReply):
(WebKit::WebNotificationManager::show):
(WebKit::WebNotificationManager::cancel):
(WebKit::WebNotificationManager::didDestroyNotification):
(WebKit::WebNotificationManager::didShowNotification):
(WebKit::WebNotificationManager::didClickNotification):
(WebKit::WebNotificationManager::didCloseNotifications):
* Source/WebKit/WebProcess/Notifications/WebNotificationManager.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebNotificationClient.cpp:
(WebKit::WebNotificationClient::show):
(WebKit::WebNotificationClient::cancel):
(WebKit::WebNotificationClient::notificationObjectDestroyed):
* Source/WebKit/WebProcess/WebCoreSupport/WebNotificationClient.h:
* Source/WebKitLegacy/mac/WebCoreSupport/WebNotificationClient.h:
* Source/WebKitLegacy/mac/WebCoreSupport/WebNotificationClient.mm:
(WebNotificationClient::show):
(WebNotificationClient::cancel):
(WebNotificationClient::notificationObjectDestroyed):
(generateNotificationID): Deleted.
(WebNotificationClient::notificationIDForTesting): Deleted.
* Source/WebKitLegacy/mac/WebCoreSupport/WebSecurityOrigin.mm:
(-[WebSecurityOrigin _initWithString:]):
* Source/WebKitLegacy/mac/WebCoreSupport/WebSecurityOriginInternal.h:
* Source/WebKitLegacy/mac/WebView/WebNotification.h:
* Source/WebKitLegacy/mac/WebView/WebNotification.mm:
(-[WebNotification initWithCoreNotification:]):
(-[WebNotification title]):
(-[WebNotification body]):
(-[WebNotification tag]):
(-[WebNotification iconURL]):
(-[WebNotification lang]):
(-[WebNotification dir]):
(-[WebNotification origin]):
(-[WebNotification notificationID]):
(-[WebNotification dispatchShowEvent]):
(-[WebNotification dispatchCloseEvent]):
(-[WebNotification dispatchClickEvent]):
(-[WebNotification dispatchErrorEvent]):
(-[WebNotification finalize]):
(core): Deleted.
(-[WebNotification initWithCoreNotification:notificationID:]): Deleted.
* Source/WebKitLegacy/mac/WebView/WebNotificationInternal.h:
* Source/WebKitLegacy/mac/WebView/WebView.mm:
(-[WebView _notificationDidShow:]):
(-[WebView _notificationDidClick:]):
(-[WebView _notificationIDForTesting:]):
* Source/WebKitLegacy/mac/WebView/WebViewPrivate.h:
* Tools/DumpRenderTree/mac/MockWebNotificationProvider.h:
* Tools/DumpRenderTree/mac/MockWebNotificationProvider.mm:
(-[MockWebNotificationProvider showNotification:fromWebView:]):
(-[MockWebNotificationProvider cancelNotification:]):
(-[MockWebNotificationProvider notificationDestroyed:]):
(-[MockWebNotificationProvider clearNotifications:]):
(-[MockWebNotificationProvider webView:didShowNotification:]):
(-[MockWebNotificationProvider webView:didClickNotification:]):
(-[MockWebNotificationProvider webView:didCloseNotifications:]):
(-[MockWebNotificationProvider simulateWebNotificationClick:]):
* Tools/DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::simulateWebNotificationClick):

Canonical link: https://commits.webkit.org/254805@main




More information about the webkit-changes mailing list