Title: [287253] trunk/Source
Revision
287253
Author
beid...@apple.com
Date
2021-12-19 21:03:26 -0800 (Sun, 19 Dec 2021)

Log Message

Stub out NotificationEvent and related
https://bugs.webkit.org/show_bug.cgi?id=234420

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (Disabled for now, no behavior change)

This patch adds stubs for NotificationEvent and the related classes/functions that use it.

Enabling just the stubs throws LayoutTests into a chaotic state that is not useful to manage with
test expectations files. So this also puts the related changes behind a disabled-by-default runtime switch.

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:

* Modules/notifications/Notification.h:
* Modules/notifications/Notification.idl:

* Modules/notifications/NotificationDirection.idl: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl.

* Modules/notifications/NotificationEvent.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl.
(WebCore::NotificationEvent::~NotificationEvent):
* Modules/notifications/NotificationEvent.h: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl.
* Modules/notifications/NotificationEvent.idl: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl.

* Modules/notifications/NotificationOptions.h: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl.
* Modules/notifications/NotificationOptions.idl: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl.

* bindings/js/WebCoreBuiltinNames.h:

* dom/EventNames.h:
* dom/EventNames.in:

* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setNotificationEventEnabled):
(WebCore::RuntimeEnabledFeatures::notificationEventEnabled const):

* workers/service/ServiceWorkerGlobalScope.idl:

* workers/service/ServiceWorkerRegistration.cpp:
(WebCore::ServiceWorkerRegistration::showNotification):
(WebCore::ServiceWorkerRegistration::getNotifications):
* workers/service/ServiceWorkerRegistration.h:
* workers/service/ServiceWorkerRegistration.idl:

Source/WTF:

* Scripts/Preferences/WebPreferencesInternal.yaml:

* wtf/PlatformEnable.h:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (287252 => 287253)


--- trunk/Source/WTF/ChangeLog	2021-12-20 03:37:38 UTC (rev 287252)
+++ trunk/Source/WTF/ChangeLog	2021-12-20 05:03:26 UTC (rev 287253)
@@ -1,3 +1,14 @@
+2021-12-19  Brady Eidson  <beid...@apple.com>
+
+        Stub out NotificationEvent and related
+        https://bugs.webkit.org/show_bug.cgi?id=234420
+
+        Reviewed by Alex Christensen.
+
+        * Scripts/Preferences/WebPreferencesInternal.yaml:
+
+        * wtf/PlatformEnable.h:
+
 2021-12-18  Darin Adler  <da...@apple.com>
 
         Hash tables, read/write, and heap memory are used unnecessarily, which may hurt performance

Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml (287252 => 287253)


--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml	2021-12-20 03:37:38 UTC (rev 287252)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml	2021-12-20 05:03:26 UTC (rev 287253)
@@ -596,6 +596,18 @@
     WebKitLegacy:
       default: false
 
+NotificationEventEnabled:
+  type: bool
+  humanReadableName: "NotificationEvent support"
+  humanReadableDescription: "NotificationEvent and ServiceWorkerRegistration.showNotification() support"
+  webcoreBinding: RuntimeEnabledFeatures
+  condition: ENABLE(NOTIFICATION_EVENT)
+  defaultValue:
+    WebCore:
+      default: false
+    WebKit:
+      default: false
+
 OffscreenCanvasEnabled:
   type: bool
   humanReadableName: "OffscreenCanvas"

Modified: trunk/Source/WTF/wtf/PlatformEnable.h (287252 => 287253)


--- trunk/Source/WTF/wtf/PlatformEnable.h	2021-12-20 03:37:38 UTC (rev 287252)
+++ trunk/Source/WTF/wtf/PlatformEnable.h	2021-12-20 05:03:26 UTC (rev 287253)
@@ -945,3 +945,9 @@
 #if ENABLE(WEBXR_HANDS) && !ENABLE(WEBXR)
 #error "ENABLE(WEBXR_HANDS) requires ENABLE(WEBXR)"
 #endif
+
+#if ENABLE(SERVICE_WORKER) && ENABLE(NOTIFICATIONS)
+#if !defined(ENABLE_NOTIFICATION_EVENT)
+#define ENABLE_NOTIFICATION_EVENT 1
+#endif
+#endif

Modified: trunk/Source/WebCore/CMakeLists.txt (287252 => 287253)


--- trunk/Source/WebCore/CMakeLists.txt	2021-12-20 03:37:38 UTC (rev 287252)
+++ trunk/Source/WebCore/CMakeLists.txt	2021-12-20 05:03:26 UTC (rev 287253)
@@ -473,6 +473,9 @@
     Modules/model-element/HTMLModelElementCamera.idl
 
     Modules/notifications/Notification.idl
+    Modules/notifications/NotificationDirection.idl
+    Modules/notifications/NotificationEvent.idl
+    Modules/notifications/NotificationOptions.idl
     Modules/notifications/NotificationPermission.idl
     Modules/notifications/NotificationPermissionCallback.idl
 

Modified: trunk/Source/WebCore/ChangeLog (287252 => 287253)


--- trunk/Source/WebCore/ChangeLog	2021-12-20 03:37:38 UTC (rev 287252)
+++ trunk/Source/WebCore/ChangeLog	2021-12-20 05:03:26 UTC (rev 287253)
@@ -1,3 +1,54 @@
+2021-12-19  Brady Eidson  <beid...@apple.com>
+
+        Stub out NotificationEvent and related
+        https://bugs.webkit.org/show_bug.cgi?id=234420
+
+        Reviewed by Alex Christensen.
+
+        No new tests (Disabled for now, no behavior change)
+        
+        This patch adds stubs for NotificationEvent and the related classes/functions that use it.
+        
+        Enabling just the stubs throws LayoutTests into a chaotic state that is not useful to manage with
+        test expectations files. So this also puts the related changes behind a disabled-by-default runtime switch.
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        
+        * Modules/notifications/Notification.h:
+        * Modules/notifications/Notification.idl:
+        
+        * Modules/notifications/NotificationDirection.idl: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl.
+        
+        * Modules/notifications/NotificationEvent.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl.
+        (WebCore::NotificationEvent::~NotificationEvent):
+        * Modules/notifications/NotificationEvent.h: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl.
+        * Modules/notifications/NotificationEvent.idl: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl.
+        
+        * Modules/notifications/NotificationOptions.h: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl.
+        * Modules/notifications/NotificationOptions.idl: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl.
+        
+        * bindings/js/WebCoreBuiltinNames.h:
+        
+        * dom/EventNames.h:
+        * dom/EventNames.in:
+        
+        * page/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::setNotificationEventEnabled):
+        (WebCore::RuntimeEnabledFeatures::notificationEventEnabled const):
+        
+        * workers/service/ServiceWorkerGlobalScope.idl:
+        
+        * workers/service/ServiceWorkerRegistration.cpp:
+        (WebCore::ServiceWorkerRegistration::showNotification):
+        (WebCore::ServiceWorkerRegistration::getNotifications):
+        * workers/service/ServiceWorkerRegistration.h:
+        * workers/service/ServiceWorkerRegistration.idl:
+
 2021-12-19  Simon Fraser  <simon.fra...@apple.com>
 
         Minor cleanup in aisle EventHandler::handleWheelEventInAppropriateEnclosingBox()

Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (287252 => 287253)


--- trunk/Source/WebCore/DerivedSources-input.xcfilelist	2021-12-20 03:37:38 UTC (rev 287252)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist	2021-12-20 05:03:26 UTC (rev 287253)
@@ -541,6 +541,9 @@
 $(PROJECT_DIR)/Modules/modern-media-controls/media/volume-support.js
 $(PROJECT_DIR)/Modules/modern-media-controls/media/watchos-media-controls-support.js
 $(PROJECT_DIR)/Modules/notifications/Notification.idl
+$(PROJECT_DIR)/Modules/notifications/NotificationDirection.idl
+$(PROJECT_DIR)/Modules/notifications/NotificationEvent.idl
+$(PROJECT_DIR)/Modules/notifications/NotificationOptions.idl
 $(PROJECT_DIR)/Modules/notifications/NotificationPermission.idl
 $(PROJECT_DIR)/Modules/notifications/NotificationPermissionCallback.idl
 $(PROJECT_DIR)/Modules/paymentrequest/AddressErrors.idl

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (287252 => 287253)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2021-12-20 03:37:38 UTC (rev 287252)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2021-12-20 05:03:26 UTC (rev 287253)
@@ -1717,6 +1717,12 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNonElementParentNode.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNotification.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNotification.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNotificationDirection.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNotificationDirection.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNotificationEvent.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNotificationEvent.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNotificationOptions.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNotificationOptions.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNotificationPermission.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNotificationPermission.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNotificationPermissionCallback.cpp

Modified: trunk/Source/WebCore/DerivedSources.make (287252 => 287253)


--- trunk/Source/WebCore/DerivedSources.make	2021-12-20 03:37:38 UTC (rev 287252)
+++ trunk/Source/WebCore/DerivedSources.make	2021-12-20 05:03:26 UTC (rev 287253)
@@ -461,6 +461,9 @@
     $(WebCore)/Modules/model-element/HTMLModelElement.idl \
     $(WebCore)/Modules/model-element/HTMLModelElementCamera.idl \
     $(WebCore)/Modules/notifications/Notification.idl \
+    $(WebCore)/Modules/notifications/NotificationDirection.idl \
+    $(WebCore)/Modules/notifications/NotificationEvent.idl \
+    $(WebCore)/Modules/notifications/NotificationOptions.idl \
     $(WebCore)/Modules/notifications/NotificationPermission.idl \
     $(WebCore)/Modules/notifications/NotificationPermissionCallback.idl \
     $(WebCore)/Modules/paymentrequest/AddressErrors.idl \

Modified: trunk/Source/WebCore/Modules/notifications/Notification.h (287252 => 287253)


--- trunk/Source/WebCore/Modules/notifications/Notification.h	2021-12-20 03:37:38 UTC (rev 287252)
+++ trunk/Source/WebCore/Modules/notifications/Notification.h	2021-12-20 05:03:26 UTC (rev 287253)
@@ -48,7 +48,7 @@
 
 struct NotificationData;
 
-class Notification final : public RefCounted<Notification>, public ActiveDOMObject, public EventTargetWithInlineData {
+class Notification final : public ThreadSafeRefCounted<Notification>, public ActiveDOMObject, public EventTargetWithInlineData {
     WTF_MAKE_ISO_ALLOCATED_EXPORT(Notification, WEBCORE_EXPORT);
 public:
     using Permission = NotificationPermission;
@@ -91,8 +91,8 @@
 
     WEBCORE_EXPORT NotificationData dataWithoutNotificationID() const;
 
-    using RefCounted::ref;
-    using RefCounted::deref;
+    using ThreadSafeRefCounted::ref;
+    using ThreadSafeRefCounted::deref;
 
 private:
     Notification(Document&, const String& title, const Options&);

Modified: trunk/Source/WebCore/Modules/notifications/Notification.idl (287252 => 287253)


--- trunk/Source/WebCore/Modules/notifications/Notification.idl	2021-12-20 03:37:38 UTC (rev 287252)
+++ trunk/Source/WebCore/Modules/notifications/Notification.idl	2021-12-20 05:03:26 UTC (rev 287253)
@@ -75,30 +75,3 @@
     attribute EventHandler onshow;
 };
 
-[
-    Conditional=NOTIFICATIONS
-] dictionary NotificationOptions {
-    NotificationDirection dir = "auto";
-    DOMString lang = "";
-    DOMString body = "";
-    DOMString tag = "";
-    // USVString image;
-    USVString icon;
-    // USVString badge;
-    // USVString sound;
-    // VibratePattern vibrate;
-    // EpochTimeStamp timestamp;
-    // boolean renotify = false;
-    // boolean silent = false;
-    // boolean requireInteraction = false;
-    // any data = ""
-    // sequence<NotificationAction> actions = [];
-};
-
-[
-    Conditional=NOTIFICATIONS
-] enum NotificationDirection {
-    "auto",
-    "ltr",
-    "rtl"
-};

Copied: trunk/Source/WebCore/Modules/notifications/NotificationDirection.idl (from rev 287252, trunk/Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl) (0 => 287253)


--- trunk/Source/WebCore/Modules/notifications/NotificationDirection.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/notifications/NotificationDirection.idl	2021-12-20 05:03:26 UTC (rev 287253)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Conditional=NOTIFICATIONS
+] enum NotificationDirection {
+    "auto",
+    "ltr",
+    "rtl"
+};

Copied: trunk/Source/WebCore/Modules/notifications/NotificationEvent.cpp (from rev 287252, trunk/Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl) (0 => 287253)


--- trunk/Source/WebCore/Modules/notifications/NotificationEvent.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/notifications/NotificationEvent.cpp	2021-12-20 05:03:26 UTC (rev 287253)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "NotificationEvent.h"
+
+#if ENABLE(NOTIFICATION_EVENT)
+
+namespace WebCore {
+
+NotificationEvent::~NotificationEvent()
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(NOTIFICATION_EVENT)
+
+

Copied: trunk/Source/WebCore/Modules/notifications/NotificationEvent.h (from rev 287252, trunk/Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl) (0 => 287253)


--- trunk/Source/WebCore/Modules/notifications/NotificationEvent.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/notifications/NotificationEvent.h	2021-12-20 05:03:26 UTC (rev 287253)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(NOTIFICATION_EVENT)
+
+#include "ExtendableEvent.h"
+#include "ExtendableEventInit.h"
+#include "Notification.h"
+
+namespace WebCore {
+
+class NotificationEvent final : public ExtendableEvent {
+public:
+    ~NotificationEvent();
+
+    struct Init : ExtendableEventInit {
+        RefPtr<Notification> notification;
+        String action;
+    };
+
+    EventInterface eventInterface() const final { return NotificationEventInterfaceType; }
+
+    Notification* notification() { return m_notification.get(); }
+    const String& action() { return m_action; }
+
+private:
+    RefPtr<Notification> m_notification;
+    String m_action;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(NOTIFICATION_EVENT)

Copied: trunk/Source/WebCore/Modules/notifications/NotificationEvent.idl (from rev 287252, trunk/Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl) (0 => 287253)


--- trunk/Source/WebCore/Modules/notifications/NotificationEvent.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/notifications/NotificationEvent.idl	2021-12-20 05:03:26 UTC (rev 287253)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Exposed=ServiceWorker,
+    Conditional=NOTIFICATION_EVENT,
+    EnabledAtRuntime=NotificationEventEnabled,
+]
+interface NotificationEvent : ExtendableEvent {
+    constructor(DOMString type, NotificationEventInit eventInitDict);
+
+    readonly attribute Notification notification;
+    readonly attribute DOMString action;
+};
+
+[
+    Conditional=NOTIFICATION_EVENT,
+] dictionary NotificationEventInit : ExtendableEventInit {
+    required Notification notification;
+    DOMString action = ""
+};

Copied: trunk/Source/WebCore/Modules/notifications/NotificationOptions.h (from rev 287252, trunk/Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl) (0 => 287253)


--- trunk/Source/WebCore/Modules/notifications/NotificationOptions.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/notifications/NotificationOptions.h	2021-12-20 05:03:26 UTC (rev 287253)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#pragma once
+
+#include "Notification.h"
+
+#if ENABLE(NOTIFICATIONS)
+
+namespace WebCore {
+
+using NotificationOptions = Notification::Options;
+
+}
+
+#endif // ENABLE(NOTIFICATIONS)
+

Copied: trunk/Source/WebCore/Modules/notifications/NotificationOptions.idl (from rev 287252, trunk/Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl) (0 => 287253)


--- trunk/Source/WebCore/Modules/notifications/NotificationOptions.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/notifications/NotificationOptions.idl	2021-12-20 05:03:26 UTC (rev 287253)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Conditional=NOTIFICATIONS
+] dictionary NotificationOptions {
+    NotificationDirection dir = "auto";
+    DOMString lang = "";
+    DOMString body = "";
+    DOMString tag = "";
+    // USVString image;
+    USVString icon;
+    // USVString badge;
+    // USVString sound;
+    // VibratePattern vibrate;
+    // EpochTimeStamp timestamp;
+    // boolean renotify = false;
+    // boolean silent = false;
+    // boolean requireInteraction = false;
+    // any data = ""
+    // sequence<NotificationAction> actions = [];
+};

Modified: trunk/Source/WebCore/Sources.txt (287252 => 287253)


--- trunk/Source/WebCore/Sources.txt	2021-12-20 03:37:38 UTC (rev 287252)
+++ trunk/Source/WebCore/Sources.txt	2021-12-20 05:03:26 UTC (rev 287253)
@@ -243,6 +243,7 @@
 Modules/notifications/Notification.cpp
 Modules/notifications/NotificationController.cpp
 Modules/notifications/NotificationData.cpp
+Modules/notifications/NotificationEvent.cpp
 Modules/paymentrequest/MerchantValidationEvent.cpp
 Modules/paymentrequest/PaymentAddress.cpp
 Modules/paymentrequest/PaymentHandler.cpp
@@ -3495,6 +3496,9 @@
 JSNonDocumentTypeChildNode.cpp
 JSNonElementParentNode.cpp
 JSNotification.cpp
+JSNotificationDirection.cpp
+JSNotificationEvent.cpp
+JSNotificationOptions.cpp
 JSNotificationPermission.cpp
 JSNotificationPermissionCallback.cpp
 JSOESElementIndexUint.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (287252 => 287253)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-12-20 03:37:38 UTC (rev 287252)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-12-20 05:03:26 UTC (rev 287253)
@@ -1522,6 +1522,11 @@
 		510D4A34103165EE0049EA54 /* SocketStreamError.h in Headers */ = {isa = PBXBuildFile; fileRef = 510D4A2E103165EE0049EA54 /* SocketStreamError.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		510D4A37103165EE0049EA54 /* SocketStreamHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 510D4A31103165EE0049EA54 /* SocketStreamHandle.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		510D4A38103165EE0049EA54 /* SocketStreamHandleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 510D4A32103165EE0049EA54 /* SocketStreamHandleClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		510E2F25276BB4EC00809333 /* NotificationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 510E2F24276BB4EC00809333 /* NotificationEvent.h */; };
+		510E2F27276BC19F00809333 /* NotificationOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 510E2F26276BC19F00809333 /* NotificationOptions.h */; };
+		510E2F2B276BCFE800809333 /* JSNotificationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 510E2F2A276BCFE800809333 /* JSNotificationEvent.h */; };
+		510E2F33276BF68500809333 /* JSNotificationDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 510E2F2F276BF68300809333 /* JSNotificationDirection.h */; };
+		510E2F35276BF68500809333 /* JSNotificationOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 510E2F31276BF68400809333 /* JSNotificationOptions.h */; };
 		5110FCFC1E03641D006F8D0B /* IDBCursorRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = 5110FCFB1E0362A5006F8D0B /* IDBCursorRecord.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		51123E2F276940CA00F9D41B /* NotificationData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51123E2C27693C3200F9D41B /* NotificationData.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		5117F30E25E61020002A9F1E /* RemoteCommandListenerCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 5117F30C25E6101F002A9F1E /* RemoteCommandListenerCocoa.h */; };
@@ -9562,6 +9567,16 @@
 		510D4A30103165EE0049EA54 /* SocketStreamHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SocketStreamHandle.cpp; sourceTree = "<group>"; };
 		510D4A31103165EE0049EA54 /* SocketStreamHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketStreamHandle.h; sourceTree = "<group>"; };
 		510D4A32103165EE0049EA54 /* SocketStreamHandleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketStreamHandleClient.h; sourceTree = "<group>"; };
+		510E2F22276BA9E800809333 /* NotificationEvent.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = NotificationEvent.idl; sourceTree = "<group>"; };
+		510E2F24276BB4EC00809333 /* NotificationEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationEvent.h; sourceTree = "<group>"; };
+		510E2F26276BC19F00809333 /* NotificationOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationOptions.h; sourceTree = "<group>"; };
+		510E2F28276BCFAF00809333 /* JSNotificationEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNotificationEvent.cpp; sourceTree = "<group>"; };
+		510E2F2A276BCFE800809333 /* JSNotificationEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNotificationEvent.h; sourceTree = "<group>"; };
+		510E2F2C276BE0C300809333 /* NotificationEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationEvent.cpp; sourceTree = "<group>"; };
+		510E2F2E276BF68300809333 /* JSNotificationOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNotificationOptions.cpp; sourceTree = "<group>"; };
+		510E2F2F276BF68300809333 /* JSNotificationDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNotificationDirection.h; sourceTree = "<group>"; };
+		510E2F30276BF68400809333 /* JSNotificationDirection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNotificationDirection.cpp; sourceTree = "<group>"; };
+		510E2F31276BF68400809333 /* JSNotificationOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNotificationOptions.h; sourceTree = "<group>"; };
 		5110FCFB1E0362A5006F8D0B /* IDBCursorRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBCursorRecord.h; sourceTree = "<group>"; };
 		51123E2C27693C3200F9D41B /* NotificationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationData.h; sourceTree = "<group>"; };
 		51123E2E27693C3300F9D41B /* NotificationData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationData.cpp; sourceTree = "<group>"; };
@@ -9879,6 +9894,8 @@
 		51E398FF1D6E474B009C8831 /* GameControllerGamepadProvider.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GameControllerGamepadProvider.mm; sourceTree = "<group>"; };
 		51E3AA081B98BC9A0036AD81 /* SecurityOriginData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecurityOriginData.cpp; sourceTree = "<group>"; };
 		51E3AA091B98BC9A0036AD81 /* SecurityOriginData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecurityOriginData.h; sourceTree = "<group>"; };
+		51E3AF0A276B05B7009B429D /* NotificationOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NotificationOptions.idl; sourceTree = "<group>"; };
+		51E3AF0C276B0602009B429D /* NotificationDirection.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NotificationDirection.idl; sourceTree = "<group>"; };
 		51E3F9C40DA059DC00250911 /* Storage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Storage.h; sourceTree = "<group>"; };
 		51E3F9C50DA059DC00250911 /* Storage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Storage.cpp; sourceTree = "<group>"; };
 		51E3F9D10DA05D7100250911 /* Storage.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Storage.idl; sourceTree = "<group>"; };
@@ -20729,6 +20746,12 @@
 				51123E2E27693C3300F9D41B /* NotificationData.cpp */,
 				51123E2C27693C3200F9D41B /* NotificationData.h */,
 				7CC2DE021ECA04A50027B774 /* NotificationDirection.h */,
+				51E3AF0C276B0602009B429D /* NotificationDirection.idl */,
+				510E2F2C276BE0C300809333 /* NotificationEvent.cpp */,
+				510E2F24276BB4EC00809333 /* NotificationEvent.h */,
+				510E2F22276BA9E800809333 /* NotificationEvent.idl */,
+				51E3AF0A276B05B7009B429D /* NotificationOptions.idl */,
+				510E2F26276BC19F00809333 /* NotificationOptions.h */,
 				7CC2DDF81EC9415A0027B774 /* NotificationPermission.h */,
 				7CC2DDFA1EC9415A0027B774 /* NotificationPermission.idl */,
 				31EC1DAC14FF26EA00C94662 /* NotificationPermissionCallback.h */,
@@ -20742,6 +20765,12 @@
 			children = (
 				33503C9F10179AD7003B47E1 /* JSNotification.cpp */,
 				33503CA010179AD7003B47E1 /* JSNotification.h */,
+				510E2F30276BF68400809333 /* JSNotificationDirection.cpp */,
+				510E2F2F276BF68300809333 /* JSNotificationDirection.h */,
+				510E2F28276BCFAF00809333 /* JSNotificationEvent.cpp */,
+				510E2F2A276BCFE800809333 /* JSNotificationEvent.h */,
+				510E2F2E276BF68300809333 /* JSNotificationOptions.cpp */,
+				510E2F31276BF68400809333 /* JSNotificationOptions.h */,
 				7CC2DDFE1EC95A440027B774 /* JSNotificationPermission.cpp */,
 				7CC2DDFF1EC95A440027B774 /* JSNotificationPermission.h */,
 				31EC1E2614FF60EE00C94662 /* JSNotificationPermissionCallback.cpp */,
@@ -33563,6 +33592,7 @@
 				CD8D306F23AD4FA8006C3975 /* CDMLogging.h in Headers */,
 				CD3CE0FE2401AAD9004BA01D /* CDMMediaCapability.h in Headers */,
 				CD3CE0FF2401AADA004BA01D /* CDMMessageType.h in Headers */,
+				510E2F33276BF68500809333 /* JSNotificationDirection.h in Headers */,
 				CD3CE1002401AADA004BA01D /* CDMPrivate.h in Headers */,
 				CD318623199F1E2A0030A0F7 /* CDMPrivateMediaSourceAVFObjC.h in Headers */,
 				CD3CE1012401AADA004BA01D /* CDMProxy.h in Headers */,
@@ -34507,6 +34537,7 @@
 				CDA595932146DEC300A84185 /* HEVCUtilities.h in Headers */,
 				CDA595982146DF7800A84185 /* HEVCUtilitiesCocoa.h in Headers */,
 				F55B3DC01251F12D003EF269 /* HiddenInputType.h in Headers */,
+				510E2F27276BC19F00809333 /* NotificationOptions.h in Headers */,
 				510A91EB24D004C800BFD89C /* HIDDevice.h in Headers */,
 				510A91EA24D004C300BFD89C /* HIDElement.h in Headers */,
 				515BE19C1D54F6C100DD7C68 /* HIDGamepad.h in Headers */,
@@ -34582,6 +34613,7 @@
 				A81369CC097374F600D74463 /* HTMLInputElement.h in Headers */,
 				835D2D781F5F1FBD00141DED /* HTMLInputElementEntriesAPI.h in Headers */,
 				97BC849B12370A4B000C6161 /* HTMLInputStream.h in Headers */,
+				510E2F25276BB4EC00809333 /* NotificationEvent.h in Headers */,
 				93309DE6099E64920056E581 /* HTMLInterchange.h in Headers */,
 				A81369E4097374F600D74463 /* HTMLKeygenElement.h in Headers */,
 				A81369E2097374F600D74463 /* HTMLLabelElement.h in Headers */,
@@ -35208,6 +35240,7 @@
 				1C24EEA91C72A7B40080F8FC /* JSFontFaceSet.h in Headers */,
 				FDA15EAC12B03EE1003A583A /* JSGainNode.h in Headers */,
 				518F5002194CAC3A0081BAAE /* JSGamepad.h in Headers */,
+				510E2F35276BF68500809333 /* JSNotificationOptions.h in Headers */,
 				518F5004194CAC3A0081BAAE /* JSGamepadButton.h in Headers */,
 				FE80DA640E9C4703000D6F75 /* JSGeolocation.h in Headers */,
 				FE80DA660E9C4703000D6F75 /* JSGeoposition.h in Headers */,
@@ -36147,6 +36180,7 @@
 				E596DD29251903D200C275A7 /* NavigatorContacts.h in Headers */,
 				F4034FAE275EAD76003A81F8 /* NavigatorCookieConsent.h in Headers */,
 				372D3E57216578AE00C5E021 /* NavigatorCredentials.h in Headers */,
+				510E2F2B276BCFE800809333 /* JSNotificationEvent.h in Headers */,
 				9711460414EF009A00674FD9 /* NavigatorGeolocation.h in Headers */,
 				6B507A24234BF34100BE7C62 /* NavigatorIsLoggedIn.h in Headers */,
 				5EA725D61ACABD5700EAD17B /* NavigatorMediaDevices.h in Headers */,

Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (287252 => 287253)


--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2021-12-20 03:37:38 UTC (rev 287252)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2021-12-20 05:03:26 UTC (rev 287253)
@@ -224,6 +224,7 @@
     macro(NavigatorPermissions) \
     macro(NavigatorUserMedia) \
     macro(Notification) \
+    macro(NotificationEvent) \
     macro(OfflineAudioContext) \
     macro(OffscreenCanvas) \
     macro(OffscreenCanvasRenderingContext2D) \
@@ -454,6 +455,8 @@
     macro(makeThisTypeError) \
     macro(matchingElementInFlatTree) \
     macro(mediaStreamTrackConstraints) \
+    macro(onnotificationclick) \
+    macro(onnotificationclose) \
     macro(onpush) \
     macro(onpushsubscriptionchange) \
     macro(onrtctransform) \

Modified: trunk/Source/WebCore/dom/EventNames.h (287252 => 287253)


--- trunk/Source/WebCore/dom/EventNames.h	2021-12-20 03:37:38 UTC (rev 287252)
+++ trunk/Source/WebCore/dom/EventNames.h	2021-12-20 05:03:26 UTC (rev 287253)
@@ -190,6 +190,8 @@
     macro(negotiationneeded) \
     macro(nexttrack) \
     macro(nomatch) \
+    macro(notificationclick) \
+    macro(notificationclose) \
     macro(noupdate) \
     macro(obsolete) \
     macro(offline) \

Modified: trunk/Source/WebCore/dom/EventNames.in (287252 => 287253)


--- trunk/Source/WebCore/dom/EventNames.in	2021-12-20 03:37:38 UTC (rev 287252)
+++ trunk/Source/WebCore/dom/EventNames.in	2021-12-20 05:03:26 UTC (rev 287253)
@@ -99,3 +99,4 @@
 XRInputSourcesChangeEvent conditional=WEBXR
 XRReferenceSpaceEvent conditional=WEBXR
 XRSessionEvent conditional=WEBXR
+NotificationEvent conditional=NOTIFICATION_EVENT

Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (287252 => 287253)


--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2021-12-20 03:37:38 UTC (rev 287252)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2021-12-20 05:03:26 UTC (rev 287253)
@@ -253,6 +253,11 @@
     bool builtInNotificationsEnabled() const { return m_builtInNotificationsEnabled; }
 #endif
 
+#if ENABLE(NOTIFICATION_EVENT)
+    void setNotificationEventEnabled(bool isEnabled) { m_notificationEventEnabled = isEnabled; }
+    bool notificationEventEnabled() const { return m_notificationEventEnabled; }
+#endif
+
 #if ENABLE(MODEL_ELEMENT)
     void setModelDocumentEnabled(bool isEnabled) { m_modelDocumentEnabled = isEnabled; }
     bool modelDocumentEnabled() const { return m_modelDocumentEnabled; }
@@ -396,6 +401,10 @@
     bool m_builtInNotificationsEnabled { false };
 #endif
 
+#if ENABLE(NOTIFICATION_EVENT)
+    bool m_notificationEventEnabled { false };
+#endif
+
 #if ENABLE(MODEL_ELEMENT)
     bool m_modelDocumentEnabled { false };
 #endif

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl (287252 => 287253)


--- trunk/Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl	2021-12-20 03:37:38 UTC (rev 287252)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl	2021-12-20 05:03:26 UTC (rev 287253)
@@ -45,4 +45,7 @@
     // event
     attribute EventHandler onmessage;
     attribute EventHandler onmessageerror;
+
+    [Conditional=NOTIFICATION_EVENT, EnabledAtRuntime=NotificationEventEnabled] attribute EventHandler onnotificationclick;
+    [Conditional=NOTIFICATION_EVENT, EnabledAtRuntime=NotificationEventEnabled] attribute EventHandler onnotificationclose;
 };

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp (287252 => 287253)


--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp	2021-12-20 03:37:38 UTC (rev 287252)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp	2021-12-20 05:03:26 UTC (rev 287253)
@@ -263,6 +263,24 @@
     return *m_navigationPreload;
 }
 
+#if ENABLE(NOTIFICATION_EVENT)
+void ServiceWorkerRegistration::showNotification(ScriptExecutionContext&, const String& title, const NotificationOptions& options, DOMPromiseDeferred<void>&& promise)
+{
+    UNUSED_PARAM(title);
+    UNUSED_PARAM(options);
+
+    promise.reject();
+}
+
+void ServiceWorkerRegistration::getNotifications(ScriptExecutionContext&, const GetNotificationOptions& filter, DOMPromiseDeferred<IDLSequence<IDLDOMString>> promise)
+{
+    UNUSED_PARAM(filter);
+
+    promise.reject();
+
+}
+#endif // ENABLE(NOTIFICATION_EVENT)
+
 } // namespace WebCore
 
 #endif // ENABLE(SERVICE_WORKER)

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.h (287252 => 287253)


--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.h	2021-12-20 03:37:38 UTC (rev 287252)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.h	2021-12-20 05:03:26 UTC (rev 287253)
@@ -30,6 +30,7 @@
 #include "ActiveDOMObject.h"
 #include "EventTarget.h"
 #include "JSDOMPromiseDeferred.h"
+#include "NotificationOptions.h"
 #include "PushPermissionState.h"
 #include "PushSubscription.h"
 #include "SWClientConnection.h"
@@ -89,6 +90,15 @@
     NavigationPreloadManager& navigationPreload();
     ServiceWorkerContainer& container() { return m_container.get(); }
 
+#if ENABLE(NOTIFICATION_EVENT)
+    struct GetNotificationOptions {
+        String tag;
+    };
+
+    void showNotification(ScriptExecutionContext&, const String& title, const NotificationOptions&, DOMPromiseDeferred<void>&&);
+    void getNotifications(ScriptExecutionContext&, const GetNotificationOptions& filter, DOMPromiseDeferred<IDLSequence<IDLDOMString>>);
+#endif
+
 private:
     ServiceWorkerRegistration(ScriptExecutionContext&, Ref<ServiceWorkerContainer>&&, ServiceWorkerRegistrationData&&);
 

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.idl (287252 => 287253)


--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.idl	2021-12-20 03:37:38 UTC (rev 287252)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.idl	2021-12-20 05:03:26 UTC (rev 287253)
@@ -45,6 +45,15 @@
     [NewObject] Promise<undefined> update();
     [NewObject] Promise<boolean> unregister();
 
+    [Conditional=NOTIFICATION_EVENT, EnabledAtRuntime=NotificationEventEnabled, CallWith=ScriptExecutionContext] Promise<undefined> showNotification(DOMString title, optional NotificationOptions options);
+    [Conditional=NOTIFICATION_EVENT, EnabledAtRuntime=NotificationEventEnabled, CallWith=ScriptExecutionContext] Promise<sequence<Notification>> getNotifications(optional GetNotificationOptions filter);
+
     // event
     attribute EventHandler onupdatefound;
 };
+
+[
+    Conditional=NOTIFICATION_EVENT
+] dictionary GetNotificationOptions {
+    DOMString tag = "";
+};
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to