Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
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
- Loading branch information