Title: [283700] trunk
Revision
283700
Author
[email protected]
Date
2021-10-06 21:15:05 -0700 (Wed, 06 Oct 2021)

Log Message

Add PushSubscription stubs
https://bugs.webkit.org/show_bug.cgi?id=231278

Reviewed Alex Christensen.

LayoutTests/imported/w3c:

Updated the WPT test results to reflect the newly implemented interfaces.


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

Source/WebCore:

This adds PushSubscription-related IDL to WebCore. Currently the objects are just data
containers and PushSubscription.unsubscribe() does nothing.

Test: http/wpt/push-api/pushSubscription.https.any.html


* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/push-api/PushEncryptionKeyName.h: Added.
* Modules/push-api/PushEncryptionKeyName.idl: Added.
* Modules/push-api/PushSubscription.cpp: Added.
(WebCore::PushSubscription::create):
(WebCore::PushSubscription::PushSubscription):
(WebCore::PushSubscription::endpoint const):
(WebCore::PushSubscription::expirationTime const):
(WebCore::PushSubscription::options const):
(WebCore::PushSubscription::getKey const):
(WebCore::PushSubscription::unsubscribe):
(WebCore::PushSubscription::toJSON const):
* Modules/push-api/PushSubscription.h: Added.
* Modules/push-api/PushSubscription.idl: Added.
* Modules/push-api/PushSubscriptionJSON.h: Added.
* Modules/push-api/PushSubscriptionJSON.idl: Added.
* Modules/push-api/PushSubscriptionOptions.cpp: Added.
(WebCore::PushSubscriptionOptions::create):
(WebCore::PushSubscriptionOptions::PushSubscriptionOptions):
(WebCore::PushSubscriptionOptions::userVisibleOnly const):
(WebCore::PushSubscriptionOptions::serverVAPIDPublicKey const):
(WebCore::PushSubscriptionOptions::applicationServerKey const):
* Modules/push-api/PushSubscriptionOptions.h: Added.
* Modules/push-api/PushSubscriptionOptions.idl: Added.
* Modules/push-api/PushSubscriptionOptionsInit.h: Added.
* Modules/push-api/PushSubscriptionOptionsInit.idl: Added.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* testing/Internals.cpp:
(WebCore::Internals::createPushSubscription):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

Added a basic test for PushSubscription. Right now the test only runs in the window global
scope because it relies on a constructor called via window.internals. I'll add more test
cases and test it in the worker scope as well once we change the test to create a
subscription via a mocked PushManager.subscribe call instead.


* http/wpt/push-api/pushSubscription.https.any-expected.txt: Added.
* http/wpt/push-api/pushSubscription.https.any.html: Added.
* http/wpt/push-api/pushSubscription.https.any.js: Added.
(bytesFrom):
(test):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (283699 => 283700)


--- trunk/LayoutTests/ChangeLog	2021-10-07 04:02:03 UTC (rev 283699)
+++ trunk/LayoutTests/ChangeLog	2021-10-07 04:15:05 UTC (rev 283700)
@@ -1,3 +1,21 @@
+2021-10-06  Ben Nham  <[email protected]>
+
+        Add PushSubscription stubs
+        https://bugs.webkit.org/show_bug.cgi?id=231278
+
+        Reviewed Alex Christensen.
+
+        Added a basic test for PushSubscription. Right now the test only runs in the window global
+        scope because it relies on a constructor called via window.internals. I'll add more test
+        cases and test it in the worker scope as well once we change the test to create a
+        subscription via a mocked PushManager.subscribe call instead.
+
+        * http/wpt/push-api/pushSubscription.https.any-expected.txt: Added.
+        * http/wpt/push-api/pushSubscription.https.any.html: Added.
+        * http/wpt/push-api/pushSubscription.https.any.js: Added.
+        (bytesFrom):
+        (test):
+
 2021-10-06  Ayumi Kojima  <[email protected]>
 
         [ iOS 15 Debug ] imported/w3c/web-platform-tests/xhr/send-timeout-events.htm is a flaky failure.

Added: trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any-expected.txt (0 => 283700)


--- trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any-expected.txt	2021-10-07 04:15:05 UTC (rev 283700)
@@ -0,0 +1,3 @@
+
+PASS PushSubscription getters
+

Added: trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.html (0 => 283700)


--- trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.html	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.html	2021-10-07 04:15:05 UTC (rev 283700)
@@ -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/pushSubscription.https.any.js (0 => 283700)


--- trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.js	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.js	2021-10-07 04:15:05 UTC (rev 283700)
@@ -0,0 +1,40 @@
+// META: title=PushSubscription tests
+// META: global=window
+
+const endpoint = 'https://www.webkit.org';
+const expirationTime = 1633000000;
+const key1Buffer = 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]).buffer;
+const key1Base64URL = 'BA1Hxzyi1RUM1b5wjxsn7nGxAszw2u61m164i3MrAIxHF6YK5h4SDYic-dRuU_RCPCfA5aq9ojSwk5Y2EmClBPs';
+const key2Buffer = new Uint8Array([4, 37, 113, 178, 190, 205, 253, 227, 96, 85, 26, 175, 30, 208, 244, 205, 54, 108, 17, 206, 190, 85, 95, 137, 188, 183, 177, 134, 165, 51, 57, 23, 49, 104, 236, 226, 235, 224, 24, 89, 123, 211, 4, 121, 184, 110, 60, 143, 142, 206, 213, 119, 202, 89, 24, 126, 146, 70, 153, 13, 182, 130, 0, 139, 14]).buffer;
+const key2Base64URL = 'BCVxsr7N_eNgVRqvHtD0zTZsEc6-VV-JvLexhqUzORcxaOzi6-AYWXvTBHm4bjyPjs7Vd8pZGH6SRpkNtoIAiw4';
+const authBuffer = new Uint8Array([5, 48, 89, 50, 161, 199, 234, 190, 19, 182, 206, 201, 253, 164, 136, 130]).buffer;
+const authBase64URL = 'BTBZMqHH6r4Tts7J_aSIgg';
+
+function bytesFrom(buf) {
+    return Array.from(new Uint8Array(buf));
+}
+
+test(() => {
+    assert_true(!!window.internals, "test requires internals");
+
+    let userVisibleOnly = true;
+    let subscription = window.internals.createPushSubscription(endpoint, expirationTime, userVisibleOnly, key1Buffer, key2Buffer, authBuffer);
+    assert_true(subscription instanceof PushSubscription);
+
+    assert_equals(subscription.endpoint, endpoint);
+    assert_equals(subscription.expirationTime, expirationTime);
+    assert_true(subscription.options === subscription.options, "options should always return same object");
+    assert_equals(subscription.options.userVisibleOnly, userVisibleOnly);
+    assert_true(subscription.options.applicationServerKey === subscription.options.applicationServerKey, "applicationServerKey should return same object");
+    assert_array_equals(bytesFrom(subscription.options.applicationServerKey), bytesFrom(key1Buffer));
+    assert_array_equals(bytesFrom(subscription.getKey('p256dh')), bytesFrom(key2Buffer));
+    assert_array_equals(bytesFrom(subscription.getKey('auth')), bytesFrom(authBuffer));
+
+    obj = subscription.toJSON();
+    assert_equals(Object.keys(obj).length, 3);
+    assert_equals(obj.endpoint, endpoint);
+    assert_equals(obj.expirationTime, expirationTime);
+    assert_equals(Object.keys(obj.keys).length, 2);
+    assert_equals(obj.keys.p256dh, key2Base64URL);
+    assert_equals(obj.keys.auth, authBase64URL);
+}, "PushSubscription getters");

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (283699 => 283700)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-10-07 04:02:03 UTC (rev 283699)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-10-07 04:15:05 UTC (rev 283700)
@@ -1,3 +1,15 @@
+2021-10-06  Ben Nham  <[email protected]>
+
+        Add PushSubscription stubs
+        https://bugs.webkit.org/show_bug.cgi?id=231278
+
+        Reviewed Alex Christensen.
+
+        Updated the WPT test results to reflect the newly implemented interfaces.
+
+        * web-platform-tests/push-api/idlharness.https.any-expected.txt:
+        * web-platform-tests/push-api/idlharness.https.any.serviceworker-expected.txt:
+
 2021-10-06  Sihui Liu  <[email protected]>
 
         Add support for FileSystemSyncAccessHandle

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any-expected.txt	2021-10-07 04:02:03 UTC (rev 283699)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any-expected.txt	2021-10-07 04:15:05 UTC (rev 283700)
@@ -25,26 +25,26 @@
 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"
-FAIL PushSubscriptionOptions interface: existence and properties of interface object assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface object length assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface object name assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface: existence and properties of interface prototype object assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface: attribute userVisibleOnly assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface: attribute applicationServerKey assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscription interface: existence and properties of interface object assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface object length assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface object name assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: existence and properties of interface prototype object assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: attribute endpoint assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: attribute expirationTime assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: attribute options assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: operation getKey(PushEncryptionKeyName) assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: operation unsubscribe() assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: operation toJSON() assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
+PASS PushSubscriptionOptions interface: existence and properties of interface object
+PASS PushSubscriptionOptions interface object length
+PASS PushSubscriptionOptions interface object name
+PASS PushSubscriptionOptions interface: existence and properties of interface prototype object
+PASS PushSubscriptionOptions interface: existence and properties of interface prototype object's "constructor" property
+PASS PushSubscriptionOptions interface: existence and properties of interface prototype object's @@unscopables property
+PASS PushSubscriptionOptions interface: attribute userVisibleOnly
+PASS PushSubscriptionOptions interface: attribute applicationServerKey
+PASS PushSubscription interface: existence and properties of interface object
+PASS PushSubscription interface object length
+PASS PushSubscription interface object name
+PASS PushSubscription interface: existence and properties of interface prototype object
+PASS PushSubscription interface: existence and properties of interface prototype object's "constructor" property
+PASS PushSubscription interface: existence and properties of interface prototype object's @@unscopables property
+PASS PushSubscription interface: attribute endpoint
+PASS PushSubscription interface: attribute expirationTime
+PASS PushSubscription interface: attribute options
+PASS PushSubscription interface: operation getKey(PushEncryptionKeyName)
+PASS PushSubscription interface: operation unsubscribe()
+PASS PushSubscription interface: operation toJSON()
 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

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any.serviceworker-expected.txt	2021-10-07 04:02:03 UTC (rev 283699)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any.serviceworker-expected.txt	2021-10-07 04:15:05 UTC (rev 283700)
@@ -25,26 +25,26 @@
 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"
-FAIL PushSubscriptionOptions interface: existence and properties of interface object assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface object length assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface object name assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface: existence and properties of interface prototype object assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface: attribute userVisibleOnly assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface: attribute applicationServerKey assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscription interface: existence and properties of interface object assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface object length assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface object name assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: existence and properties of interface prototype object assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: attribute endpoint assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: attribute expirationTime assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: attribute options assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: operation getKey(PushEncryptionKeyName) assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: operation unsubscribe() assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: operation toJSON() assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
+PASS PushSubscriptionOptions interface: existence and properties of interface object
+PASS PushSubscriptionOptions interface object length
+PASS PushSubscriptionOptions interface object name
+PASS PushSubscriptionOptions interface: existence and properties of interface prototype object
+PASS PushSubscriptionOptions interface: existence and properties of interface prototype object's "constructor" property
+PASS PushSubscriptionOptions interface: existence and properties of interface prototype object's @@unscopables property
+PASS PushSubscriptionOptions interface: attribute userVisibleOnly
+PASS PushSubscriptionOptions interface: attribute applicationServerKey
+PASS PushSubscription interface: existence and properties of interface object
+PASS PushSubscription interface object length
+PASS PushSubscription interface object name
+PASS PushSubscription interface: existence and properties of interface prototype object
+PASS PushSubscription interface: existence and properties of interface prototype object's "constructor" property
+PASS PushSubscription interface: existence and properties of interface prototype object's @@unscopables property
+PASS PushSubscription interface: attribute endpoint
+PASS PushSubscription interface: attribute expirationTime
+PASS PushSubscription interface: attribute options
+PASS PushSubscription interface: operation getKey(PushEncryptionKeyName)
+PASS PushSubscription interface: operation unsubscribe()
+PASS PushSubscription interface: operation toJSON()
 PASS PushMessageData interface: existence and properties of interface object
 PASS PushMessageData interface object length
 PASS PushMessageData interface object name

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any.worker-expected.txt	2021-10-07 04:02:03 UTC (rev 283699)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any.worker-expected.txt	2021-10-07 04:15:05 UTC (rev 283700)
@@ -17,26 +17,26 @@
 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 PushSubscriptionOptions interface: existence and properties of interface object assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface object length assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface object name assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface: existence and properties of interface prototype object assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface: attribute userVisibleOnly assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscriptionOptions interface: attribute applicationServerKey assert_own_property: self does not have own property "PushSubscriptionOptions" expected property "PushSubscriptionOptions" missing
-FAIL PushSubscription interface: existence and properties of interface object assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface object length assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface object name assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: existence and properties of interface prototype object assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: attribute endpoint assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: attribute expirationTime assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: attribute options assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: operation getKey(PushEncryptionKeyName) assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: operation unsubscribe() assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
-FAIL PushSubscription interface: operation toJSON() assert_own_property: self does not have own property "PushSubscription" expected property "PushSubscription" missing
+PASS PushSubscriptionOptions interface: existence and properties of interface object
+PASS PushSubscriptionOptions interface object length
+PASS PushSubscriptionOptions interface object name
+PASS PushSubscriptionOptions interface: existence and properties of interface prototype object
+PASS PushSubscriptionOptions interface: existence and properties of interface prototype object's "constructor" property
+PASS PushSubscriptionOptions interface: existence and properties of interface prototype object's @@unscopables property
+PASS PushSubscriptionOptions interface: attribute userVisibleOnly
+PASS PushSubscriptionOptions interface: attribute applicationServerKey
+PASS PushSubscription interface: existence and properties of interface object
+PASS PushSubscription interface object length
+PASS PushSubscription interface object name
+PASS PushSubscription interface: existence and properties of interface prototype object
+PASS PushSubscription interface: existence and properties of interface prototype object's "constructor" property
+PASS PushSubscription interface: existence and properties of interface prototype object's @@unscopables property
+PASS PushSubscription interface: attribute endpoint
+PASS PushSubscription interface: attribute expirationTime
+PASS PushSubscription interface: attribute options
+PASS PushSubscription interface: operation getKey(PushEncryptionKeyName)
+PASS PushSubscription interface: operation unsubscribe()
+PASS PushSubscription interface: operation toJSON()
 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

Modified: trunk/Source/WebCore/CMakeLists.txt (283699 => 283700)


--- trunk/Source/WebCore/CMakeLists.txt	2021-10-07 04:02:03 UTC (rev 283699)
+++ trunk/Source/WebCore/CMakeLists.txt	2021-10-07 04:15:05 UTC (rev 283700)
@@ -499,9 +499,14 @@
     Modules/pictureinpicture/HTMLVideoElement+PictureInPicture.idl
     Modules/pictureinpicture/PictureInPictureWindow.idl
 
+    Modules/push-api/PushEncryptionKeyName.idl
     Modules/push-api/PushEvent.idl
     Modules/push-api/PushEventInit.idl
     Modules/push-api/PushMessageData.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/remoteplayback/RemotePlayback.idl

Modified: trunk/Source/WebCore/ChangeLog (283699 => 283700)


--- trunk/Source/WebCore/ChangeLog	2021-10-07 04:02:03 UTC (rev 283699)
+++ trunk/Source/WebCore/ChangeLog	2021-10-07 04:15:05 UTC (rev 283700)
@@ -1,3 +1,52 @@
+2021-10-06  Ben Nham  <[email protected]>
+
+        Add PushSubscription stubs
+        https://bugs.webkit.org/show_bug.cgi?id=231278
+
+        Reviewed Alex Christensen.
+
+        This adds PushSubscription-related IDL to WebCore. Currently the objects are just data
+        containers and PushSubscription.unsubscribe() does nothing.
+
+        Test: http/wpt/push-api/pushSubscription.https.any.html
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Modules/push-api/PushEncryptionKeyName.h: Added.
+        * Modules/push-api/PushEncryptionKeyName.idl: Added.
+        * Modules/push-api/PushSubscription.cpp: Added.
+        (WebCore::PushSubscription::create):
+        (WebCore::PushSubscription::PushSubscription):
+        (WebCore::PushSubscription::endpoint const):
+        (WebCore::PushSubscription::expirationTime const):
+        (WebCore::PushSubscription::options const):
+        (WebCore::PushSubscription::getKey const):
+        (WebCore::PushSubscription::unsubscribe):
+        (WebCore::PushSubscription::toJSON const):
+        * Modules/push-api/PushSubscription.h: Added.
+        * Modules/push-api/PushSubscription.idl: Added.
+        * Modules/push-api/PushSubscriptionJSON.h: Added.
+        * Modules/push-api/PushSubscriptionJSON.idl: Added.
+        * Modules/push-api/PushSubscriptionOptions.cpp: Added.
+        (WebCore::PushSubscriptionOptions::create):
+        (WebCore::PushSubscriptionOptions::PushSubscriptionOptions):
+        (WebCore::PushSubscriptionOptions::userVisibleOnly const):
+        (WebCore::PushSubscriptionOptions::serverVAPIDPublicKey const):
+        (WebCore::PushSubscriptionOptions::applicationServerKey const):
+        * Modules/push-api/PushSubscriptionOptions.h: Added.
+        * Modules/push-api/PushSubscriptionOptions.idl: Added.
+        * Modules/push-api/PushSubscriptionOptionsInit.h: Added.
+        * Modules/push-api/PushSubscriptionOptionsInit.idl: Added.
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/WebCoreBuiltinNames.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::createPushSubscription):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2021-10-06  Alan Bujtas  <[email protected]>
 
         [LFC][IFC] InlineDisplay::Box should not hold on to RenderStyle&

Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (283699 => 283700)


--- trunk/Source/WebCore/DerivedSources-input.xcfilelist	2021-10-07 04:02:03 UTC (rev 283699)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist	2021-10-07 04:15:05 UTC (rev 283700)
@@ -422,9 +422,14 @@
 $(PROJECT_DIR)/Modules/plugins/QuickTimePluginReplacement.css
 $(PROJECT_DIR)/Modules/plugins/QuickTimePluginReplacement.idl
 $(PROJECT_DIR)/Modules/plugins/QuickTimePluginReplacement.js
+$(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/PushMessageData.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/remoteplayback/HTMLMediaElement+RemotePlayback.idl
 $(PROJECT_DIR)/Modules/remoteplayback/RemotePlayback.idl

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (283699 => 283700)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2021-10-07 04:02:03 UTC (rev 283699)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2021-10-07 04:15:05 UTC (rev 283700)
@@ -1697,6 +1697,8 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPublicKeyCredentialRequestOptions.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPublicKeyCredentialType.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPublicKeyCredentialType.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushEncryptionKeyName.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushEncryptionKeyName.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushEvent.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushEvent.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushEventInit.cpp
@@ -1703,6 +1705,14 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushEventInit.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushMessageData.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushMessageData.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushSubscription.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushSubscription.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushSubscriptionJSON.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushSubscriptionJSON.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushSubscriptionOptions.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushSubscriptionOptions.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushSubscriptionOptionsInit.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushSubscriptionOptionsInit.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSQuickTimePluginReplacement.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSQuickTimePluginReplacement.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSRTCAnswerOptions.cpp

Modified: trunk/Source/WebCore/DerivedSources.make (283699 => 283700)


--- trunk/Source/WebCore/DerivedSources.make	2021-10-07 04:02:03 UTC (rev 283699)
+++ trunk/Source/WebCore/DerivedSources.make	2021-10-07 04:15:05 UTC (rev 283700)
@@ -347,9 +347,14 @@
     $(WebCore)/Modules/pictureinpicture/HTMLVideoElement+PictureInPicture.idl \
     $(WebCore)/Modules/pictureinpicture/PictureInPictureWindow.idl \
     $(WebCore)/Modules/plugins/QuickTimePluginReplacement.idl \
+    $(WebCore)/Modules/push-api/PushEncryptionKeyName.idl \
     $(WebCore)/Modules/push-api/PushEvent.idl \
     $(WebCore)/Modules/push-api/PushEventInit.idl \
     $(WebCore)/Modules/push-api/PushMessageData.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/remoteplayback/HTMLMediaElement+RemotePlayback.idl \
     $(WebCore)/Modules/remoteplayback/RemotePlayback.idl \

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


--- trunk/Source/WebCore/Modules/push-api/PushEncryptionKeyName.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushEncryptionKeyName.h	2021-10-07 04:15:05 UTC (rev 283700)
@@ -0,0 +1,39 @@
+/*
+ * 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 PushEncryptionKeyName : bool {
+    P256dh,
+    Auth
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

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


--- trunk/Source/WebCore/Modules/push-api/PushEncryptionKeyName.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushEncryptionKeyName.idl	2021-10-07 04:15:05 UTC (rev 283700)
@@ -0,0 +1,33 @@
+/*
+ * 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/#pushencryptionkeyname-enumeration
+
+[
+    Conditional=SERVICE_WORKER,
+] enum PushEncryptionKeyName {
+    "p256dh",
+    "auth"
+};

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


--- trunk/Source/WebCore/Modules/push-api/PushSubscription.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscription.cpp	2021-10-07 04:15:05 UTC (rev 283700)
@@ -0,0 +1,106 @@
+/*
+ * 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 "PushSubscription.h"
+
+#if ENABLE(SERVICE_WORKER)
+
+#include "Exception.h"
+#include "PushSubscriptionOptions.h"
+#include <wtf/IsoMallocInlines.h>
+#include <wtf/text/Base64.h>
+
+namespace WebCore {
+
+WTF_MAKE_ISO_ALLOCATED_IMPL(PushSubscription);
+
+PushSubscription::PushSubscription(String&& endpoint, std::optional<DOMTimeStamp> expirationTime, Ref<PushSubscriptionOptions>&& options, Vector<uint8_t>&& clientECDHPublicKey, Vector<uint8_t>&& sharedAuthenticationSecret)
+    : m_endpoint(WTFMove(endpoint))
+    , m_expirationTime(expirationTime)
+    , m_options(WTFMove(options))
+    , m_clientECDHPublicKey(WTFMove(clientECDHPublicKey))
+    , m_sharedAuthenticationSecret(WTFMove(sharedAuthenticationSecret))
+{
+}
+
+PushSubscription::~PushSubscription() = default;
+
+const String& PushSubscription::endpoint() const
+{
+    return m_endpoint;
+}
+
+std::optional<DOMTimeStamp> PushSubscription::expirationTime() const
+{
+    return m_expirationTime;
+}
+
+PushSubscriptionOptions& PushSubscription::options() const
+{
+    return m_options;
+}
+
+ExceptionOr<RefPtr<JSC::ArrayBuffer>> PushSubscription::getKey(PushEncryptionKeyName name) const
+{
+    const Vector<uint8_t> *source = nullptr;
+
+    switch (name) {
+    case PushEncryptionKeyName::P256dh:
+        source = &m_clientECDHPublicKey;
+        break;
+    case PushEncryptionKeyName::Auth:
+        source = &m_sharedAuthenticationSecret;
+        break;
+    default:
+        return nullptr;
+    }
+
+    auto buffer = ArrayBuffer::tryCreate(source->data(), source->size());
+    if (!buffer)
+        return Exception { OutOfMemoryError };
+    return buffer;
+}
+
+void PushSubscription::unsubscribe(DOMPromiseDeferred<IDLBoolean>&& promise)
+{
+    promise.reject(Exception { NotSupportedError, "Not implemented"_s });
+}
+
+PushSubscriptionJSON PushSubscription::toJSON() const
+{
+    return PushSubscriptionJSON {
+        m_endpoint,
+        m_expirationTime,
+        Vector<WTF::KeyValuePair<String, String>> {
+            { "p256dh"_s, base64URLEncodeToString(m_clientECDHPublicKey) },
+            { "auth"_s, base64URLEncodeToString(m_sharedAuthenticationSecret) }
+        }
+    };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

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


--- trunk/Source/WebCore/Modules/push-api/PushSubscription.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscription.h	2021-10-07 04:15:05 UTC (rev 283700)
@@ -0,0 +1,71 @@
+/*
+ * 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 "DOMTimeStamp.h"
+#include "ExceptionOr.h"
+#include "JSDOMPromiseDeferred.h"
+#include "PushEncryptionKeyName.h"
+#include "PushSubscriptionJSON.h"
+
+#include <optional>
+#include <wtf/IsoMalloc.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Variant.h>
+
+namespace WebCore {
+
+class PushSubscriptionOptions;
+
+class PushSubscription : public RefCounted<PushSubscription> {
+    WTF_MAKE_ISO_ALLOCATED_EXPORT(PushSubscription, WEBCORE_EXPORT);
+public:
+    template<typename... Args> static Ref<PushSubscription> create(Args&&... args) { return adoptRef(*new PushSubscription(std::forward<Args>(args)...)); }
+    WEBCORE_EXPORT ~PushSubscription();
+
+    const String& endpoint() const;
+    std::optional<DOMTimeStamp> expirationTime() const;
+    PushSubscriptionOptions& options() const;
+    ExceptionOr<RefPtr<JSC::ArrayBuffer>> getKey(PushEncryptionKeyName) const;
+    void unsubscribe(DOMPromiseDeferred<IDLBoolean>&&);
+
+    PushSubscriptionJSON toJSON() const;
+
+private:
+    WEBCORE_EXPORT PushSubscription(String&& endpoint, std::optional<DOMTimeStamp> expirationTime, Ref<PushSubscriptionOptions>&&, Vector<uint8_t>&& clientECDHPublicKey, Vector<uint8_t>&& auth);
+
+    String m_endpoint;
+    std::optional<DOMTimeStamp> m_expirationTime;
+    Ref<PushSubscriptionOptions> m_options;
+    Vector<uint8_t> m_clientECDHPublicKey;
+    Vector<uint8_t> m_sharedAuthenticationSecret;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

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


--- trunk/Source/WebCore/Modules/push-api/PushSubscription.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscription.idl	2021-10-07 04:15:05 UTC (rev 283700)
@@ -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.
+ */
+
+// https://www.w3.org/TR/push-api/#pushsubscription-interface
+
+[
+    Conditional=SERVICE_WORKER,
+    EnabledAtRuntime=PushAPIEnabled,
+    ExportMacro=WEBCORE_EXPORT,
+    ImplementationLacksVTable,
+    SecureContext,
+    Exposed=(Window,Worker),
+] interface PushSubscription {
+    readonly attribute USVString endpoint;
+    readonly attribute DOMTimeStamp? expirationTime;
+    [SameObject] readonly attribute PushSubscriptionOptions options;
+    ArrayBuffer? getKey(PushEncryptionKeyName name);
+    Promise<boolean> unsubscribe();
+
+    PushSubscriptionJSON toJSON();
+};

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


--- trunk/Source/WebCore/Modules/push-api/PushSubscriptionJSON.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscriptionJSON.h	2021-10-07 04:15:05 UTC (rev 283700)
@@ -0,0 +1,46 @@
+/*
+ * 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 "DOMTimeStamp.h"
+
+#include <optional>
+#include <wtf/KeyValuePair.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+struct PushSubscriptionJSON {
+    String endpoint;
+    std::optional<DOMTimeStamp> expirationTime;
+    Vector<WTF::KeyValuePair<String, String>> keys;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

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


--- trunk/Source/WebCore/Modules/push-api/PushSubscriptionJSON.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscriptionJSON.idl	2021-10-07 04:15:05 UTC (rev 283700)
@@ -0,0 +1,35 @@
+/*
+ * 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/#pushsubscription-interface
+
+[
+    Conditional=SERVICE_WORKER,
+    JSGenerateToJSObject,
+] dictionary PushSubscriptionJSON {
+    USVString endpoint;
+    DOMTimeStamp? expirationTime;
+    record<DOMString, USVString> keys;
+};

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


--- trunk/Source/WebCore/Modules/push-api/PushSubscriptionOptions.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscriptionOptions.cpp	2021-10-07 04:15:05 UTC (rev 283700)
@@ -0,0 +1,68 @@
+/*
+ * 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 "PushSubscriptionOptions.h"
+
+#if ENABLE(SERVICE_WORKER)
+
+#include <wtf/IsoMallocInlines.h>
+
+namespace WebCore {
+
+WTF_MAKE_ISO_ALLOCATED_IMPL(PushSubscriptionOptions);
+
+PushSubscriptionOptions::PushSubscriptionOptions(bool userVisibleOnly, Vector<uint8_t>&& serverVAPIDPublicKey)
+    : m_userVisibleOnly(userVisibleOnly)
+    , m_serverVAPIDPublicKey(WTFMove(serverVAPIDPublicKey))
+{
+}
+
+PushSubscriptionOptions::~PushSubscriptionOptions() = default;
+
+bool PushSubscriptionOptions::userVisibleOnly() const
+{
+    return m_userVisibleOnly;
+}
+
+const Vector<uint8_t>& PushSubscriptionOptions::serverVAPIDPublicKey() const
+{
+    return m_serverVAPIDPublicKey;
+}
+
+ExceptionOr<RefPtr<JSC::ArrayBuffer>> PushSubscriptionOptions::applicationServerKey() const
+{
+    if (!m_applicationServerKey) {
+        m_applicationServerKey = ArrayBuffer::tryCreate(m_serverVAPIDPublicKey.data(), m_serverVAPIDPublicKey.size());
+        if (!m_applicationServerKey)
+            return Exception { OutOfMemoryError };
+    }
+
+    return m_applicationServerKey.copyRef();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

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


--- trunk/Source/WebCore/Modules/push-api/PushSubscriptionOptions.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscriptionOptions.h	2021-10-07 04:15:05 UTC (rev 283700)
@@ -0,0 +1,60 @@
+/*
+ * 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 "DOMTimeStamp.h"
+#include "ExceptionOr.h"
+
+#include <_javascript_Core/ArrayBuffer.h>
+#include <optional>
+#include <wtf/IsoMalloc.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class PushSubscriptionOptions : public RefCounted<PushSubscriptionOptions> {
+    WTF_MAKE_ISO_ALLOCATED_EXPORT(PushSubscriptionOptions, WEBCORE_EXPORT);
+public:
+    template<typename... Args> static Ref<PushSubscriptionOptions> create(Args&&... args) { return adoptRef(*new PushSubscriptionOptions(std::forward<Args>(args)...)); }
+    WEBCORE_EXPORT ~PushSubscriptionOptions();
+
+    bool userVisibleOnly() const;
+    const Vector<uint8_t>& serverVAPIDPublicKey() const;
+    ExceptionOr<RefPtr<JSC::ArrayBuffer>> applicationServerKey() const;
+
+private:
+    WEBCORE_EXPORT PushSubscriptionOptions(bool userVisibleOnly, Vector<uint8_t>&&applicationServerKey);
+
+    bool m_userVisibleOnly;
+    Vector<uint8_t> m_serverVAPIDPublicKey;
+    mutable RefPtr<JSC::ArrayBuffer> m_applicationServerKey;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

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


--- trunk/Source/WebCore/Modules/push-api/PushSubscriptionOptions.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscriptionOptions.idl	2021-10-07 04:15:05 UTC (rev 283700)
@@ -0,0 +1,37 @@
+/*
+ * 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/#pushsubscriptionoptions-interface
+
+[
+    Conditional=SERVICE_WORKER,
+    EnabledAtRuntime=PushAPIEnabled,
+    ImplementationLacksVTable,
+    SecureContext,
+    Exposed=(Window,Worker),
+] interface PushSubscriptionOptions {
+    readonly attribute boolean userVisibleOnly;
+    [SameObject] readonly attribute ArrayBuffer? applicationServerKey;
+};

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


--- trunk/Source/WebCore/Modules/push-api/PushSubscriptionOptionsInit.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscriptionOptionsInit.h	2021-10-07 04:15:05 UTC (rev 283700)
@@ -0,0 +1,45 @@
+/*
+ * 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 <_javascript_Core/ArrayBuffer.h>
+#include <optional>
+#include <wtf/RefCounted.h>
+#include <wtf/Variant.h>
+
+namespace WebCore {
+
+struct PushSubscriptionOptionsInit {
+    using ApplicationServerKey = Variant<RefPtr<JSC::ArrayBufferView>, RefPtr<JSC::ArrayBuffer>, String>;
+    bool userVisibleOnly { false };
+    std::optional<ApplicationServerKey> applicationServerKey;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

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


--- trunk/Source/WebCore/Modules/push-api/PushSubscriptionOptionsInit.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscriptionOptionsInit.idl	2021-10-07 04:15:05 UTC (rev 283700)
@@ -0,0 +1,33 @@
+/*
+ * 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/#pushsubscriptionoptionsinit-dictionary
+
+[
+    Conditional=SERVICE_WORKER,
+] dictionary PushSubscriptionOptionsInit {
+    boolean userVisibleOnly = false;
+    (BufferSource or DOMString)? applicationServerKey = null;
+};

Modified: trunk/Source/WebCore/Sources.txt (283699 => 283700)


--- trunk/Source/WebCore/Sources.txt	2021-10-07 04:02:03 UTC (rev 283699)
+++ trunk/Source/WebCore/Sources.txt	2021-10-07 04:15:05 UTC (rev 283700)
@@ -222,6 +222,8 @@
 Modules/pictureinpicture/PictureInPictureWindow.cpp
 Modules/push-api/PushEvent.cpp
 Modules/push-api/PushMessageData.cpp
+Modules/push-api/PushSubscription.cpp
+Modules/push-api/PushSubscriptionOptions.cpp
 Modules/remoteplayback/RemotePlayback.cpp
 Modules/speech/SpeechRecognition.cpp
 Modules/speech/SpeechRecognitionAlternative.cpp
@@ -3360,9 +3362,14 @@
 JSPublicKeyCredentialDescriptor.cpp
 JSPublicKeyCredentialRequestOptions.cpp
 JSPublicKeyCredentialType.cpp
+JSPushEncryptionKeyName.cpp
 JSPushEvent.cpp
 JSPushEventInit.cpp
 JSPushMessageData.cpp
+JSPushSubscription.cpp
+JSPushSubscriptionJSON.cpp
+JSPushSubscriptionOptions.cpp
+JSPushSubscriptionOptionsInit.cpp
 JSRTCAnswerOptions.cpp
 JSRTCCertificate.cpp
 JSRTCConfiguration.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (283699 => 283700)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-10-07 04:02:03 UTC (rev 283699)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-10-07 04:15:05 UTC (rev 283700)
@@ -5368,6 +5368,11 @@
 		E7E0357224D4E196008DFEFB /* AnalyserOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = E7E0357124D4E191008DFEFB /* AnalyserOptions.h */; };
 		E7FBE7C224EB2FB000A18E62 /* StereoPannerNode.h in Headers */ = {isa = PBXBuildFile; fileRef = E7FBE7C124EB2FAB00A18E62 /* StereoPannerNode.h */; };
 		E7FBE7C324EB2FB600A18E62 /* StereoPannerOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = E7FBE7C024EB2FAB00A18E62 /* StereoPannerOptions.h */; };
+		EB0FB708270D0B1000F7810D /* PushEncryptionKeyName.h in Headers */ = {isa = PBXBuildFile; fileRef = EB0FB6FD270D0AE800F7810D /* PushEncryptionKeyName.h */; };
+		EB0FB709270D0B1800F7810D /* PushSubscription.h in Headers */ = {isa = PBXBuildFile; fileRef = EB0FB707270D0AEC00F7810D /* PushSubscription.h */; };
+		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 */; };
 		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 */; };
@@ -16748,6 +16753,18 @@
 		E7FBE7C524EC36F300A18E62 /* StereoPanner.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = StereoPanner.cpp; sourceTree = "<group>"; };
 		EB081CD81696084400553730 /* TypeConversions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TypeConversions.h; sourceTree = "<group>"; };
 		EB081CD91696084400553730 /* TypeConversions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = TypeConversions.idl; sourceTree = "<group>"; };
+		EB0FB6FB270D0AE600F7810D /* PushSubscriptionOptions.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PushSubscriptionOptions.cpp; sourceTree = "<group>"; };
+		EB0FB6FD270D0AE800F7810D /* PushEncryptionKeyName.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PushEncryptionKeyName.h; sourceTree = "<group>"; };
+		EB0FB6FE270D0AE900F7810D /* PushSubscriptionOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = PushSubscriptionOptions.idl; sourceTree = "<group>"; };
+		EB0FB6FF270D0AE900F7810D /* PushSubscriptionOptionsInit.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = PushSubscriptionOptionsInit.idl; sourceTree = "<group>"; };
+		EB0FB700270D0AEA00F7810D /* PushEncryptionKeyName.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = PushEncryptionKeyName.idl; sourceTree = "<group>"; };
+		EB0FB701270D0AEA00F7810D /* PushSubscriptionOptionsInit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PushSubscriptionOptionsInit.h; sourceTree = "<group>"; };
+		EB0FB702270D0AEA00F7810D /* PushSubscriptionJSON.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = PushSubscriptionJSON.idl; sourceTree = "<group>"; };
+		EB0FB703270D0AEB00F7810D /* PushSubscriptionJSON.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PushSubscriptionJSON.h; sourceTree = "<group>"; };
+		EB0FB704270D0AEB00F7810D /* PushSubscription.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PushSubscription.cpp; sourceTree = "<group>"; };
+		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>"; };
 		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>"; };
@@ -19894,6 +19911,8 @@
 		418FCBB82706E4BD00F96ECA /* push-api */ = {
 			isa = PBXGroup;
 			children = (
+				EB0FB6FD270D0AE800F7810D /* PushEncryptionKeyName.h */,
+				EB0FB700270D0AEA00F7810D /* PushEncryptionKeyName.idl */,
 				418FCBBB2706E4F600F96ECA /* PushEvent.cpp */,
 				418FCBBD2706E4F700F96ECA /* PushEvent.h */,
 				418FCBC02706E4F800F96ECA /* PushEvent.idl */,
@@ -19902,6 +19921,16 @@
 				418FCBBE2706E4F700F96ECA /* PushMessageData.cpp */,
 				418FCBBC2706E4F600F96ECA /* PushMessageData.h */,
 				418FCBBA2706E4F500F96ECA /* PushMessageData.idl */,
+				EB0FB704270D0AEB00F7810D /* PushSubscription.cpp */,
+				EB0FB707270D0AEC00F7810D /* PushSubscription.h */,
+				EB0FB705270D0AEB00F7810D /* PushSubscription.idl */,
+				EB0FB703270D0AEB00F7810D /* PushSubscriptionJSON.h */,
+				EB0FB702270D0AEA00F7810D /* PushSubscriptionJSON.idl */,
+				EB0FB6FB270D0AE600F7810D /* PushSubscriptionOptions.cpp */,
+				EB0FB706270D0AEC00F7810D /* PushSubscriptionOptions.h */,
+				EB0FB6FE270D0AE900F7810D /* PushSubscriptionOptions.idl */,
+				EB0FB701270D0AEA00F7810D /* PushSubscriptionOptionsInit.h */,
+				EB0FB6FF270D0AE900F7810D /* PushSubscriptionOptionsInit.idl */,
 				418FCBCB2706F3CD00F96ECA /* ServiceWorkerGlobalScope+PushAPI.idl */,
 				418FCBCD2706F43400F96ECA /* ServiceWorkerGlobalScopePushAPI.cpp */,
 				418FCBCC2706F43400F96ECA /* ServiceWorkerGlobalScopePushAPI.h */,
@@ -34696,9 +34725,14 @@
 				57303BEB20097F4000355965 /* PublicKeyCredentialType.h in Headers */,
 				0081FF0016B0A2D3008AAA7A /* PublicSuffix.h in Headers */,
 				10FB084B14E15C7E00A3DB98 /* PublicURLManager.h in Headers */,
+				EB0FB708270D0B1000F7810D /* PushEncryptionKeyName.h in Headers */,
 				418FCBC12706E4FB00F96ECA /* PushEvent.h in Headers */,
 				418FCBC22706E50100F96ECA /* PushEventInit.h in Headers */,
 				83D511F6250C1CBF002EDC51 /* PushPullFIFO.h in Headers */,
+				EB0FB709270D0B1800F7810D /* PushSubscription.h in Headers */,
+				EB0FB70A270D0B1B00F7810D /* PushSubscriptionJSON.h in Headers */,
+				EB0FB70C270D0B2900F7810D /* PushSubscriptionOptions.h in Headers */,
+				EB0FB70D270D0B2E00F7810D /* PushSubscriptionOptionsInit.h in Headers */,
 				550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */,
 				83C1F5941EDF69D300410D27 /* QualifiedNameCache.h in Headers */,
 				A15E31F41E0CB0B5004B371C /* QuickLook.h in Headers */,

Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (283699 => 283700)


--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2021-10-07 04:02:03 UTC (rev 283699)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2021-10-07 04:15:05 UTC (rev 283700)
@@ -210,6 +210,8 @@
     macro(PublicKeyCredential) \
     macro(PushEvent) \
     macro(PushMessageData) \
+    macro(PushSubscription) \
+    macro(PushSubscriptionOptions) \
     macro(ResizeObserver) \
     macro(ResizeObserverEntry) \
     macro(RTCCertificate) \

Modified: trunk/Source/WebCore/testing/Internals.cpp (283699 => 283700)


--- trunk/Source/WebCore/testing/Internals.cpp	2021-10-07 04:02:03 UTC (rev 283699)
+++ trunk/Source/WebCore/testing/Internals.cpp	2021-10-07 04:15:05 UTC (rev 283700)
@@ -161,6 +161,8 @@
 #include "PluginData.h"
 #include "PrintContext.h"
 #include "PseudoElement.h"
+#include "PushSubscription.h"
+#include "PushSubscriptionOptions.h"
 #include "RTCRtpSFrameTransform.h"
 #include "Range.h"
 #include "ReadableStream.h"
@@ -6536,5 +6538,16 @@
     m_textIterator = makeUnique<TextIterator>(range);
 }
 
+#if ENABLE(SERVICE_WORKER)
+RefPtr<PushSubscription> Internals::createPushSubscription(const String& endpoint, std::optional<DOMTimeStamp> expirationTime, bool userVisibleOnly, const ArrayBuffer& serverVAPIDPublicKey, const ArrayBuffer& clientECDHPublicKey, const ArrayBuffer& auth)
+{
+    auto myEndpoint = endpoint;
+    Vector<uint8_t> myServerVAPIDPublicKey { static_cast<const uint8_t*>(serverVAPIDPublicKey.data()), serverVAPIDPublicKey.byteLength() };
+    Vector<uint8_t> myClientECDHPublicKey { static_cast<const uint8_t*>(clientECDHPublicKey.data()), clientECDHPublicKey.byteLength() };
+    Vector<uint8_t> myAuth { static_cast<const uint8_t*>(auth.data()), auth.byteLength() };
 
+    return PushSubscription::create(WTFMove(myEndpoint), expirationTime, PushSubscriptionOptions::create(userVisibleOnly, WTFMove(myServerVAPIDPublicKey)), WTFMove(myClientECDHPublicKey), WTFMove(myAuth));
+}
+#endif
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/testing/Internals.h (283699 => 283700)


--- trunk/Source/WebCore/testing/Internals.h	2021-10-07 04:02:03 UTC (rev 283699)
+++ trunk/Source/WebCore/testing/Internals.h	2021-10-07 04:15:05 UTC (rev 283700)
@@ -29,6 +29,7 @@
 #include "CSSComputedStyleDeclaration.h"
 #include "ContextDestructionObserver.h"
 #include "Cookie.h"
+#include "DOMTimeStamp.h"
 #include "ExceptionOr.h"
 #include "HEVCUtilities.h"
 #include "IDLTypes.h"
@@ -143,6 +144,10 @@
 #endif
 #endif
 
+#if ENABLE(SERVICE_WORKER)
+class PushSubscription;
+#endif
+
 template<typename IDLType> class DOMPromiseDeferred;
 
 struct MockWebAuthenticationConfiguration;
@@ -1193,6 +1198,10 @@
 
     void retainTextIteratorForDocumentContent();
 
+#if ENABLE(SERVICE_WORKER)
+    RefPtr<PushSubscription> createPushSubscription(const String& endpoint, std::optional<DOMTimeStamp> expirationTime, bool userVisibleOnly, const ArrayBuffer& serverVAPIDPublicKey, const ArrayBuffer& clientECDHPublicKey, const ArrayBuffer& auth);
+#endif
+
 private:
     explicit Internals(Document&);
     Document* contextDocument() const;

Modified: trunk/Source/WebCore/testing/Internals.idl (283699 => 283700)


--- trunk/Source/WebCore/testing/Internals.idl	2021-10-07 04:02:03 UTC (rev 283699)
+++ trunk/Source/WebCore/testing/Internals.idl	2021-10-07 04:15:05 UTC (rev 283700)
@@ -1065,4 +1065,6 @@
     undefined setDocumentAutoplayPolicy(Document document, AutoplayPolicy policy);
 
     undefined retainTextIteratorForDocumentContent();
+
+    [Conditional=SERVICE_WORKER] PushSubscription createPushSubscription(USVString endpoint, DOMTimeStamp? expirationTime, boolean userVisibleOnly, ArrayBuffer serverVAPIDPublicKey, ArrayBuffer clientECDHPublicKey, ArrayBuffer auth);
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to