Diff
Modified: trunk/LayoutTests/ChangeLog (285563 => 285564)
--- trunk/LayoutTests/ChangeLog 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/LayoutTests/ChangeLog 2021-11-10 05:23:04 UTC (rev 285564)
@@ -1,3 +1,33 @@
+2021-11-09 Ben Nham <[email protected]>
+
+ Add support for PushSubscriptionChangeEvent
+ https://bugs.webkit.org/show_bug.cgi?id=232455
+
+ Reviewed by Youenn Fablet.
+
+ Added PushSubscriptionChangeEvent tests and made PushSubscription tests also run in the
+ service worker context.
+
+ * http/wpt/push-api/constants.js: Added.
+ (bytesFrom):
+ * http/wpt/push-api/pushManager.any.js:
+ * http/wpt/push-api/pushSubscription.https.any-expected.txt:
+ * http/wpt/push-api/pushSubscription.https.any.js:
+ (GLOBAL.isWorker):
+ (async promise_test):
+ (bytesFrom): Deleted.
+ (promise_test.async test): Deleted.
+ (promise_test): Deleted.
+ * http/wpt/push-api/pushSubscription.https.any.serviceworker-expected.txt: Added.
+ * http/wpt/push-api/pushSubscription.https.any.serviceworker.html: Added.
+ * http/wpt/push-api/pushSubscriptionChangeEvent.any.js: Added.
+ (test):
+ (promise_test.async newSubscription):
+ (promise_test.async return):
+ (promise_test):
+ * http/wpt/push-api/pushSubscriptionChangeEvent.any.serviceworker-expected.txt: Added.
+ * http/wpt/push-api/pushSubscriptionChangeEvent.any.serviceworker.html: Added.
+
2021-11-09 Jean-Yves Avenard <[email protected]>
Unreviewed test gardening, skip failing test.
Added: trunk/LayoutTests/http/wpt/push-api/constants.js (0 => 285564)
--- trunk/LayoutTests/http/wpt/push-api/constants.js (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/constants.js 2021-11-10 05:23:04 UTC (rev 285564)
@@ -0,0 +1,21 @@
+const ENDPOINT = 'https://www.webkit.org';
+const EXPIRATION_TIME = 1633000000;
+
+const CLIENT_BASE64_KEY_1 = 'BA1Hxzyi1RUM1b5wjxsn7nGxAszw2u61m164i3MrAIxHF6YK5h4SDYic-dRuU_RCPCfA5aq9ojSwk5Y2EmClBPs';
+const CLIENT_KEY_1 = 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 CLIENT_BASE64_KEY_2 = 'BCVxsr7N_eNgVRqvHtD0zTZsEc6-VV-JvLexhqUzORcxaOzi6-AYWXvTBHm4bjyPjs7Vd8pZGH6SRpkNtoIAiw4';
+const CLIENT_KEY_2 = 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 BASE64_AUTH = 'BTBZMqHH6r4Tts7J_aSIgg';
+const AUTH = new Uint8Array([5, 48, 89, 50, 161, 199, 234, 190, 19, 182, 206, 201, 253, 164, 136, 130]).buffer;
+
+const INVALID_SERVER_KEY = new Uint8Array(new Array(65).fill(4)).buffer;
+const INVALID_BASE64_SERVER_KEY = "BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ";
+
+const VALID_BASE64_SERVER_KEY = "BA1Hxzyi1RUM1b5wjxsn7nGxAszw2u61m164i3MrAIxHF6YK5h4SDYic-dRuU_RCPCfA5aq9ojSwk5Y2EmClBPs";
+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]).buffer;
+
+function bytesFrom(buf) {
+ return Array.from(new Uint8Array(buf));
+}
Modified: trunk/LayoutTests/http/wpt/push-api/pushManager.any.js (285563 => 285564)
--- trunk/LayoutTests/http/wpt/push-api/pushManager.any.js 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/LayoutTests/http/wpt/push-api/pushManager.any.js 2021-11-10 05:23:04 UTC (rev 285564)
@@ -1,12 +1,7 @@
// META: title=PushManager tests
// META: global=window,serviceworker
+// META: script=constants.js
-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;
Modified: trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any-expected.txt (285563 => 285564)
--- trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any-expected.txt 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any-expected.txt 2021-11-10 05:23:04 UTC (rev 285564)
@@ -1,5 +1,4 @@
-PASS wait for active service worker
PASS PushSubscription getters
-PASS unregister service worker
+PASS unsubscribing from subscription not associated with a registration
Modified: trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.js (285563 => 285564)
--- trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.js 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.js 2021-11-10 05:23:04 UTC (rev 285564)
@@ -1,64 +1,44 @@
// META: title=PushSubscription tests
-// META: global=window
+// META: global=window,serviceworker
+// META: script=constants.js
-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';
+let subscription = null;
-function bytesFrom(buf) {
- return Array.from(new Uint8Array(buf));
+if (GLOBAL.isWorker()) {
+ let activatePromise = new Promise(resolve => self._onactivate_ = resolve);
+ promise_test(async () => {
+ return activatePromise;
+ }, "wait for active service worker");
}
-let registration = null;
-
-promise_test(async (test) => {
- registration = await navigator.serviceWorker.getRegistration();
- if (registration) {
- await serviceWorkerRegistration.unregister();
- }
- registration = await navigator.serviceWorker.register("emptyWorker.js");
- assert_true(!registration.active, "service worker should be installing");
-
- 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");
-
promise_test(() => {
- assert_true(!!window.internals, "test requires internals");
+ assert_true(!!self.internals, "test requires internals");
- let subscription = window.internals.createPushSubscription(registration, endpoint, expirationTime, key1Buffer, key2Buffer, authBuffer);
+ subscription = self.internals.createPushSubscription(ENDPOINT, EXPIRATION_TIME, VALID_SERVER_KEY, CLIENT_KEY_1, AUTH);
assert_true(subscription instanceof PushSubscription);
- assert_equals(subscription.endpoint, endpoint);
- assert_equals(subscription.expirationTime, expirationTime);
+ assert_equals(subscription.endpoint, ENDPOINT);
+ assert_equals(subscription.expirationTime, EXPIRATION_TIME);
assert_true(subscription.options === subscription.options, "options should always return same object");
assert_equals(subscription.options.userVisibleOnly, true);
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));
+ assert_array_equals(bytesFrom(subscription.options.applicationServerKey), bytesFrom(VALID_SERVER_KEY));
+ assert_array_equals(bytesFrom(subscription.getKey('p256dh')), bytesFrom(CLIENT_KEY_1));
+ assert_array_equals(bytesFrom(subscription.getKey('auth')), bytesFrom(AUTH));
obj = subscription.toJSON();
assert_equals(Object.keys(obj).length, 3);
- assert_equals(obj.endpoint, endpoint);
- assert_equals(obj.expirationTime, expirationTime);
+ assert_equals(obj.endpoint, ENDPOINT);
+ assert_equals(obj.expirationTime, EXPIRATION_TIME);
assert_equals(Object.keys(obj.keys).length, 2);
- assert_equals(obj.keys.p256dh, key2Base64URL);
- assert_equals(obj.keys.auth, authBase64URL);
+ assert_equals(obj.keys.p256dh, CLIENT_BASE64_KEY_1);
+ assert_equals(obj.keys.auth, BASE64_AUTH);
return new Promise(resolve => resolve());
}, "PushSubscription getters");
-promise_test((test) => registration.unregister(), "unregister service worker");
+promise_test(async () => {
+ let result = await subscription.unsubscribe();
+ assert_false(result, "subscription that is not associated with a service worker registration should already be unsubscribed");
+ return new Promise(resolve => resolve());
+}, "unsubscribing from subscription not associated with a registration");
Added: trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.serviceworker-expected.txt (0 => 285564)
--- trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.serviceworker-expected.txt (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.serviceworker-expected.txt 2021-11-10 05:23:04 UTC (rev 285564)
@@ -0,0 +1,5 @@
+
+PASS wait for active service worker
+PASS PushSubscription getters
+PASS unsubscribing from subscription not associated with a registration
+
Added: trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.serviceworker.html (0 => 285564)
--- trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.serviceworker.html (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/pushSubscription.https.any.serviceworker.html 2021-11-10 05:23:04 UTC (rev 285564)
@@ -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/pushSubscriptionChangeEvent.any.js (0 => 285564)
--- trunk/LayoutTests/http/wpt/push-api/pushSubscriptionChangeEvent.any.js (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/pushSubscriptionChangeEvent.any.js 2021-11-10 05:23:04 UTC (rev 285564)
@@ -0,0 +1,51 @@
+// META: title=PushEvent tests
+// META: global=serviceworker
+// META: script=constants.js
+
+test(() => {
+ let event = new PushSubscriptionChangeEvent("pushsubscriptionchange");
+ assert_equals(event.newSubscription, null, "new");
+ assert_equals(event.oldSubscription, null, "old");
+}, "PushSubscriptionChangeEvent without data");
+
+test(() => {
+ let event = new PushSubscriptionChangeEvent("pushsubscriptionchange", { newSubscription: null, oldSubscription: null });
+ assert_equals(event.newSubscription, null, "new");
+ assert_equals(event.oldSubscription, null, "old");
+}, "PushSubscriptionChangeEvent without subscriptions");
+
+let newSubscription = null;
+let oldSubscription = null;
+
+let activatePromise = new Promise(resolve => self._onactivate_ = resolve);
+promise_test(async () => {
+ return activatePromise;
+}, "wait for active service worker");
+
+promise_test(async() => {
+ newSubscription = self.internals.createPushSubscription(ENDPOINT, EXPIRATION_TIME, VALID_SERVER_KEY, CLIENT_KEY_1, AUTH);
+ oldSubscription = self.internals.createPushSubscription(ENDPOINT, EXPIRATION_TIME, VALID_SERVER_KEY, CLIENT_KEY_2, AUTH);
+
+ assert_true(newSubscription instanceof PushSubscription);
+ assert_true(oldSubscription instanceof PushSubscription);
+
+ return new Promise(resolve => resolve());
+}, "create subscriptions");
+
+test(() => {
+ let event = new PushSubscriptionChangeEvent("pushsubscriptionchange", { newSubscription });
+ assert_equals(event.newSubscription, newSubscription, "new");
+ assert_equals(event.oldSubscription, null, "old");
+}, "PushSubscriptionChangeEvent with new subscription");
+
+test(() => {
+ let event = new PushSubscriptionChangeEvent("pushsubscriptionchange", { oldSubscription });
+ assert_equals(event.newSubscription, null, "new");
+ assert_equals(event.oldSubscription, oldSubscription, "old");
+}, "PushSubscriptionChangeEvent with old subscription");
+
+test(() => {
+ let event = new PushSubscriptionChangeEvent("pushsubscriptionchange", { newSubscription, oldSubscription });
+ assert_equals(event.newSubscription, newSubscription, "new");
+ assert_equals(event.oldSubscription, oldSubscription, "old");
+}, "PushSubscriptionChangeEvent with new and old subscription");
Added: trunk/LayoutTests/http/wpt/push-api/pushSubscriptionChangeEvent.any.serviceworker-expected.txt (0 => 285564)
--- trunk/LayoutTests/http/wpt/push-api/pushSubscriptionChangeEvent.any.serviceworker-expected.txt (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/pushSubscriptionChangeEvent.any.serviceworker-expected.txt 2021-11-10 05:23:04 UTC (rev 285564)
@@ -0,0 +1,9 @@
+
+PASS PushSubscriptionChangeEvent without data
+PASS PushSubscriptionChangeEvent without subscriptions
+PASS wait for active service worker
+PASS create subscriptions
+PASS PushSubscriptionChangeEvent with new subscription
+PASS PushSubscriptionChangeEvent with old subscription
+PASS PushSubscriptionChangeEvent with new and old subscription
+
Added: trunk/LayoutTests/http/wpt/push-api/pushSubscriptionChangeEvent.any.serviceworker.html (0 => 285564)
--- trunk/LayoutTests/http/wpt/push-api/pushSubscriptionChangeEvent.any.serviceworker.html (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/pushSubscriptionChangeEvent.any.serviceworker.html 2021-11-10 05:23:04 UTC (rev 285564)
@@ -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 (285563 => 285564)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-11-10 05:23:04 UTC (rev 285564)
@@ -1,3 +1,14 @@
+2021-11-09 Ben Nham <[email protected]>
+
+ Add support for PushSubscriptionChangeEvent
+ https://bugs.webkit.org/show_bug.cgi?id=232455
+
+ Reviewed by Youenn Fablet.
+
+ Rebaseline WPT tests that are now passing.
+
+ * web-platform-tests/push-api/idlharness.https.any.serviceworker-expected.txt:
+
2021-11-09 Chris Dumez <[email protected]>
BroadcastChannel is still disabled in service workers
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any.serviceworker-expected.txt (285563 => 285564)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any.serviceworker-expected.txt 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any.serviceworker-expected.txt 2021-11-10 05:23:04 UTC (rev 285564)
@@ -65,18 +65,18 @@
PASS PushEvent must be primary interface of new PushEvent("type")
PASS Stringification of new PushEvent("type")
PASS PushEvent interface: new PushEvent("type") must inherit property "data" with the proper type
-FAIL PushSubscriptionChangeEvent interface: existence and properties of interface object assert_own_property: self does not have own property "PushSubscriptionChangeEvent" expected property "PushSubscriptionChangeEvent" missing
-FAIL PushSubscriptionChangeEvent interface object length assert_own_property: self does not have own property "PushSubscriptionChangeEvent" expected property "PushSubscriptionChangeEvent" missing
-FAIL PushSubscriptionChangeEvent interface object name assert_own_property: self does not have own property "PushSubscriptionChangeEvent" expected property "PushSubscriptionChangeEvent" missing
-FAIL PushSubscriptionChangeEvent interface: existence and properties of interface prototype object assert_own_property: self does not have own property "PushSubscriptionChangeEvent" expected property "PushSubscriptionChangeEvent" missing
-FAIL PushSubscriptionChangeEvent interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "PushSubscriptionChangeEvent" expected property "PushSubscriptionChangeEvent" missing
-FAIL PushSubscriptionChangeEvent interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "PushSubscriptionChangeEvent" expected property "PushSubscriptionChangeEvent" missing
-FAIL PushSubscriptionChangeEvent interface: attribute newSubscription assert_own_property: self does not have own property "PushSubscriptionChangeEvent" expected property "PushSubscriptionChangeEvent" missing
-FAIL PushSubscriptionChangeEvent interface: attribute oldSubscription assert_own_property: self does not have own property "PushSubscriptionChangeEvent" expected property "PushSubscriptionChangeEvent" missing
-FAIL PushSubscriptionChangeEvent must be primary interface of new PushSubscriptionChangeEvent("pushsubscriptionchange") assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: PushSubscriptionChangeEvent"
-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"
+PASS PushSubscriptionChangeEvent interface: existence and properties of interface object
+PASS PushSubscriptionChangeEvent interface object length
+PASS PushSubscriptionChangeEvent interface object name
+PASS PushSubscriptionChangeEvent interface: existence and properties of interface prototype object
+PASS PushSubscriptionChangeEvent interface: existence and properties of interface prototype object's "constructor" property
+PASS PushSubscriptionChangeEvent interface: existence and properties of interface prototype object's @@unscopables property
+PASS PushSubscriptionChangeEvent interface: attribute newSubscription
+PASS PushSubscriptionChangeEvent interface: attribute oldSubscription
+PASS PushSubscriptionChangeEvent must be primary interface of new PushSubscriptionChangeEvent("pushsubscriptionchange")
+PASS Stringification of new PushSubscriptionChangeEvent("pushsubscriptionchange")
+PASS PushSubscriptionChangeEvent interface: new PushSubscriptionChangeEvent("pushsubscriptionchange") must inherit property "newSubscription" with the proper type
+PASS PushSubscriptionChangeEvent interface: new PushSubscriptionChangeEvent("pushsubscriptionchange") must inherit property "oldSubscription" with the proper type
PASS ServiceWorkerRegistration interface: attribute pushManager
PASS ServiceWorkerRegistration interface: registration must inherit property "pushManager" with the proper type
PASS ServiceWorkerGlobalScope interface: attribute onpush
Modified: trunk/Source/WebCore/CMakeLists.txt (285563 => 285564)
--- trunk/Source/WebCore/CMakeLists.txt 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/CMakeLists.txt 2021-11-10 05:23:04 UTC (rev 285564)
@@ -509,6 +509,8 @@
Modules/push-api/PushMessageData.idl
Modules/push-api/PushPermissionState.idl
Modules/push-api/PushSubscription.idl
+ Modules/push-api/PushSubscriptionChangeEvent.idl
+ Modules/push-api/PushSubscriptionChangeEventInit.idl
Modules/push-api/PushSubscriptionJSON.idl
Modules/push-api/PushSubscriptionOptions.idl
Modules/push-api/PushSubscriptionOptionsInit.idl
Modified: trunk/Source/WebCore/ChangeLog (285563 => 285564)
--- trunk/Source/WebCore/ChangeLog 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/ChangeLog 2021-11-10 05:23:04 UTC (rev 285564)
@@ -1,3 +1,63 @@
+2021-11-09 Ben Nham <[email protected]>
+
+ Add support for PushSubscriptionChangeEvent
+ https://bugs.webkit.org/show_bug.cgi?id=232455
+
+ Reviewed by Youenn Fablet.
+
+ This adds support for the PushSubscriptionChangeEvent object. I plan to add support for the
+ onpushsubscriptionchange event handler in a later patch.
+
+ While working on this, it seemed reasonable to be able to create PushSubscriptions that
+ point to a null ServiceWorkerRegistration. This is for subscriptions that are returned via
+ the oldSubscription property and are therefore already unsubscribed.
+
+ I added a new constructor for creating a PushSubscription pointing to a null
+ ServiceWorkerRegistration, rather than changing the existing constructor to just take a
+ RefPtr<ServiceWorkerRegistration>. This is because I wanted to remove the WEBCORE_EXPORT
+ from ServiceWorkerRegistration, and the inline code generated by creating a null
+ RefPtr<ServiceWorkerRegistration> in the internals dylib caused it to require
+ ServiceWorkerRegistration::ref/deref to be exported.
+
+ Tests: http/wpt/push-api/pushSubscriptionChangeEvent.any.serviceworker.html
+
+ * CMakeLists.txt:
+ * DerivedSources-input.xcfilelist:
+ * DerivedSources-output.xcfilelist:
+ * DerivedSources.make:
+ * Modules/push-api/PushManager.cpp:
+ (WebCore::PushManager::subscribe):
+ (WebCore::PushManager::getSubscription):
+ (WebCore::PushManager::permissionState):
+ * Modules/push-api/PushManager.h:
+ * Modules/push-api/PushManager.idl:
+ * Modules/push-api/PushSubscription.cpp:
+ (WebCore::PushSubscription::PushSubscription):
+ (WebCore::PushSubscription::unsubscribe):
+ * Modules/push-api/PushSubscription.h:
+ * Modules/push-api/PushSubscription.idl:
+ * Modules/push-api/PushSubscriptionChangeEvent.cpp: Copied from Source/WebCore/Modules/push-api/PushManager.h.
+ (WebCore::PushSubscriptionChangeEvent::create):
+ (WebCore::PushSubscriptionChangeEvent::PushSubscriptionChangeEvent):
+ * Modules/push-api/PushSubscriptionChangeEvent.h: Copied from Source/WebCore/Modules/push-api/PushManager.h.
+ * Modules/push-api/PushSubscriptionChangeEvent.idl: Copied from Source/WebCore/Modules/push-api/PushSubscription.idl.
+ * Modules/push-api/PushSubscriptionChangeEventInit.h: Copied from Source/WebCore/Modules/push-api/PushSubscription.idl.
+ * Modules/push-api/PushSubscriptionChangeEventInit.idl: Copied from Source/WebCore/Modules/push-api/PushSubscription.idl.
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/WebCoreBuiltinNames.h:
+ * dom/EventNames.in:
+ * testing/Internals.cpp:
+ (WebCore::Internals::createPushSubscription):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+ * testing/ServiceWorkerInternals.cpp:
+ (WebCore::ServiceWorkerInternals::createPushSubscription):
+ * testing/ServiceWorkerInternals.h:
+ * testing/ServiceWorkerInternals.idl:
+ * workers/service/ServiceWorkerRegistration.h:
+ * workers/service/ServiceWorkerRegistration.idl:
+
2021-11-09 Myles C. Maxfield <[email protected]>
[Cocoa] Migrate from CTFontCopyVariationAxes() to CTFontCopyVariationAxesInternal() if possible
Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (285563 => 285564)
--- trunk/Source/WebCore/DerivedSources-input.xcfilelist 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist 2021-11-10 05:23:04 UTC (rev 285564)
@@ -566,6 +566,8 @@
$(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/PushSubscriptionChangeEvent.idl
+$(PROJECT_DIR)/Modules/push-api/PushSubscriptionChangeEventInit.idl
$(PROJECT_DIR)/Modules/push-api/PushSubscriptionJSON.idl
$(PROJECT_DIR)/Modules/push-api/PushSubscriptionOptions.idl
$(PROJECT_DIR)/Modules/push-api/PushSubscriptionOptionsInit.idl
Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (285563 => 285564)
--- trunk/Source/WebCore/DerivedSources-output.xcfilelist 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist 2021-11-10 05:23:04 UTC (rev 285564)
@@ -1899,6 +1899,10 @@
$(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/JSPushSubscriptionChangeEvent.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushSubscriptionChangeEvent.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushSubscriptionChangeEventInit.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushSubscriptionChangeEventInit.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushSubscriptionJSON.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushSubscriptionJSON.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPushSubscriptionOptions.cpp
Modified: trunk/Source/WebCore/DerivedSources.make (285563 => 285564)
--- trunk/Source/WebCore/DerivedSources.make 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/DerivedSources.make 2021-11-10 05:23:04 UTC (rev 285564)
@@ -495,6 +495,8 @@
$(WebCore)/Modules/push-api/PushMessageData.idl \
$(WebCore)/Modules/push-api/PushPermissionState.idl \
$(WebCore)/Modules/push-api/PushSubscription.idl \
+ $(WebCore)/Modules/push-api/PushSubscriptionChangeEvent.idl \
+ $(WebCore)/Modules/push-api/PushSubscriptionChangeEventInit.idl \
$(WebCore)/Modules/push-api/PushSubscriptionJSON.idl \
$(WebCore)/Modules/push-api/PushSubscriptionOptions.idl \
$(WebCore)/Modules/push-api/PushSubscriptionOptionsInit.idl \
Modified: trunk/Source/WebCore/Modules/push-api/PushManager.cpp (285563 => 285564)
--- trunk/Source/WebCore/Modules/push-api/PushManager.cpp 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/Modules/push-api/PushManager.cpp 2021-11-10 05:23:04 UTC (rev 285564)
@@ -29,6 +29,7 @@
#if ENABLE(SERVICE_WORKER)
#include "CryptoKeyEC.h"
+#include "EventLoop.h"
#include "Exception.h"
#include "JSPushPermissionState.h"
#include "JSPushSubscription.h"
@@ -68,66 +69,72 @@
{
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;
- }
-
+ scriptExecutionContext.eventLoop().queueTask(TaskSource::Networking, [this, protectedThis = Ref { *this }, options = WTFMove(options), promise = WTFMove(promise)]() mutable {
+ 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.returnValue();
- auto key = CryptoKeyEC::importRaw(CryptoAlgorithmIdentifier::ECDSA, "P-256"_s, WTFMove(keyData), false, CryptoKeyUsageVerify);
+ auto keyData = keyDataResult.returnValue();
+ auto key = CryptoKeyEC::importRaw(CryptoAlgorithmIdentifier::ECDSA, "P-256"_s, WTFMove(keyData), false, CryptoKeyUsageVerify);
#else
- auto key = nullptr;
+ 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;
- }
-
- m_serviceWorkerRegistration.subscribeToPushService(keyDataResult.releaseReturnValue(), WTFMove(promise));
+ 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;
+ }
+
+ m_serviceWorkerRegistration.subscribeToPushService(keyDataResult.releaseReturnValue(), WTFMove(promise));
+ });
}
-void PushManager::getSubscription(DOMPromiseDeferred<IDLNullable<IDLInterface<PushSubscription>>>&& promise)
+void PushManager::getSubscription(ScriptExecutionContext& scriptExecutionContext, DOMPromiseDeferred<IDLNullable<IDLInterface<PushSubscription>>>&& promise)
{
- m_serviceWorkerRegistration.getPushSubscription(WTFMove(promise));
+ scriptExecutionContext.eventLoop().queueTask(TaskSource::Networking, [this, protectedThis = Ref { *this }, promise = WTFMove(promise)]() mutable {
+ m_serviceWorkerRegistration.getPushSubscription(WTFMove(promise));
+ });
}
-void PushManager::permissionState(std::optional<PushSubscriptionOptionsInit>&& options, DOMPromiseDeferred<IDLEnumeration<PushPermissionState>>&& promise)
+void PushManager::permissionState(ScriptExecutionContext& scriptExecutionContext, std::optional<PushSubscriptionOptionsInit>&& options, DOMPromiseDeferred<IDLEnumeration<PushPermissionState>>&& promise)
{
UNUSED_PARAM(options);
- m_serviceWorkerRegistration.getPushPermissionState(WTFMove(promise));
+ scriptExecutionContext.eventLoop().queueTask(TaskSource::Networking, [this, protectedThis = Ref { *this }, promise = WTFMove(promise)]() mutable {
+ m_serviceWorkerRegistration.getPushPermissionState(WTFMove(promise));
+ });
}
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/push-api/PushManager.h (285563 => 285564)
--- trunk/Source/WebCore/Modules/push-api/PushManager.h 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/Modules/push-api/PushManager.h 2021-11-10 05:23:04 UTC (rev 285564)
@@ -52,8 +52,8 @@
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>>&&);
+ void getSubscription(ScriptExecutionContext&, DOMPromiseDeferred<IDLNullable<IDLInterface<PushSubscription>>>&&);
+ void permissionState(ScriptExecutionContext&, std::optional<PushSubscriptionOptionsInit>&&, DOMPromiseDeferred<IDLEnumeration<PushPermissionState>>&&);
private:
ServiceWorkerRegistration& m_serviceWorkerRegistration;
Modified: trunk/Source/WebCore/Modules/push-api/PushManager.idl (285563 => 285564)
--- trunk/Source/WebCore/Modules/push-api/PushManager.idl 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/Modules/push-api/PushManager.idl 2021-11-10 05:23:04 UTC (rev 285564)
@@ -35,6 +35,6 @@
[SameObject] static readonly attribute FrozenArray<DOMString> supportedContentEncodings;
[CallWith=ScriptExecutionContext] Promise<PushSubscription> subscribe(optional PushSubscriptionOptionsInit options);
- Promise<PushSubscription?> getSubscription();
- Promise<PushPermissionState> permissionState(optional PushSubscriptionOptionsInit options);
+ [CallWith=ScriptExecutionContext] Promise<PushSubscription?> getSubscription();
+ [CallWith=ScriptExecutionContext] Promise<PushPermissionState> permissionState(optional PushSubscriptionOptionsInit options);
};
Modified: trunk/Source/WebCore/Modules/push-api/PushSubscription.cpp (285563 => 285564)
--- trunk/Source/WebCore/Modules/push-api/PushSubscription.cpp 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscription.cpp 2021-11-10 05:23:04 UTC (rev 285564)
@@ -28,8 +28,10 @@
#if ENABLE(SERVICE_WORKER)
+#include "EventLoop.h"
#include "Exception.h"
#include "PushSubscriptionOptions.h"
+#include "ScriptExecutionContext.h"
#include "ServiceWorkerContainer.h"
#include <wtf/IsoMallocInlines.h>
#include <wtf/text/Base64.h>
@@ -38,6 +40,15 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(PushSubscription);
+PushSubscription::PushSubscription(String&& endpoint, std::optional<EpochTimeStamp> expirationTime, Vector<uint8_t>&& serverVAPIDPublicKey, Vector<uint8_t>&& clientECDHPublicKey, Vector<uint8_t>&& sharedAuthenticationSecret)
+ : m_endpoint(WTFMove(endpoint))
+ , m_expirationTime(expirationTime)
+ , m_options(PushSubscriptionOptions::create(WTFMove(serverVAPIDPublicKey)))
+ , m_clientECDHPublicKey(WTFMove(clientECDHPublicKey))
+ , m_sharedAuthenticationSecret(WTFMove(sharedAuthenticationSecret))
+{
+}
+
PushSubscription::PushSubscription(Ref<ServiceWorkerRegistration>&& registration, String&& endpoint, std::optional<EpochTimeStamp> expirationTime, Vector<uint8_t>&& serverVAPIDPublicKey, Vector<uint8_t>&& clientECDHPublicKey, Vector<uint8_t>&& sharedAuthenticationSecret)
: m_serviceWorkerRegistration(WTFMove(registration))
, m_endpoint(WTFMove(endpoint))
@@ -86,9 +97,16 @@
return buffer;
}
-void PushSubscription::unsubscribe(DOMPromiseDeferred<IDLBoolean>&& promise)
+void PushSubscription::unsubscribe(ScriptExecutionContext& scriptExecutionContext, DOMPromiseDeferred<IDLBoolean>&& promise)
{
- m_serviceWorkerRegistration->unsubscribeFromPushService(WTFMove(promise));
+ scriptExecutionContext.eventLoop().queueTask(TaskSource::Networking, [this, protectedThis = Ref { *this }, promise = WTFMove(promise)]() mutable {
+ if (!m_serviceWorkerRegistration) {
+ promise.resolve(false);
+ return;
+ }
+
+ m_serviceWorkerRegistration->unsubscribeFromPushService(WTFMove(promise));
+ });
}
PushSubscriptionJSON PushSubscription::toJSON() const
Modified: trunk/Source/WebCore/Modules/push-api/PushSubscription.h (285563 => 285564)
--- trunk/Source/WebCore/Modules/push-api/PushSubscription.h 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscription.h 2021-11-10 05:23:04 UTC (rev 285564)
@@ -41,6 +41,7 @@
namespace WebCore {
class PushSubscriptionOptions;
+class ScriptExecutionContext;
class ServiceWorkerContainer;
class ServiceWorkerRegistration;
@@ -54,14 +55,15 @@
std::optional<EpochTimeStamp> expirationTime() const;
PushSubscriptionOptions& options() const;
ExceptionOr<RefPtr<JSC::ArrayBuffer>> getKey(PushEncryptionKeyName) const;
- void unsubscribe(DOMPromiseDeferred<IDLBoolean>&&);
+ void unsubscribe(ScriptExecutionContext&, DOMPromiseDeferred<IDLBoolean>&&);
PushSubscriptionJSON toJSON() const;
private:
- WEBCORE_EXPORT PushSubscription(Ref<ServiceWorkerRegistration>&&, String&& endpoint, std::optional<EpochTimeStamp> expirationTime, Vector<uint8_t>&& serverVAPIDPublicKey, Vector<uint8_t>&& clientECDHPublicKey, Vector<uint8_t>&& auth);
+ WEBCORE_EXPORT PushSubscription(String&& endpoint, std::optional<EpochTimeStamp> expirationTime, Vector<uint8_t>&& serverVAPIDPublicKey, Vector<uint8_t>&& clientECDHPublicKey, Vector<uint8_t>&& auth);
+ PushSubscription(Ref<ServiceWorkerRegistration>&&, String&& endpoint, std::optional<EpochTimeStamp> expirationTime, Vector<uint8_t>&& serverVAPIDPublicKey, Vector<uint8_t>&& clientECDHPublicKey, Vector<uint8_t>&& auth);
- Ref<ServiceWorkerRegistration> m_serviceWorkerRegistration;
+ RefPtr<ServiceWorkerRegistration> m_serviceWorkerRegistration;
String m_endpoint;
std::optional<EpochTimeStamp> m_expirationTime;
Ref<PushSubscriptionOptions> m_options;
Modified: trunk/Source/WebCore/Modules/push-api/PushSubscription.idl (285563 => 285564)
--- trunk/Source/WebCore/Modules/push-api/PushSubscription.idl 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscription.idl 2021-11-10 05:23:04 UTC (rev 285564)
@@ -37,7 +37,7 @@
readonly attribute EpochTimeStamp? expirationTime;
[SameObject] readonly attribute PushSubscriptionOptions options;
ArrayBuffer? getKey(PushEncryptionKeyName name);
- Promise<boolean> unsubscribe();
+ [CallWith=ScriptExecutionContext] Promise<boolean> unsubscribe();
PushSubscriptionJSON toJSON();
};
Copied: trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEvent.cpp (from rev 285563, trunk/Source/WebCore/Modules/push-api/PushManager.h) (0 => 285564)
--- trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEvent.cpp (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEvent.cpp 2021-11-10 05:23:04 UTC (rev 285564)
@@ -0,0 +1,61 @@
+/*
+ * 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 "PushSubscriptionChangeEvent.h"
+
+#if ENABLE(SERVICE_WORKER)
+
+#include "PushSubscription.h"
+#include <wtf/IsoMallocInlines.h>
+
+namespace WebCore {
+
+WTF_MAKE_ISO_ALLOCATED_IMPL(PushSubscriptionChangeEvent);
+
+Ref<PushSubscriptionChangeEvent> PushSubscriptionChangeEvent::create(const AtomString& type, PushSubscriptionChangeEventInit&& initializer, IsTrusted isTrusted)
+{
+ auto newSubscription = initializer.newSubscription;
+ auto oldSubscription = initializer.oldSubscription;
+ return create(type, WTFMove(initializer), WTFMove(newSubscription), WTFMove(oldSubscription), isTrusted);
+}
+
+Ref<PushSubscriptionChangeEvent> PushSubscriptionChangeEvent::create(const AtomString& type, ExtendableEventInit&& initializer, RefPtr<PushSubscription>&& newSubscription, RefPtr<PushSubscription>&& oldSubscription, IsTrusted isTrusted)
+{
+ return adoptRef(*new PushSubscriptionChangeEvent(type, WTFMove(initializer), WTFMove(newSubscription), WTFMove(oldSubscription), isTrusted));
+}
+
+PushSubscriptionChangeEvent::PushSubscriptionChangeEvent(const AtomString& type, ExtendableEventInit&& eventInit, RefPtr<PushSubscription>&& newSubscription, RefPtr<PushSubscription>&& oldSubscription, IsTrusted isTrusted)
+ : ExtendableEvent(type, WTFMove(eventInit), isTrusted)
+ , m_newSubscription(WTFMove(newSubscription))
+ , m_oldSubscription(WTFMove(oldSubscription))
+{
+}
+
+PushSubscriptionChangeEvent::~PushSubscriptionChangeEvent() = default;
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)
Copied: trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEvent.h (from rev 285563, trunk/Source/WebCore/Modules/push-api/PushManager.h) (0 => 285564)
--- trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEvent.h (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEvent.h 2021-11-10 05:23:04 UTC (rev 285564)
@@ -0,0 +1,55 @@
+/*
+ * 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 "ExtendableEvent.h"
+#include "PushSubscriptionChangeEventInit.h"
+
+namespace WebCore {
+
+class PushSubscriptionChangeEvent final : public ExtendableEvent {
+ WTF_MAKE_ISO_ALLOCATED(PushSubscriptionChangeEvent);
+public:
+ static Ref<PushSubscriptionChangeEvent> create(const AtomString&, PushSubscriptionChangeEventInit&&, IsTrusted = IsTrusted::No);
+ static Ref<PushSubscriptionChangeEvent> create(const AtomString&, ExtendableEventInit&&, RefPtr<PushSubscription>&& newSubscription, RefPtr<PushSubscription>&& oldSubscription, IsTrusted);
+ ~PushSubscriptionChangeEvent();
+
+ EventInterface eventInterface() const final { return PushSubscriptionChangeEventInterfaceType; }
+ PushSubscription* newSubscription() { return m_newSubscription.get(); }
+ PushSubscription* oldSubscription() { return m_oldSubscription.get(); }
+
+private:
+ PushSubscriptionChangeEvent(const AtomString&, ExtendableEventInit&&, RefPtr<PushSubscription>&& newSubscription, RefPtr<PushSubscription>&& oldSubscription, IsTrusted);
+
+ RefPtr<PushSubscription> m_newSubscription;
+ RefPtr<PushSubscription> m_oldSubscription;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)
Copied: trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEvent.idl (from rev 285563, trunk/Source/WebCore/Modules/push-api/PushSubscription.idl) (0 => 285564)
--- trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEvent.idl (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEvent.idl 2021-11-10 05:23:04 UTC (rev 285564)
@@ -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.
+ */
+
+[
+ Conditional=SERVICE_WORKER,
+ EnabledAtRuntime=PushAPIEnabled,
+ ExportMacro=WEBCORE_EXPORT,
+ Exposed=ServiceWorker,
+ JSGenerateToNativeObject,
+ SecureContext
+] interface PushSubscriptionChangeEvent : ExtendableEvent {
+ constructor(DOMString type, optional PushSubscriptionChangeEventInit eventInitDict);
+ readonly attribute PushSubscription? newSubscription;
+ readonly attribute PushSubscription? oldSubscription;
+};
Copied: trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEventInit.h (from rev 285563, trunk/Source/WebCore/Modules/push-api/PushSubscription.idl) (0 => 285564)
--- trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEventInit.h (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEventInit.h 2021-11-10 05:23:04 UTC (rev 285564)
@@ -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.
+ */
+
+#pragma once
+
+#if ENABLE(SERVICE_WORKER)
+
+#include "ExtendableEventInit.h"
+
+namespace WebCore {
+
+class PushSubscription;
+
+struct PushSubscriptionChangeEventInit : ExtendableEventInit {
+ RefPtr<PushSubscription> newSubscription;
+ RefPtr<PushSubscription> oldSubscription;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)
Copied: trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEventInit.idl (from rev 285563, trunk/Source/WebCore/Modules/push-api/PushSubscription.idl) (0 => 285564)
--- trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEventInit.idl (rev 0)
+++ trunk/Source/WebCore/Modules/push-api/PushSubscriptionChangeEventInit.idl 2021-11-10 05:23:04 UTC (rev 285564)
@@ -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.
+ */
+
+typedef (BufferSource or USVString) PushMessageDataInit;
+
+[
+ Conditional=SERVICE_WORKER
+] dictionary PushSubscriptionChangeEventInit : ExtendableEventInit {
+ PushSubscription? newSubscription;
+ PushSubscription? oldSubscription;
+};
Modified: trunk/Source/WebCore/Sources.txt (285563 => 285564)
--- trunk/Source/WebCore/Sources.txt 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/Sources.txt 2021-11-10 05:23:04 UTC (rev 285564)
@@ -254,6 +254,7 @@
Modules/push-api/PushEvent.cpp
Modules/push-api/PushMessageData.cpp
Modules/push-api/PushSubscription.cpp
+Modules/push-api/PushSubscriptionChangeEvent.cpp
Modules/push-api/PushSubscriptionData.cpp
Modules/push-api/PushSubscriptionOptions.cpp
Modules/push-api/PushManager.cpp
@@ -3548,6 +3549,8 @@
JSPushMessageData.cpp
JSPushPermissionState.cpp
JSPushSubscription.cpp
+JSPushSubscriptionChangeEvent.cpp
+JSPushSubscriptionChangeEventInit.cpp
JSPushSubscriptionJSON.cpp
JSPushSubscriptionOptions.cpp
JSPushSubscriptionOptionsInit.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (285563 => 285564)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-11-10 05:23:04 UTC (rev 285564)
@@ -5398,6 +5398,8 @@
EB0FB70C270D0B2900F7810D /* PushSubscriptionOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = EB0FB706270D0AEC00F7810D /* PushSubscriptionOptions.h */; };
EB0FB70D270D0B2E00F7810D /* PushSubscriptionOptionsInit.h in Headers */ = {isa = PBXBuildFile; fileRef = EB0FB701270D0AEA00F7810D /* PushSubscriptionOptionsInit.h */; };
EB28ED442717AC11005F0393 /* PushSubscriptionData.h in Headers */ = {isa = PBXBuildFile; fileRef = EB28ED412717ABA9005F0393 /* PushSubscriptionData.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ EB3C29B62729C38800FB65B4 /* PushSubscriptionChangeEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = EB3C29B42729C36E00FB65B4 /* PushSubscriptionChangeEvent.h */; };
+ EB3C29B72729C38C00FB65B4 /* PushSubscriptionChangeEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = EB3C29B12729C36D00FB65B4 /* PushSubscriptionChangeEventInit.h */; };
EBB9738127100671007732EF /* PushManager.h in Headers */ = {isa = PBXBuildFile; fileRef = EBB9738027100654007732EF /* PushManager.h */; };
EBB9738227100676007732EF /* PushPermissionState.h in Headers */ = {isa = PBXBuildFile; fileRef = EBB9737827100651007732EF /* PushPermissionState.h */; settings = {ATTRIBUTES = (Private, ); }; };
EBB9738327100684007732EF /* ServiceWorkerRegistrationPushAPI.h in Headers */ = {isa = PBXBuildFile; fileRef = EBB9737A27100652007732EF /* ServiceWorkerRegistrationPushAPI.h */; };
@@ -17144,6 +17146,11 @@
EB0FB707270D0AEC00F7810D /* PushSubscription.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PushSubscription.h; sourceTree = "<group>"; };
EB28ED412717ABA9005F0393 /* PushSubscriptionData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PushSubscriptionData.h; sourceTree = "<group>"; };
EB28ED432717ABA9005F0393 /* PushSubscriptionData.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PushSubscriptionData.cpp; sourceTree = "<group>"; };
+ EB3C29AF2729C36D00FB65B4 /* PushSubscriptionChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PushSubscriptionChangeEvent.cpp; sourceTree = "<group>"; };
+ EB3C29B12729C36D00FB65B4 /* PushSubscriptionChangeEventInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PushSubscriptionChangeEventInit.h; sourceTree = "<group>"; };
+ EB3C29B22729C36E00FB65B4 /* PushSubscriptionChangeEventInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PushSubscriptionChangeEventInit.idl; sourceTree = "<group>"; };
+ EB3C29B32729C36E00FB65B4 /* PushSubscriptionChangeEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PushSubscriptionChangeEvent.idl; sourceTree = "<group>"; };
+ EB3C29B42729C36E00FB65B4 /* PushSubscriptionChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PushSubscriptionChangeEvent.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>"; };
@@ -20597,6 +20604,11 @@
EB0FB704270D0AEB00F7810D /* PushSubscription.cpp */,
EB0FB707270D0AEC00F7810D /* PushSubscription.h */,
EB0FB705270D0AEB00F7810D /* PushSubscription.idl */,
+ EB3C29AF2729C36D00FB65B4 /* PushSubscriptionChangeEvent.cpp */,
+ EB3C29B42729C36E00FB65B4 /* PushSubscriptionChangeEvent.h */,
+ EB3C29B32729C36E00FB65B4 /* PushSubscriptionChangeEvent.idl */,
+ EB3C29B12729C36D00FB65B4 /* PushSubscriptionChangeEventInit.h */,
+ EB3C29B22729C36E00FB65B4 /* PushSubscriptionChangeEventInit.idl */,
EB28ED432717ABA9005F0393 /* PushSubscriptionData.cpp */,
EB28ED412717ABA9005F0393 /* PushSubscriptionData.h */,
EB0FB703270D0AEB00F7810D /* PushSubscriptionJSON.h */,
@@ -35489,6 +35501,8 @@
EBB9738227100676007732EF /* PushPermissionState.h in Headers */,
83D511F6250C1CBF002EDC51 /* PushPullFIFO.h in Headers */,
EB0FB709270D0B1800F7810D /* PushSubscription.h in Headers */,
+ EB3C29B62729C38800FB65B4 /* PushSubscriptionChangeEvent.h in Headers */,
+ EB3C29B72729C38C00FB65B4 /* PushSubscriptionChangeEventInit.h in Headers */,
EB28ED442717AC11005F0393 /* PushSubscriptionData.h in Headers */,
EB0FB70A270D0B1B00F7810D /* PushSubscriptionJSON.h in Headers */,
EB0FB70C270D0B2900F7810D /* PushSubscriptionOptions.h in Headers */,
Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (285563 => 285564)
--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2021-11-10 05:23:04 UTC (rev 285564)
@@ -252,6 +252,7 @@
macro(PushManager) \
macro(PushMessageData) \
macro(PushSubscription) \
+ macro(PushSubscriptionChangeEvent) \
macro(PushSubscriptionOptions) \
macro(ResizeObserver) \
macro(ResizeObserverEntry) \
Modified: trunk/Source/WebCore/dom/EventNames.in (285563 => 285564)
--- trunk/Source/WebCore/dom/EventNames.in 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/dom/EventNames.in 2021-11-10 05:23:04 UTC (rev 285564)
@@ -37,6 +37,7 @@
ProgressEvent
PromiseRejectionEvent
PushEvent conditional=SERVICE_WORKER
+PushSubscriptionChangeEvent conditional=SERVICE_WORKER
SubmitEvent
TextEvent
TransitionEvent
Modified: trunk/Source/WebCore/testing/Internals.cpp (285563 => 285564)
--- trunk/Source/WebCore/testing/Internals.cpp 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/testing/Internals.cpp 2021-11-10 05:23:04 UTC (rev 285564)
@@ -123,7 +123,6 @@
#include "InternalsSetLike.h"
#include "JSDOMPromiseDeferred.h"
#include "JSImageData.h"
-#include "JSServiceWorkerRegistration.h"
#include "LegacySchemeRegistry.h"
#include "LibWebRTCProvider.h"
#include "LoaderStrategy.h"
@@ -165,7 +164,6 @@
#include "PrintContext.h"
#include "PseudoElement.h"
#include "PushSubscription.h"
-#include "PushSubscriptionOptions.h"
#include "RTCRtpSFrameTransform.h"
#include "Range.h"
#include "ReadableStream.h"
@@ -6585,7 +6583,7 @@
}
#if ENABLE(SERVICE_WORKER)
-RefPtr<PushSubscription> Internals::createPushSubscription(Ref<ServiceWorkerRegistration>&& registration, const String& endpoint, std::optional<EpochTimeStamp> expirationTime, const ArrayBuffer& serverVAPIDPublicKey, const ArrayBuffer& clientECDHPublicKey, const ArrayBuffer& auth)
+RefPtr<PushSubscription> Internals::createPushSubscription(const String& endpoint, std::optional<EpochTimeStamp> expirationTime, 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() };
@@ -6592,7 +6590,7 @@
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(registration), WTFMove(myEndpoint), expirationTime, WTFMove(myServerVAPIDPublicKey), WTFMove(myClientECDHPublicKey), WTFMove(myAuth));
+ return PushSubscription::create(WTFMove(myEndpoint), expirationTime, WTFMove(myServerVAPIDPublicKey), WTFMove(myClientECDHPublicKey), WTFMove(myAuth));
}
#endif
Modified: trunk/Source/WebCore/testing/Internals.h (285563 => 285564)
--- trunk/Source/WebCore/testing/Internals.h 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/testing/Internals.h 2021-11-10 05:23:04 UTC (rev 285564)
@@ -127,7 +127,6 @@
#if ENABLE(SERVICE_WORKER)
class PushSubscription;
class ServiceWorker;
-class ServiceWorkerRegistration;
#endif
#if ENABLE(WEB_RTC)
@@ -1206,7 +1205,7 @@
void retainTextIteratorForDocumentContent();
#if ENABLE(SERVICE_WORKER)
- RefPtr<PushSubscription> createPushSubscription(Ref<ServiceWorkerRegistration>&&, const String& endpoint, std::optional<EpochTimeStamp> expirationTime, const ArrayBuffer& serverVAPIDPublicKey, const ArrayBuffer& clientECDHPublicKey, const ArrayBuffer& auth);
+ RefPtr<PushSubscription> createPushSubscription(const String& endpoint, std::optional<EpochTimeStamp> expirationTime, const ArrayBuffer& serverVAPIDPublicKey, const ArrayBuffer& clientECDHPublicKey, const ArrayBuffer& auth);
#endif
private:
Modified: trunk/Source/WebCore/testing/Internals.idl (285563 => 285564)
--- trunk/Source/WebCore/testing/Internals.idl 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/testing/Internals.idl 2021-11-10 05:23:04 UTC (rev 285564)
@@ -1073,5 +1073,5 @@
undefined retainTextIteratorForDocumentContent();
- [Conditional=SERVICE_WORKER] PushSubscription createPushSubscription(ServiceWorkerRegistration registration, USVString endpoint, EpochTimeStamp? expirationTime, ArrayBuffer serverVAPIDPublicKey, ArrayBuffer clientECDHPublicKey, ArrayBuffer auth);
+ [Conditional=SERVICE_WORKER] PushSubscription createPushSubscription(USVString endpoint, EpochTimeStamp? expirationTime, ArrayBuffer serverVAPIDPublicKey, ArrayBuffer clientECDHPublicKey, ArrayBuffer auth);
};
Modified: trunk/Source/WebCore/testing/ServiceWorkerInternals.cpp (285563 => 285564)
--- trunk/Source/WebCore/testing/ServiceWorkerInternals.cpp 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/testing/ServiceWorkerInternals.cpp 2021-11-10 05:23:04 UTC (rev 285564)
@@ -30,6 +30,7 @@
#include "FetchEvent.h"
#include "JSFetchResponse.h"
+#include "PushSubscription.h"
#include "SWContextManager.h"
#include <wtf/ProcessID.h>
@@ -160,6 +161,16 @@
});
}
+RefPtr<PushSubscription> ServiceWorkerInternals::createPushSubscription(const String& endpoint, std::optional<EpochTimeStamp> expirationTime, 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, WTFMove(myServerVAPIDPublicKey), WTFMove(myClientECDHPublicKey), WTFMove(myAuth));
+}
+
} // namespace WebCore
#endif
Modified: trunk/Source/WebCore/testing/ServiceWorkerInternals.h (285563 => 285564)
--- trunk/Source/WebCore/testing/ServiceWorkerInternals.h 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/testing/ServiceWorkerInternals.h 2021-11-10 05:23:04 UTC (rev 285564)
@@ -27,9 +27,11 @@
#if ENABLE(SERVICE_WORKER)
+#include "EpochTimeStamp.h"
#include "IDLTypes.h"
#include "JSDOMPromiseDeferred.h"
#include "ServiceWorkerIdentifier.h"
+#include <_javascript_Core/Forward.h>
#include <wtf/RefCounted.h>
namespace WebCore {
@@ -36,6 +38,7 @@
class FetchEvent;
class FetchResponse;
+class PushSubscription;
class ScriptExecutionContext;
template<typename IDLType> class DOMPromiseDeferred;
@@ -62,6 +65,8 @@
int processIdentifier() const;
void lastNavigationWasAppInitiated(Ref<DeferredPromise>&&);
+
+ RefPtr<PushSubscription> createPushSubscription(const String& endpoint, std::optional<EpochTimeStamp> expirationTime, const ArrayBuffer& serverVAPIDPublicKey, const ArrayBuffer& clientECDHPublicKey, const ArrayBuffer& auth);
private:
explicit ServiceWorkerInternals(ServiceWorkerIdentifier);
Modified: trunk/Source/WebCore/testing/ServiceWorkerInternals.idl (285563 => 285564)
--- trunk/Source/WebCore/testing/ServiceWorkerInternals.idl 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/testing/ServiceWorkerInternals.idl 2021-11-10 05:23:04 UTC (rev 285564)
@@ -46,4 +46,6 @@
readonly attribute long processIdentifier;
Promise<boolean> lastNavigationWasAppInitiated();
+
+ PushSubscription createPushSubscription(USVString endpoint, EpochTimeStamp? expirationTime, ArrayBuffer serverVAPIDPublicKey, ArrayBuffer clientECDHPublicKey, ArrayBuffer auth);
};
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.h (285563 => 285564)
--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.h 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.h 2021-11-10 05:23:04 UTC (rev 285564)
@@ -45,11 +45,11 @@
class ServiceWorkerContainer;
class ServiceWorkerRegistration final : public RefCounted<ServiceWorkerRegistration>, public Supplementable<ServiceWorkerRegistration>, public EventTargetWithInlineData, public ActiveDOMObject {
- WTF_MAKE_ISO_ALLOCATED_EXPORT(ServiceWorkerRegistration, WEBCORE_EXPORT);
+ WTF_MAKE_ISO_ALLOCATED(ServiceWorkerRegistration);
public:
static Ref<ServiceWorkerRegistration> getOrCreate(ScriptExecutionContext&, Ref<ServiceWorkerContainer>&&, ServiceWorkerRegistrationData&&);
- WEBCORE_EXPORT ~ServiceWorkerRegistration();
+ ~ServiceWorkerRegistration();
ServiceWorkerRegistrationIdentifier identifier() const { return m_registrationData.identifier; }
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.idl (285563 => 285564)
--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.idl 2021-11-10 05:14:47 UTC (rev 285563)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.idl 2021-11-10 05:23:04 UTC (rev 285564)
@@ -30,7 +30,6 @@
ActiveDOMObject,
SecureContext,
Exposed=(Window,ServiceWorker),
- ExportMacro=WEBCORE_EXPORT,
Conditional=SERVICE_WORKER,
EnabledAtRuntime=ServiceWorkerEnabled,
GenerateIsReachable=Impl,