Title: [283916] trunk
Revision
283916
Author
[email protected]
Date
2021-10-11 11:38:26 -0700 (Mon, 11 Oct 2021)

Log Message

Add push registration stubs
https://bugs.webkit.org/show_bug.cgi?id=231064

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Update test results after importing PushManager-related IDL.

* web-platform-tests/push-api/idlharness.https.any-expected.txt:
* web-platform-tests/push-api/idlharness.https.any.serviceworker-expected.txt:
* web-platform-tests/push-api/idlharness.https.any.worker-expected.txt:

Source/WebCore:

Import IDL related to PushManager and implement steps 1-7 of the subscribe method as
described in https://www.w3.org/TR/push-api/#pushmanager-interface. Further steps will be
implemented in future patches.

Tests: http/wpt/push-api/pushManager.any.html
       http/wpt/push-api/pushManager.any.serviceworker.html

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/push-api/PushManager.cpp: Added.
(WebCore::PushManager::PushManager):
(WebCore::PushManager::supportedContentEncodings):
(WebCore::PushManager::ref const):
(WebCore::PushManager::deref const):
(WebCore::PushManager::subscribe):
(WebCore::PushManager::getSubscription):
(WebCore::PushManager::permissionState):
* Modules/push-api/PushManager.h: Added.
* Modules/push-api/PushManager.idl: Added.
* Modules/push-api/PushPermissionState.h: Added.
* Modules/push-api/PushPermissionState.idl: Added.
* Modules/push-api/ServiceWorkerRegistration+PushAPI.idl: Added.
* Modules/push-api/ServiceWorkerRegistrationPushAPI.cpp: Added.
(WebCore::ServiceWorkerRegistrationPushAPI::ServiceWorkerRegistrationPushAPI):
(WebCore::ServiceWorkerRegistrationPushAPI::pushManager):
(WebCore::ServiceWorkerRegistrationPushAPI::from):
(WebCore::ServiceWorkerRegistrationPushAPI::supplementName):
* Modules/push-api/ServiceWorkerRegistrationPushAPI.h: Added.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* workers/service/ServiceWorkerRegistration.h:

LayoutTests:

Add basic tests for PushManager.subscribe in both the window and service worker contexts.

* http/wpt/push-api/pushManager-worker.js: Added.
* http/wpt/push-api/pushManager.any-expected.txt: Added.
* http/wpt/push-api/pushManager.any.html: Added.
* http/wpt/push-api/pushManager.any.js: Added.
(isServiceWorker.promise_test.async test):
(else.promise_test.async test):
(promise_test.async test):
* http/wpt/push-api/pushManager.any.serviceworker-expected.txt: Added.
* http/wpt/push-api/pushManager.any.serviceworker.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (283915 => 283916)


--- trunk/LayoutTests/ChangeLog	2021-10-11 18:31:14 UTC (rev 283915)
+++ trunk/LayoutTests/ChangeLog	2021-10-11 18:38:26 UTC (rev 283916)
@@ -1,3 +1,22 @@
+2021-10-11  Ben Nham  <[email protected]>
+
+        Add push registration stubs
+        https://bugs.webkit.org/show_bug.cgi?id=231064
+
+        Reviewed by Youenn Fablet.
+
+        Add basic tests for PushManager.subscribe in both the window and service worker contexts.
+
+        * http/wpt/push-api/pushManager-worker.js: Added.
+        * http/wpt/push-api/pushManager.any-expected.txt: Added.
+        * http/wpt/push-api/pushManager.any.html: Added.
+        * http/wpt/push-api/pushManager.any.js: Added.
+        (isServiceWorker.promise_test.async test):
+        (else.promise_test.async test):
+        (promise_test.async test):
+        * http/wpt/push-api/pushManager.any.serviceworker-expected.txt: Added.
+        * http/wpt/push-api/pushManager.any.serviceworker.html: Added.
+
 2021-10-11  Antti Koivisto  <[email protected]>
 
         Remove inline box decoration painting quirk

Added: trunk/LayoutTests/http/wpt/push-api/pushManager-worker.js (0 => 283916)


--- trunk/LayoutTests/http/wpt/push-api/pushManager-worker.js	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/pushManager-worker.js	2021-10-11 18:38:26 UTC (rev 283916)
@@ -0,0 +1 @@
+// This service worker script is intentionally left blank.
\ No newline at end of file

Added: trunk/LayoutTests/http/wpt/push-api/pushManager.any-expected.txt (0 => 283916)


--- trunk/LayoutTests/http/wpt/push-api/pushManager.any-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/pushManager.any-expected.txt	2021-10-11 18:38:26 UTC (rev 283916)
@@ -0,0 +1,15 @@
+
+PASS subscribe should fail if there is no active service worker
+PASS wait for active service worker
+PASS aes128gcm should be supported
+PASS supportedContentEncodings should be frozen
+PASS pushManager should return same object
+PASS subscribe requires userVisibleOnly to be true
+PASS subscribe requires applicationServerKey
+PASS applicationServerKey string should be base64url-encoded
+PASS applicationServerKey buffer should be a valid point on the P-256 curve
+PASS applicationServerKey string should be a valid point on the P-256 curve
+PASS can subscribe with valid applicationServerKey buffer
+PASS can subscribe with valid applicationServerKey string
+PASS unregister service worker
+

Added: trunk/LayoutTests/http/wpt/push-api/pushManager.any.html (0 => 283916)


--- trunk/LayoutTests/http/wpt/push-api/pushManager.any.html	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/pushManager.any.html	2021-10-11 18:38:26 UTC (rev 283916)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Added: trunk/LayoutTests/http/wpt/push-api/pushManager.any.js (0 => 283916)


--- trunk/LayoutTests/http/wpt/push-api/pushManager.any.js	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/pushManager.any.js	2021-10-11 18:38:26 UTC (rev 283916)
@@ -0,0 +1,122 @@
+// META: title=PushManager tests
+// META: global=window,serviceworker
+
+const INVALID_SERVER_KEY = new Uint8Array(new Array(65).fill(4));
+const VALID_SERVER_KEY = new Uint8Array([4, 13, 71, 199, 60, 162, 213, 21, 12, 213, 190, 112, 143, 27, 39, 238, 113, 177, 2, 204, 240, 218, 238, 181, 155, 94, 184, 139, 115, 43, 0, 140, 71, 23, 166, 10, 230, 30, 18, 13, 136, 156, 249, 212, 110, 83, 244, 66, 60, 39, 192, 229, 170, 189, 162, 52, 176, 147, 150, 54, 18, 96, 165, 4, 251]);
+
+const INVALID_BASE64_SERVER_KEY = "BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ";
+const VALID_BASE64_SERVER_KEY = "BA1Hxzyi1RUM1b5wjxsn7nGxAszw2u61m164i3MrAIxHF6YK5h4SDYic-dRuU_RCPCfA5aq9ojSwk5Y2EmClBPs";
+
+let registration = null;
+let pushManager = null;
+
+let isServiceWorker = 'ServiceWorkerGlobalScope' in self && self instanceof self.ServiceWorkerGlobalScope;
+if (isServiceWorker) {
+    promise_test(async (test) => {
+        registration = self.registration;
+        pushManager = registration.pushManager;
+
+        assert_true(!registration.active, "service worker should not yet be active");
+
+        return promise_rejects_dom(test, "InvalidStateError", registration.pushManager.subscribe({
+            userVisibleOnly: true,
+            applicationServerKey: VALID_BASE64_SERVER_KEY
+        }));
+    }, "subscribe should fail if there is no active service worker");
+
+    promise_test(async (test) => {
+        if (!registration.active)
+            return new Promise(resolve => self.addEventListener('activate', resolve));
+    }, "wait for active service worker");
+} else {
+    promise_test(async (test) => {
+        registration = await navigator.serviceWorker.getRegistration();
+        if (registration) {
+            await serviceWorkerRegistration.unregister();
+        }
+        registration = await navigator.serviceWorker.register("pushManager-worker.js");
+        pushManager = registration.pushManager;
+
+        let serviceWorker = registration.installing;
+        assert_true(!!serviceWorker, "service worker should be installing");
+
+        return promise_rejects_dom(test, "InvalidStateError", registration.pushManager.subscribe({
+            userVisibleOnly: true,
+            applicationServerKey: VALID_BASE64_SERVER_KEY
+        }));
+    }, "subscribe should fail if there is no active service worker");
+
+    promise_test(async (test) => {
+        if (!registration.active) {
+            let serviceWorker = registration.installing || registration.waiting;
+            assert_true(!!serviceWorker, "registration should be associated with a service worker");
+
+            return new Promise(resolve => {
+                serviceWorker.addEventListener("statechange", () => {
+                    if (serviceWorker.state === "activated")
+                        resolve();
+                });
+            });
+        }
+    }, "wait for active service worker");
+}
+
+test((test) => assert_true(PushManager.supportedContentEncodings.includes("aes128gcm")), "aes128gcm should be supported");
+test((test) => assert_true(Object.isFrozen(PushManager.supportedContentEncodings)), "supportedContentEncodings should be frozen");
+
+promise_test(async (test) => {
+    assert_equals(pushManager, registration.pushManager);
+}, "pushManager should return same object");
+
+promise_test(async (test) => {
+    return promise_rejects_dom(test, "NotAllowedError", pushManager.subscribe({
+        userVisibleOnly: false,
+        applicationServerKey: VALID_BASE64_SERVER_KEY
+    }));
+}, "subscribe requires userVisibleOnly to be true");
+
+promise_test(async (test) => {
+    return promise_rejects_dom(test, "NotSupportedError", pushManager.subscribe({
+        userVisibleOnly: true
+    }));
+}, "subscribe requires applicationServerKey");
+
+promise_test(async (test) => {
+    return promise_rejects_dom(test, "InvalidCharacterError", pushManager.subscribe({
+        userVisibleOnly: true,
+        applicationServerKey: VALID_BASE64_SERVER_KEY + "/"
+    }));
+}, "applicationServerKey string should be base64url-encoded");
+
+promise_test(async (test) => {
+    return promise_rejects_dom(test, "InvalidAccessError", pushManager.subscribe({
+        userVisibleOnly: true,
+        applicationServerKey: INVALID_SERVER_KEY
+    }));
+}, "applicationServerKey buffer should be a valid point on the P-256 curve");
+
+promise_test(async (test) => {
+    return promise_rejects_dom(test, "InvalidAccessError", pushManager.subscribe({
+        userVisibleOnly: true,
+        applicationServerKey: INVALID_BASE64_SERVER_KEY
+    }));
+}, "applicationServerKey string should be a valid point on the P-256 curve");
+
+promise_test(async (test) => {
+    // TODO: change this to make sure that subscription is valid once we fully implement subscribe.
+    return promise_rejects_dom(test, "NotAllowedError", pushManager.subscribe({
+        userVisibleOnly: true,
+        applicationServerKey: VALID_SERVER_KEY
+    }));
+}, "can subscribe with valid applicationServerKey buffer");
+
+promise_test(async (test) => {
+    // TODO: change this to make sure that subscription is valid once we fully implement subscribe.
+    return promise_rejects_dom(test, "NotAllowedError", pushManager.subscribe({
+        userVisibleOnly: true,
+        applicationServerKey: VALID_BASE64_SERVER_KEY
+    }));
+}, "can subscribe with valid applicationServerKey string");
+
+if (!isServiceWorker)
+    promise_test((test) => registration.unregister(), "unregister service worker");    

Added: trunk/LayoutTests/http/wpt/push-api/pushManager.any.serviceworker-expected.txt (0 => 283916)


--- trunk/LayoutTests/http/wpt/push-api/pushManager.any.serviceworker-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/pushManager.any.serviceworker-expected.txt	2021-10-11 18:38:26 UTC (rev 283916)
@@ -0,0 +1,14 @@
+
+PASS subscribe should fail if there is no active service worker
+PASS wait for active service worker
+PASS aes128gcm should be supported
+PASS supportedContentEncodings should be frozen
+PASS pushManager should return same object
+PASS subscribe requires userVisibleOnly to be true
+PASS subscribe requires applicationServerKey
+PASS applicationServerKey string should be base64url-encoded
+PASS applicationServerKey buffer should be a valid point on the P-256 curve
+PASS applicationServerKey string should be a valid point on the P-256 curve
+PASS can subscribe with valid applicationServerKey buffer
+PASS can subscribe with valid applicationServerKey string
+

Added: trunk/LayoutTests/http/wpt/push-api/pushManager.any.serviceworker.html (0 => 283916)


--- trunk/LayoutTests/http/wpt/push-api/pushManager.any.serviceworker.html	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/pushManager.any.serviceworker.html	2021-10-11 18:38:26 UTC (rev 283916)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (283915 => 283916)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-10-11 18:31:14 UTC (rev 283915)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-10-11 18:38:26 UTC (rev 283916)
@@ -1,3 +1,16 @@
+2021-10-11  Ben Nham  <[email protected]>
+
+        Add push registration stubs
+        https://bugs.webkit.org/show_bug.cgi?id=231064
+
+        Reviewed by Youenn Fablet.
+
+        Update test results after importing PushManager-related IDL.
+
+        * web-platform-tests/push-api/idlharness.https.any-expected.txt:
+        * web-platform-tests/push-api/idlharness.https.any.serviceworker-expected.txt:
+        * web-platform-tests/push-api/idlharness.https.any.worker-expected.txt:
+
 2021-10-11  Tim Nguyen  <[email protected]>
 
         Import new top layer WPTs

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any-expected.txt (283915 => 283916)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any-expected.txt	2021-10-11 18:31:14 UTC (rev 283915)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any-expected.txt	2021-10-11 18:38:26 UTC (rev 283916)
@@ -7,24 +7,24 @@
 PASS Partial interface ServiceWorkerGlobalScope: valid exposure set
 PASS Partial interface ServiceWorkerGlobalScope: member names are unique
 PASS WorkerGlobalScope includes WindowOrWorkerGlobalScope: member names are unique
-FAIL PushManager interface: existence and properties of interface object assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface object length assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface object name assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: existence and properties of interface prototype object assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: attribute supportedContentEncodings assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: operation subscribe(optional PushSubscriptionOptionsInit) assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: operation getSubscription() assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: operation permissionState(optional PushSubscriptionOptionsInit) assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager must be primary interface of registration.pushManager assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL Stringification of registration.pushManager assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL PushManager interface: registration.pushManager must inherit property "supportedContentEncodings" with the proper type assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL PushManager interface: registration.pushManager must inherit property "subscribe(optional PushSubscriptionOptionsInit)" with the proper type assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL PushManager interface: calling subscribe(optional PushSubscriptionOptionsInit) on registration.pushManager with too few arguments must throw TypeError assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL PushManager interface: registration.pushManager must inherit property "getSubscription()" with the proper type assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL PushManager interface: registration.pushManager must inherit property "permissionState(optional PushSubscriptionOptionsInit)" with the proper type assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL PushManager interface: calling permissionState(optional PushSubscriptionOptionsInit) on registration.pushManager with too few arguments must throw TypeError assert_equals: wrong typeof object expected "object" but got "undefined"
+PASS PushManager interface: existence and properties of interface object
+PASS PushManager interface object length
+PASS PushManager interface object name
+PASS PushManager interface: existence and properties of interface prototype object
+PASS PushManager interface: existence and properties of interface prototype object's "constructor" property
+PASS PushManager interface: existence and properties of interface prototype object's @@unscopables property
+PASS PushManager interface: attribute supportedContentEncodings
+PASS PushManager interface: operation subscribe(optional PushSubscriptionOptionsInit)
+PASS PushManager interface: operation getSubscription()
+PASS PushManager interface: operation permissionState(optional PushSubscriptionOptionsInit)
+PASS PushManager must be primary interface of registration.pushManager
+PASS Stringification of registration.pushManager
+PASS PushManager interface: registration.pushManager must inherit property "supportedContentEncodings" with the proper type
+PASS PushManager interface: registration.pushManager must inherit property "subscribe(optional PushSubscriptionOptionsInit)" with the proper type
+PASS PushManager interface: calling subscribe(optional PushSubscriptionOptionsInit) on registration.pushManager with too few arguments must throw TypeError
+PASS PushManager interface: registration.pushManager must inherit property "getSubscription()" with the proper type
+PASS PushManager interface: registration.pushManager must inherit property "permissionState(optional PushSubscriptionOptionsInit)" with the proper type
+PASS PushManager interface: calling permissionState(optional PushSubscriptionOptionsInit) on registration.pushManager with too few arguments must throw TypeError
 PASS PushSubscriptionOptions interface: existence and properties of interface object
 PASS PushSubscriptionOptions interface object length
 PASS PushSubscriptionOptions interface object name
@@ -48,6 +48,6 @@
 PASS PushMessageData interface: existence and properties of interface object
 PASS PushEvent interface: existence and properties of interface object
 PASS PushSubscriptionChangeEvent interface: existence and properties of interface object
-FAIL ServiceWorkerRegistration interface: attribute pushManager assert_true: The prototype object must have a property "pushManager" expected true got false
-FAIL ServiceWorkerRegistration interface: registration must inherit property "pushManager" with the proper type assert_inherits: property "pushManager" not found in prototype chain
+PASS ServiceWorkerRegistration interface: attribute pushManager
+PASS ServiceWorkerRegistration interface: registration must inherit property "pushManager" with the proper type
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any.serviceworker-expected.txt (283915 => 283916)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any.serviceworker-expected.txt	2021-10-11 18:31:14 UTC (rev 283915)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any.serviceworker-expected.txt	2021-10-11 18:38:26 UTC (rev 283916)
@@ -7,24 +7,24 @@
 PASS Partial interface ServiceWorkerGlobalScope: valid exposure set
 PASS Partial interface ServiceWorkerGlobalScope: member names are unique
 PASS WorkerGlobalScope includes WindowOrWorkerGlobalScope: member names are unique
-FAIL PushManager interface: existence and properties of interface object assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface object length assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface object name assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: existence and properties of interface prototype object assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: attribute supportedContentEncodings assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: operation subscribe(optional PushSubscriptionOptionsInit) assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: operation getSubscription() assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: operation permissionState(optional PushSubscriptionOptionsInit) assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager must be primary interface of registration.pushManager assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL Stringification of registration.pushManager assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL PushManager interface: registration.pushManager must inherit property "supportedContentEncodings" with the proper type assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL PushManager interface: registration.pushManager must inherit property "subscribe(optional PushSubscriptionOptionsInit)" with the proper type assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL PushManager interface: calling subscribe(optional PushSubscriptionOptionsInit) on registration.pushManager with too few arguments must throw TypeError assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL PushManager interface: registration.pushManager must inherit property "getSubscription()" with the proper type assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL PushManager interface: registration.pushManager must inherit property "permissionState(optional PushSubscriptionOptionsInit)" with the proper type assert_equals: wrong typeof object expected "object" but got "undefined"
-FAIL PushManager interface: calling permissionState(optional PushSubscriptionOptionsInit) on registration.pushManager with too few arguments must throw TypeError assert_equals: wrong typeof object expected "object" but got "undefined"
+PASS PushManager interface: existence and properties of interface object
+PASS PushManager interface object length
+PASS PushManager interface object name
+PASS PushManager interface: existence and properties of interface prototype object
+PASS PushManager interface: existence and properties of interface prototype object's "constructor" property
+PASS PushManager interface: existence and properties of interface prototype object's @@unscopables property
+PASS PushManager interface: attribute supportedContentEncodings
+PASS PushManager interface: operation subscribe(optional PushSubscriptionOptionsInit)
+PASS PushManager interface: operation getSubscription()
+PASS PushManager interface: operation permissionState(optional PushSubscriptionOptionsInit)
+PASS PushManager must be primary interface of registration.pushManager
+PASS Stringification of registration.pushManager
+PASS PushManager interface: registration.pushManager must inherit property "supportedContentEncodings" with the proper type
+PASS PushManager interface: registration.pushManager must inherit property "subscribe(optional PushSubscriptionOptionsInit)" with the proper type
+PASS PushManager interface: calling subscribe(optional PushSubscriptionOptionsInit) on registration.pushManager with too few arguments must throw TypeError
+PASS PushManager interface: registration.pushManager must inherit property "getSubscription()" with the proper type
+PASS PushManager interface: registration.pushManager must inherit property "permissionState(optional PushSubscriptionOptionsInit)" with the proper type
+PASS PushManager interface: calling permissionState(optional PushSubscriptionOptionsInit) on registration.pushManager with too few arguments must throw TypeError
 PASS PushSubscriptionOptions interface: existence and properties of interface object
 PASS PushSubscriptionOptions interface object length
 PASS PushSubscriptionOptions interface object name
@@ -77,8 +77,8 @@
 FAIL Stringification of new PushSubscriptionChangeEvent("pushsubscriptionchange") assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: PushSubscriptionChangeEvent"
 FAIL PushSubscriptionChangeEvent interface: new PushSubscriptionChangeEvent("pushsubscriptionchange") must inherit property "newSubscription" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: PushSubscriptionChangeEvent"
 FAIL PushSubscriptionChangeEvent interface: new PushSubscriptionChangeEvent("pushsubscriptionchange") must inherit property "oldSubscription" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: PushSubscriptionChangeEvent"
-FAIL ServiceWorkerRegistration interface: attribute pushManager assert_true: The prototype object must have a property "pushManager" expected true got false
-FAIL ServiceWorkerRegistration interface: registration must inherit property "pushManager" with the proper type assert_inherits: property "pushManager" not found in prototype chain
+PASS ServiceWorkerRegistration interface: attribute pushManager
+PASS ServiceWorkerRegistration interface: registration must inherit property "pushManager" with the proper type
 PASS ServiceWorkerGlobalScope interface: attribute onpush
 FAIL ServiceWorkerGlobalScope interface: attribute onpushsubscriptionchange assert_own_property: The global object must have a property "onpushsubscriptionchange" expected property "onpushsubscriptionchange" missing
 PASS ServiceWorkerGlobalScope interface: self must inherit property "onpush" with the proper type

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any.worker-expected.txt (283915 => 283916)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any.worker-expected.txt	2021-10-11 18:31:14 UTC (rev 283915)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any.worker-expected.txt	2021-10-11 18:38:26 UTC (rev 283916)
@@ -7,16 +7,16 @@
 PASS Partial interface ServiceWorkerGlobalScope: valid exposure set
 PASS Partial interface ServiceWorkerGlobalScope: member names are unique
 PASS WorkerGlobalScope includes WindowOrWorkerGlobalScope: member names are unique
-FAIL PushManager interface: existence and properties of interface object assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface object length assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface object name assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: existence and properties of interface prototype object assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: attribute supportedContentEncodings assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: operation subscribe(optional PushSubscriptionOptionsInit) assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: operation getSubscription() assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
-FAIL PushManager interface: operation permissionState(optional PushSubscriptionOptionsInit) assert_own_property: self does not have own property "PushManager" expected property "PushManager" missing
+PASS PushManager interface: existence and properties of interface object
+PASS PushManager interface object length
+PASS PushManager interface object name
+PASS PushManager interface: existence and properties of interface prototype object
+PASS PushManager interface: existence and properties of interface prototype object's "constructor" property
+PASS PushManager interface: existence and properties of interface prototype object's @@unscopables property
+PASS PushManager interface: attribute supportedContentEncodings
+PASS PushManager interface: operation subscribe(optional PushSubscriptionOptionsInit)
+PASS PushManager interface: operation getSubscription()
+PASS PushManager interface: operation permissionState(optional PushSubscriptionOptionsInit)
 PASS PushSubscriptionOptions interface: existence and properties of interface object
 PASS PushSubscriptionOptions interface object length
 PASS PushSubscriptionOptions interface object name

Modified: trunk/Source/WebCore/CMakeLists.txt (283915 => 283916)


--- trunk/Source/WebCore/CMakeLists.txt	2021-10-11 18:31:14 UTC (rev 283915)
+++ trunk/Source/WebCore/CMakeLists.txt	2021-10-11 18:38:26 UTC (rev 283916)
@@ -504,12 +504,15 @@
     Modules/push-api/PushEncryptionKeyName.idl
     Modules/push-api/PushEvent.idl
     Modules/push-api/PushEventInit.idl
+    Modules/push-api/PushManager.idl
     Modules/push-api/PushMessageData.idl
+    Modules/push-api/PushPermissionState.idl
     Modules/push-api/PushSubscription.idl
     Modules/push-api/PushSubscriptionJSON.idl
     Modules/push-api/PushSubscriptionOptions.idl
     Modules/push-api/PushSubscriptionOptionsInit.idl
     Modules/push-api/ServiceWorkerGlobalScope+PushAPI.idl
+    Modules/push-api/ServiceWorkerRegistration+PushAPI.idl
 
     Modules/remoteplayback/RemotePlayback.idl
     Modules/remoteplayback/RemotePlaybackAvailabilityCallback.idl

Modified: trunk/Source/WebCore/ChangeLog (283915 => 283916)


--- trunk/Source/WebCore/ChangeLog	2021-10-11 18:31:14 UTC (rev 283915)
+++ trunk/Source/WebCore/ChangeLog	2021-10-11 18:38:26 UTC (rev 283916)
@@ -1,3 +1,45 @@
+2021-10-11  Ben Nham  <[email protected]>
+
+        Add push registration stubs
+        https://bugs.webkit.org/show_bug.cgi?id=231064
+
+        Reviewed by Youenn Fablet.
+
+        Import IDL related to PushManager and implement steps 1-7 of the subscribe method as
+        described in https://www.w3.org/TR/push-api/#pushmanager-interface. Further steps will be
+        implemented in future patches.
+
+        Tests: http/wpt/push-api/pushManager.any.html
+               http/wpt/push-api/pushManager.any.serviceworker.html
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Modules/push-api/PushManager.cpp: Added.
+        (WebCore::PushManager::PushManager):
+        (WebCore::PushManager::supportedContentEncodings):
+        (WebCore::PushManager::ref const):
+        (WebCore::PushManager::deref const):
+        (WebCore::PushManager::subscribe):
+        (WebCore::PushManager::getSubscription):
+        (WebCore::PushManager::permissionState):
+        * Modules/push-api/PushManager.h: Added.
+        * Modules/push-api/PushManager.idl: Added.
+        * Modules/push-api/PushPermissionState.h: Added.
+        * Modules/push-api/PushPermissionState.idl: Added.
+        * Modules/push-api/ServiceWorkerRegistration+PushAPI.idl: Added.
+        * Modules/push-api/ServiceWorkerRegistrationPushAPI.cpp: Added.
+        (WebCore::ServiceWorkerRegistrationPushAPI::ServiceWorkerRegistrationPushAPI):
+        (WebCore::ServiceWorkerRegistrationPushAPI::pushManager):
+        (WebCore::ServiceWorkerRegistrationPushAPI::from):
+        (WebCore::ServiceWorkerRegistrationPushAPI::supplementName):
+        * Modules/push-api/ServiceWorkerRegistrationPushAPI.h: Added.
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/WebCoreBuiltinNames.h:
+        * workers/service/ServiceWorkerRegistration.h:
+
 2021-10-11  Chris Dumez  <[email protected]>
 
         DOMTimeStamp is now EpochTimeStamp

Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (283915 => 283916)


--- trunk/Source/WebCore/DerivedSources-input.xcfilelist	2021-10-11 18:31:14 UTC (rev 283915)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist	2021-10-11 18:38:26 UTC (rev 283916)
@@ -427,12 +427,15 @@
 $(PROJECT_DIR)/Modules/push-api/PushEncryptionKeyName.idl
 $(PROJECT_DIR)/Modules/push-api/PushEvent.idl
 $(PROJECT_DIR)/Modules/push-api/PushEventInit.idl
+$(PROJECT_DIR)/Modules/push-api/PushManager.idl
 $(PROJECT_DIR)/Modules/push-api/PushMessageData.idl
+$(PROJECT_DIR)/Modules/push-api/PushPermissionState.idl
 $(PROJECT_DIR)/Modules/push-api/PushSubscription.idl
 $(PROJECT_DIR)/Modules/push-api/PushSubscriptionJSON.idl
 $(PROJECT_DIR)/Modules/push-api/PushSubscriptionOptions.idl
 $(PROJECT_DIR)/Modules/push-api/PushSubscriptionOptionsInit.idl
 $(PROJECT_DIR)/Modules/push-api/ServiceWorkerGlobalScope+PushAPI.idl
+$(PROJECT_DIR)/Modules/push-api/ServiceWorkerRegistration+PushAPI.idl
 $(PROJECT_DIR)/Modules/remoteplayback/HTMLMediaElement+RemotePlayback.idl
 $(PROJECT_DIR)/Modules/remoteplayback/RemotePlayback.idl
 $(PROJECT_DIR)/Modules/remoteplayback/RemotePlaybackAvailabilityCallback.idl

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (283915 => 283916)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2021-10-11 18:31:14 UTC (rev 283915)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2021-10-11 18:38:26 UTC (rev 283916)
@@ -1611,8 +1611,12 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushEvent.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushEventInit.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushEventInit.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushManager.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushManager.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushMessageData.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushMessageData.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushPermissionState.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushPermissionState.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushSubscription.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushSubscription.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushSubscriptionJSON.cpp
@@ -2137,6 +2141,8 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSecurityPolicyViolationEvent.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSServiceWorker.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSServiceWorker.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSServiceWorkerRegistration+PushAPI.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSServiceWorkerRegistration+PushAPI.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSServiceWorkerClient.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSServiceWorkerClient.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSServiceWorkerClientType.cpp

Modified: trunk/Source/WebCore/DerivedSources.make (283915 => 283916)


--- trunk/Source/WebCore/DerivedSources.make	2021-10-11 18:31:14 UTC (rev 283915)
+++ trunk/Source/WebCore/DerivedSources.make	2021-10-11 18:38:26 UTC (rev 283916)
@@ -352,12 +352,15 @@
     $(WebCore)/Modules/push-api/PushEncryptionKeyName.idl \
     $(WebCore)/Modules/push-api/PushEvent.idl \
     $(WebCore)/Modules/push-api/PushEventInit.idl \
+    $(WebCore)/Modules/push-api/PushManager.idl \
     $(WebCore)/Modules/push-api/PushMessageData.idl \
+    $(WebCore)/Modules/push-api/PushPermissionState.idl \
     $(WebCore)/Modules/push-api/PushSubscription.idl \
     $(WebCore)/Modules/push-api/PushSubscriptionJSON.idl \
     $(WebCore)/Modules/push-api/PushSubscriptionOptions.idl \
     $(WebCore)/Modules/push-api/PushSubscriptionOptionsInit.idl \
     $(WebCore)/Modules/push-api/ServiceWorkerGlobalScope+PushAPI.idl \
+    $(WebCore)/Modules/push-api/ServiceWorkerRegistration+PushAPI.idl \
     $(WebCore)/Modules/remoteplayback/HTMLMediaElement+RemotePlayback.idl \
     $(WebCore)/Modules/remoteplayback/RemotePlayback.idl \
     $(WebCore)/Modules/remoteplayback/RemotePlaybackAvailabilityCallback.idl \

Added: trunk/Source/WebCore/Modules/push-api/PushManager.cpp (0 => 283916)


--- trunk/Source/WebCore/Modules/push-api/PushManager.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushManager.cpp	2021-10-11 18:38:26 UTC (rev 283916)
@@ -0,0 +1,135 @@
+/*
+ * 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 "PushManager.h"
+
+#if ENABLE(SERVICE_WORKER)
+
+#include "CryptoKeyEC.h"
+#include "Exception.h"
+#include "JSPushPermissionState.h"
+#include "JSPushSubscription.h"
+#include "ScriptExecutionContext.h"
+#include "ServiceWorkerRegistration.h"
+#include <wtf/IsoMallocInlines.h>
+#include <wtf/Vector.h>
+#include <wtf/text/Base64.h>
+
+namespace WebCore {
+
+WTF_MAKE_ISO_ALLOCATED_IMPL(PushManager);
+
+PushManager::PushManager(ServiceWorkerRegistration& serviceWorkerRegistration)
+    : m_serviceWorkerRegistration(serviceWorkerRegistration)
+{
+}
+
+PushManager::~PushManager() = default;
+
+Vector<String> PushManager::supportedContentEncodings()
+{
+    return Vector<String> { "aesgcm"_s, "aes128gcm"_s };
+}
+
+void PushManager::ref() const
+{
+    m_serviceWorkerRegistration.ref();
+}
+
+void PushManager::deref() const
+{
+    m_serviceWorkerRegistration.deref();
+}
+
+void PushManager::subscribe(ScriptExecutionContext& scriptExecutionContext, std::optional<PushSubscriptionOptionsInit>&& options, DOMPromiseDeferred<IDLInterface<PushSubscription>>&& promise)
+{
+    RELEASE_ASSERT(scriptExecutionContext.isSecureContext());
+    
+    if (!options || !options->userVisibleOnly) {
+        promise.reject(Exception { NotAllowedError, "Subscribing for push requires userVisibleOnly to be true"_s });
+        return;
+    }
+    
+    if (!options || !options->applicationServerKey) {
+        promise.reject(Exception { NotSupportedError, "Subscribing for push requires an applicationServerKey"_s });
+        return;
+    }
+    
+    using KeyDataResult = ExceptionOr<Vector<uint8_t>>;
+    auto keyDataResult = WTF::switchOn(*options->applicationServerKey, [](RefPtr<JSC::ArrayBuffer>& value) -> KeyDataResult {
+        if (!value)
+            return Vector<uint8_t> { };
+        return Vector<uint8_t> { reinterpret_cast<const uint8_t*>(value->data()), value->byteLength() };
+    }, [](RefPtr<JSC::ArrayBufferView>& value) -> KeyDataResult {
+        if (!value)
+            return Vector<uint8_t> { };
+        return Vector<uint8_t> { reinterpret_cast<const uint8_t*>(value->baseAddress()), value->byteLength() };
+    }, [](String& value) -> KeyDataResult {
+        auto decoded = base64URLDecode(value);
+        if (!decoded)
+            return Exception { InvalidCharacterError, "applicationServerKey is not properly base64url-encoded"_s };
+        return WTFMove(decoded.value());
+    });
+    
+    if (keyDataResult.hasException()) {
+        promise.reject(keyDataResult.releaseException());
+        return;
+    }
+    
+#if ENABLE(WEB_CRYPTO)
+    auto keyData = keyDataResult.releaseReturnValue();
+    auto key = CryptoKeyEC::importRaw(CryptoAlgorithmIdentifier::ECDSA, "P-256"_s, WTFMove(keyData), false, CryptoKeyUsageVerify);
+#else
+    auto key = nullptr;
+#endif
+    
+    if (!key) {
+        promise.reject(Exception { InvalidAccessError, "applicationServerKey must contain a valid P-256 public key"_s });
+        return;
+    }
+
+    if (!m_serviceWorkerRegistration.active()) {
+        promise.reject(Exception { InvalidStateError, "Subscribing for push requires an active service worker"_s });
+        return;
+    }
+    
+    promise.reject(Exception { NotAllowedError, "Push permission was denied"_s });
+}
+
+void PushManager::getSubscription(DOMPromiseDeferred<IDLNullable<IDLInterface<PushSubscription>>>&& promise)
+{
+    promise.resolve(nullptr);
+}
+
+void PushManager::permissionState(std::optional<PushSubscriptionOptionsInit>&& options, DOMPromiseDeferred<IDLEnumeration<PushPermissionState>>&& promise)
+{
+    UNUSED_PARAM(options);
+    promise.resolve(PushPermissionState::Denied);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

Added: trunk/Source/WebCore/Modules/push-api/PushManager.h (0 => 283916)


--- trunk/Source/WebCore/Modules/push-api/PushManager.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushManager.h	2021-10-11 18:38:26 UTC (rev 283916)
@@ -0,0 +1,64 @@
+/*
+ * 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(SERVICE_WORKER)
+
+#include "JSDOMPromiseDeferred.h"
+#include "PushPermissionState.h"
+#include "PushSubscription.h"
+#include "PushSubscriptionOptionsInit.h"
+#include "ServiceWorkerRegistration.h"
+#include <optional>
+#include <wtf/IsoMalloc.h>
+#include <wtf/WeakPtr.h>
+
+namespace WebCore {
+
+class ScriptExecutionContext;
+
+class PushManager {
+    WTF_MAKE_ISO_ALLOCATED(PushManager);
+public:
+    explicit PushManager(ServiceWorkerRegistration&);
+    ~PushManager();
+
+    void ref() const;
+    void deref() const;
+
+    static Vector<String> supportedContentEncodings();
+
+    void subscribe(ScriptExecutionContext&, std::optional<PushSubscriptionOptionsInit>&&, DOMPromiseDeferred<IDLInterface<PushSubscription>>&&);
+    void getSubscription(DOMPromiseDeferred<IDLNullable<IDLInterface<PushSubscription>>>&&);
+    void permissionState(std::optional<PushSubscriptionOptionsInit>&&, DOMPromiseDeferred<IDLEnumeration<PushPermissionState>>&&);
+
+private:
+    ServiceWorkerRegistration& m_serviceWorkerRegistration;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

Added: trunk/Source/WebCore/Modules/push-api/PushManager.idl (0 => 283916)


--- trunk/Source/WebCore/Modules/push-api/PushManager.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushManager.idl	2021-10-11 18:38:26 UTC (rev 283916)
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+// https://www.w3.org/TR/push-api/#pushmanager-interface
+
+[
+    Conditional=SERVICE_WORKER,
+    EnabledAtRuntime=PushAPIEnabled,
+    ImplementationLacksVTable,
+    SecureContext,
+    Exposed=(Window,Worker),
+] interface PushManager {
+    [SameObject] static readonly attribute FrozenArray<DOMString> supportedContentEncodings;
+
+    [CallWith=ScriptExecutionContext] Promise<PushSubscription> subscribe(optional PushSubscriptionOptionsInit options);
+    Promise<PushSubscription?> getSubscription();
+    Promise<PushPermissionState> permissionState(optional PushSubscriptionOptionsInit options);
+};

Added: trunk/Source/WebCore/Modules/push-api/PushPermissionState.h (0 => 283916)


--- trunk/Source/WebCore/Modules/push-api/PushPermissionState.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushPermissionState.h	2021-10-11 18:38:26 UTC (rev 283916)
@@ -0,0 +1,40 @@
+/*
+ * 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(SERVICE_WORKER)
+
+namespace WebCore {
+
+enum class PushPermissionState : uint8_t {
+    Denied,
+    Granted,
+    Prompt
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

Added: trunk/Source/WebCore/Modules/push-api/PushPermissionState.idl (0 => 283916)


--- trunk/Source/WebCore/Modules/push-api/PushPermissionState.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushPermissionState.idl	2021-10-11 18:38:26 UTC (rev 283916)
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+// https://www.w3.org/TR/push-api/#pushpermissionstate-enumeration
+
+[
+    Conditional=SERVICE_WORKER,
+] enum PushPermissionState {
+    "denied",
+    "granted",
+    "prompt"
+};

Added: trunk/Source/WebCore/Modules/push-api/ServiceWorkerRegistration+PushAPI.idl (0 => 283916)


--- trunk/Source/WebCore/Modules/push-api/ServiceWorkerRegistration+PushAPI.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/ServiceWorkerRegistration+PushAPI.idl	2021-10-11 18:38:26 UTC (rev 283916)
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+// https://www.w3.org/TR/push-api/#extensions-to-the-serviceworkerregistration-interface
+
+[
+    Conditional=SERVICE_WORKER,
+    EnabledAtRuntime=PushAPIEnabled,
+    ImplementedBy=ServiceWorkerRegistrationPushAPI
+] partial interface ServiceWorkerRegistration {
+    readonly attribute PushManager pushManager;
+};

Added: trunk/Source/WebCore/Modules/push-api/ServiceWorkerRegistrationPushAPI.cpp (0 => 283916)


--- trunk/Source/WebCore/Modules/push-api/ServiceWorkerRegistrationPushAPI.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/ServiceWorkerRegistrationPushAPI.cpp	2021-10-11 18:38:26 UTC (rev 283916)
@@ -0,0 +1,75 @@
+/*
+ * 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 "ServiceWorkerRegistrationPushAPI.h"
+
+#if ENABLE(SERVICE_WORKER)
+
+#include "PushManager.h"
+#include "ServiceWorkerRegistration.h"
+#include <wtf/StdLibExtras.h>
+
+namespace WebCore {
+
+ServiceWorkerRegistrationPushAPI::ServiceWorkerRegistrationPushAPI(ServiceWorkerRegistration& serviceWorkerRegistration)
+    : m_serviceWorkerRegistration(serviceWorkerRegistration)
+{
+}
+
+ServiceWorkerRegistrationPushAPI::~ServiceWorkerRegistrationPushAPI() = default;
+
+PushManager& ServiceWorkerRegistrationPushAPI::pushManager(ServiceWorkerRegistration& serviceWorkerRegistration)
+{
+    return ServiceWorkerRegistrationPushAPI::from(serviceWorkerRegistration)->pushManager();
+}
+
+PushManager& ServiceWorkerRegistrationPushAPI::pushManager()
+{
+    if (!m_pushManager)
+        m_pushManager = makeUnique<PushManager>(m_serviceWorkerRegistration);
+
+    return *m_pushManager;
+}
+
+ServiceWorkerRegistrationPushAPI* ServiceWorkerRegistrationPushAPI::from(ServiceWorkerRegistration& serviceWorkerRegistration)
+{
+    auto* supplement = static_cast<ServiceWorkerRegistrationPushAPI*>(Supplement<ServiceWorkerRegistration>::from(&serviceWorkerRegistration, supplementName()));
+    if (!supplement) {
+        auto newSupplement = makeUnique<ServiceWorkerRegistrationPushAPI>(serviceWorkerRegistration);
+        supplement = newSupplement.get();
+        provideTo(&serviceWorkerRegistration, supplementName(), WTFMove(newSupplement));
+    }
+    return supplement;
+}
+
+const char* ServiceWorkerRegistrationPushAPI::supplementName()
+{
+    return "ServiceWorkerRegistrationPushAPI";
+}
+
+}
+
+#endif // ENABLE(SERVICE_WORKER)

Added: trunk/Source/WebCore/Modules/push-api/ServiceWorkerRegistrationPushAPI.h (0 => 283916)


--- trunk/Source/WebCore/Modules/push-api/ServiceWorkerRegistrationPushAPI.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/ServiceWorkerRegistrationPushAPI.h	2021-10-11 18:38:26 UTC (rev 283916)
@@ -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(SERVICE_WORKER)
+
+#include "Supplementable.h"
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class PushManager;
+class ServiceWorkerRegistration;
+
+class ServiceWorkerRegistrationPushAPI : public Supplement<ServiceWorkerRegistration> {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    explicit ServiceWorkerRegistrationPushAPI(ServiceWorkerRegistration&);
+    ~ServiceWorkerRegistrationPushAPI();
+
+    static PushManager& pushManager(ServiceWorkerRegistration&);
+    PushManager& pushManager();
+
+private:
+    static ServiceWorkerRegistrationPushAPI* from(ServiceWorkerRegistration&);
+    static const char* supplementName();
+
+    ServiceWorkerRegistration& m_serviceWorkerRegistration;
+    std::unique_ptr<PushManager> m_pushManager;
+};
+
+}
+
+#endif // ENABLE(SERVICE_WORKER)

Modified: trunk/Source/WebCore/Sources.txt (283915 => 283916)


--- trunk/Source/WebCore/Sources.txt	2021-10-11 18:31:14 UTC (rev 283915)
+++ trunk/Source/WebCore/Sources.txt	2021-10-11 18:38:26 UTC (rev 283916)
@@ -224,6 +224,8 @@
 Modules/push-api/PushMessageData.cpp
 Modules/push-api/PushSubscription.cpp
 Modules/push-api/PushSubscriptionOptions.cpp
+Modules/push-api/PushManager.cpp
+Modules/push-api/ServiceWorkerRegistrationPushAPI.cpp
 Modules/remoteplayback/RemotePlayback.cpp
 Modules/speech/SpeechRecognition.cpp
 Modules/speech/SpeechRecognitionAlternative.cpp
@@ -3371,7 +3373,9 @@
 JSPushEncryptionKeyName.cpp
 JSPushEvent.cpp
 JSPushEventInit.cpp
+JSPushManager.cpp
 JSPushMessageData.cpp
+JSPushPermissionState.cpp
 JSPushSubscription.cpp
 JSPushSubscriptionJSON.cpp
 JSPushSubscriptionOptions.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (283915 => 283916)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-10-11 18:31:14 UTC (rev 283915)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-10-11 18:38:26 UTC (rev 283916)
@@ -5393,6 +5393,9 @@
 		EB0FB70A270D0B1B00F7810D /* PushSubscriptionJSON.h in Headers */ = {isa = PBXBuildFile; fileRef = EB0FB703270D0AEB00F7810D /* PushSubscriptionJSON.h */; };
 		EB0FB70C270D0B2900F7810D /* PushSubscriptionOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = EB0FB706270D0AEC00F7810D /* PushSubscriptionOptions.h */; };
 		EB0FB70D270D0B2E00F7810D /* PushSubscriptionOptionsInit.h in Headers */ = {isa = PBXBuildFile; fileRef = EB0FB701270D0AEA00F7810D /* PushSubscriptionOptionsInit.h */; };
+		EBB9738127100671007732EF /* PushManager.h in Headers */ = {isa = PBXBuildFile; fileRef = EBB9738027100654007732EF /* PushManager.h */; };
+		EBB9738227100676007732EF /* PushPermissionState.h in Headers */ = {isa = PBXBuildFile; fileRef = EBB9737827100651007732EF /* PushPermissionState.h */; };
+		EBB9738327100684007732EF /* ServiceWorkerRegistrationPushAPI.h in Headers */ = {isa = PBXBuildFile; fileRef = EBB9737A27100652007732EF /* ServiceWorkerRegistrationPushAPI.h */; };
 		EBE5B226245A26EF003A5A88 /* SQLiteStatementAutoResetScope.h in Headers */ = {isa = PBXBuildFile; fileRef = EBE5B224245A26EE003A5A88 /* SQLiteStatementAutoResetScope.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		EBF5121C1696496C0056BD25 /* JSTypeConversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBF5121A1696496C0056BD25 /* JSTypeConversions.cpp */; };
 		EBF5121D1696496C0056BD25 /* JSTypeConversions.h in Headers */ = {isa = PBXBuildFile; fileRef = EBF5121B1696496C0056BD25 /* JSTypeConversions.h */; };
@@ -16814,6 +16817,14 @@
 		EB0FB705270D0AEB00F7810D /* PushSubscription.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = PushSubscription.idl; sourceTree = "<group>"; };
 		EB0FB706270D0AEC00F7810D /* PushSubscriptionOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PushSubscriptionOptions.h; sourceTree = "<group>"; };
 		EB0FB707270D0AEC00F7810D /* PushSubscription.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PushSubscription.h; sourceTree = "<group>"; };
+		EBB9737827100651007732EF /* PushPermissionState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PushPermissionState.h; sourceTree = "<group>"; };
+		EBB9737A27100652007732EF /* ServiceWorkerRegistrationPushAPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerRegistrationPushAPI.h; sourceTree = "<group>"; };
+		EBB9737B27100652007732EF /* ServiceWorkerRegistration+PushAPI.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = "ServiceWorkerRegistration+PushAPI.idl"; sourceTree = "<group>"; };
+		EBB9737C27100652007732EF /* PushManager.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PushManager.cpp; sourceTree = "<group>"; };
+		EBB9737D27100653007732EF /* ServiceWorkerRegistrationPushAPI.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerRegistrationPushAPI.cpp; sourceTree = "<group>"; };
+		EBB9737E27100653007732EF /* PushManager.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = PushManager.idl; sourceTree = "<group>"; };
+		EBB9737F27100653007732EF /* PushPermissionState.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = PushPermissionState.idl; sourceTree = "<group>"; };
+		EBB9738027100654007732EF /* PushManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PushManager.h; sourceTree = "<group>"; };
 		EBE5B224245A26EE003A5A88 /* SQLiteStatementAutoResetScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLiteStatementAutoResetScope.h; sourceTree = "<group>"; };
 		EBE5B227245A29CF003A5A88 /* SQLiteStatementAutoResetScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLiteStatementAutoResetScope.cpp; sourceTree = "<group>"; };
 		EBF5121A1696496C0056BD25 /* JSTypeConversions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTypeConversions.cpp; sourceTree = "<group>"; };
@@ -19984,9 +19995,14 @@
 				418FCBC02706E4F800F96ECA /* PushEvent.idl */,
 				418FCBBF2706E4F800F96ECA /* PushEventInit.h */,
 				418FCBC32706E62C00F96ECA /* PushEventInit.idl */,
+				EBB9737C27100652007732EF /* PushManager.cpp */,
+				EBB9738027100654007732EF /* PushManager.h */,
+				EBB9737E27100653007732EF /* PushManager.idl */,
 				418FCBBE2706E4F700F96ECA /* PushMessageData.cpp */,
 				418FCBBC2706E4F600F96ECA /* PushMessageData.h */,
 				418FCBBA2706E4F500F96ECA /* PushMessageData.idl */,
+				EBB9737827100651007732EF /* PushPermissionState.h */,
+				EBB9737F27100653007732EF /* PushPermissionState.idl */,
 				EB0FB704270D0AEB00F7810D /* PushSubscription.cpp */,
 				EB0FB707270D0AEC00F7810D /* PushSubscription.h */,
 				EB0FB705270D0AEB00F7810D /* PushSubscription.idl */,
@@ -20000,6 +20016,9 @@
 				418FCBCB2706F3CD00F96ECA /* ServiceWorkerGlobalScope+PushAPI.idl */,
 				418FCBCD2706F43400F96ECA /* ServiceWorkerGlobalScopePushAPI.cpp */,
 				418FCBCC2706F43400F96ECA /* ServiceWorkerGlobalScopePushAPI.h */,
+				EBB9737B27100652007732EF /* ServiceWorkerRegistration+PushAPI.idl */,
+				EBB9737D27100653007732EF /* ServiceWorkerRegistrationPushAPI.cpp */,
+				EBB9737A27100652007732EF /* ServiceWorkerRegistrationPushAPI.h */,
 			);
 			path = "push-api";
 			sourceTree = "<group>";
@@ -34817,6 +34836,8 @@
 				EB0FB708270D0B1000F7810D /* PushEncryptionKeyName.h in Headers */,
 				418FCBC12706E4FB00F96ECA /* PushEvent.h in Headers */,
 				418FCBC22706E50100F96ECA /* PushEventInit.h in Headers */,
+				EBB9738127100671007732EF /* PushManager.h in Headers */,
+				EBB9738227100676007732EF /* PushPermissionState.h in Headers */,
 				83D511F6250C1CBF002EDC51 /* PushPullFIFO.h in Headers */,
 				EB0FB709270D0B1800F7810D /* PushSubscription.h in Headers */,
 				EB0FB70A270D0B1B00F7810D /* PushSubscriptionJSON.h in Headers */,
@@ -35312,6 +35333,7 @@
 				517A534F1F54A8BA00DCDC0A /* ServiceWorkerRegistrationData.h in Headers */,
 				517A53291F4B90B900DCDC0A /* ServiceWorkerRegistrationKey.h in Headers */,
 				51F175691F3EBC8300C74950 /* ServiceWorkerRegistrationOptions.h in Headers */,
+				EBB9738327100684007732EF /* ServiceWorkerRegistrationPushAPI.h in Headers */,
 				51BCCE301F8F179E006BA0ED /* ServiceWorkerThread.h in Headers */,
 				4112B5431F9F9CA000E67875 /* ServiceWorkerThreadProxy.h in Headers */,
 				515E37F61FAA940200D7F22A /* ServiceWorkerTypes.h in Headers */,

Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (283915 => 283916)


--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2021-10-11 18:31:14 UTC (rev 283915)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2021-10-11 18:38:26 UTC (rev 283916)
@@ -210,6 +210,7 @@
     macro(PointerEvent) \
     macro(PublicKeyCredential) \
     macro(PushEvent) \
+    macro(PushManager) \
     macro(PushMessageData) \
     macro(PushSubscription) \
     macro(PushSubscriptionOptions) \

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.h (283915 => 283916)


--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.h	2021-10-11 18:31:14 UTC (rev 283915)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.h	2021-10-11 18:38:26 UTC (rev 283916)
@@ -31,6 +31,7 @@
 #include "EventTarget.h"
 #include "SWClientConnection.h"
 #include "ServiceWorkerRegistrationData.h"
+#include "Supplementable.h"
 #include "Timer.h"
 
 namespace WebCore {
@@ -40,7 +41,7 @@
 class ServiceWorker;
 class ServiceWorkerContainer;
 
-class ServiceWorkerRegistration final : public RefCounted<ServiceWorkerRegistration>, public EventTargetWithInlineData, public ActiveDOMObject {
+class ServiceWorkerRegistration final : public RefCounted<ServiceWorkerRegistration>, public Supplementable<ServiceWorkerRegistration>, public EventTargetWithInlineData, public ActiveDOMObject {
     WTF_MAKE_ISO_ALLOCATED(ServiceWorkerRegistration);
 public:
     static Ref<ServiceWorkerRegistration> getOrCreate(ScriptExecutionContext&, Ref<ServiceWorkerContainer>&&, ServiceWorkerRegistrationData&&);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to