Diff
Modified: trunk/LayoutTests/ChangeLog (292721 => 292722)
--- trunk/LayoutTests/ChangeLog 2022-04-11 20:59:13 UTC (rev 292721)
+++ trunk/LayoutTests/ChangeLog 2022-04-11 21:16:16 UTC (rev 292722)
@@ -1,3 +1,18 @@
+2022-04-11 Youenn Fablet <[email protected]>
+
+ Expose more ServiceWorker interfaces to workers
+ https://bugs.webkit.org/show_bug.cgi?id=238992
+
+ Reviewed by Chris Dumez.
+
+ * http/wpt/service-workers/resources/serviceworker-in-sharedworker.js: Added.
+ * http/wpt/service-workers/resources/serviceworker-in-worker.js: Added.
+ * http/wpt/service-workers/serviceworker-in-dedicatedworker.https-expected.txt: Added.
+ * http/wpt/service-workers/serviceworker-in-dedicatedworker.https.html: Added.
+ * http/wpt/service-workers/serviceworker-in-sharedworker.https-expected.txt: Added.
+ * http/wpt/service-workers/serviceworker-in-sharedworker.https.html: Added.
+ * platform/mac-wk1/imported/w3c/web-platform-tests/notifications/idlharness.https.any.worker-expected.txt:
+
2022-04-11 Matteo Flores <[email protected]>
REBASLINE: [ Monterey wk2 ] 4 http/tests/inspector/paymentrequest/* tests are constant text failures
Added: trunk/LayoutTests/http/wpt/service-workers/resources/serviceworker-in-sharedworker.js (0 => 292722)
--- trunk/LayoutTests/http/wpt/service-workers/resources/serviceworker-in-sharedworker.js (rev 0)
+++ trunk/LayoutTests/http/wpt/service-workers/resources/serviceworker-in-sharedworker.js 2022-04-11 21:16:16 UTC (rev 292722)
@@ -0,0 +1,21 @@
+_onconnect_ = async (e) => {
+ const port = e.ports[0];
+ try {
+ const registration = await navigator.serviceWorker.register("../skipFetchEvent-worker.js", { scope : '' });
+ activeWorker = registration.active;
+ if (activeWorker) {
+ port.postMessage('already active');
+ return;
+ }
+ activeWorker = registration.installing;
+ await new Promise(resolve => {
+ activeWorker.addEventListener('statechange', () => {
+ if (activeWorker.state === "activated")
+ resolve();
+ });
+ });
+ port.postMessage('registration is now active');
+ } catch (e) {
+ port.postMessage('error: '+ e);
+ }
+}
Added: trunk/LayoutTests/http/wpt/service-workers/resources/serviceworker-in-worker.js (0 => 292722)
--- trunk/LayoutTests/http/wpt/service-workers/resources/serviceworker-in-worker.js (rev 0)
+++ trunk/LayoutTests/http/wpt/service-workers/resources/serviceworker-in-worker.js 2022-04-11 21:16:16 UTC (rev 292722)
@@ -0,0 +1,22 @@
+async function registerServiceWorker()
+{
+ try {
+ const registration = await navigator.serviceWorker.register("../skipFetchEvent-worker.js", { scope : '' });
+ activeWorker = registration.active;
+ if (activeWorker) {
+ self.postMessage('already active');
+ return;
+ }
+ activeWorker = registration.installing;
+ await new Promise(resolve => {
+ activeWorker.addEventListener('statechange', () => {
+ if (activeWorker.state === "activated")
+ resolve();
+ });
+ });
+ self.postMessage('registration is now active');
+ } catch (e) {
+ self.postMessage('error: '+ e);
+ }
+}
+registerServiceWorker();
Added: trunk/LayoutTests/http/wpt/service-workers/serviceworker-in-dedicatedworker.https-expected.txt (0 => 292722)
--- trunk/LayoutTests/http/wpt/service-workers/serviceworker-in-dedicatedworker.https-expected.txt (rev 0)
+++ trunk/LayoutTests/http/wpt/service-workers/serviceworker-in-dedicatedworker.https-expected.txt 2022-04-11 21:16:16 UTC (rev 292722)
@@ -0,0 +1,3 @@
+
+PASS Register service worker in worker
+
Added: trunk/LayoutTests/http/wpt/service-workers/serviceworker-in-dedicatedworker.https.html (0 => 292722)
--- trunk/LayoutTests/http/wpt/service-workers/serviceworker-in-dedicatedworker.https.html (rev 0)
+++ trunk/LayoutTests/http/wpt/service-workers/serviceworker-in-dedicatedworker.https.html 2022-04-11 21:16:16 UTC (rev 292722)
@@ -0,0 +1,19 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+<script>
+var worker;
+
+promise_test(async (test) => {
+ worker = new Worker('resources/serviceworker-in-worker.js');
+ await new Promise(resolve => worker._onmessage_ = resolve);
+ const registrations = await navigator.serviceWorker.getRegistrations();
+ assert_equals(registrations.length, 1);
+}, "Register service worker in worker");
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/http/wpt/service-workers/serviceworker-in-sharedworker.https-expected.txt (0 => 292722)
--- trunk/LayoutTests/http/wpt/service-workers/serviceworker-in-sharedworker.https-expected.txt (rev 0)
+++ trunk/LayoutTests/http/wpt/service-workers/serviceworker-in-sharedworker.https-expected.txt 2022-04-11 21:16:16 UTC (rev 292722)
@@ -0,0 +1,3 @@
+
+PASS Register service worker in worker
+
Added: trunk/LayoutTests/http/wpt/service-workers/serviceworker-in-sharedworker.https.html (0 => 292722)
--- trunk/LayoutTests/http/wpt/service-workers/serviceworker-in-sharedworker.https.html (rev 0)
+++ trunk/LayoutTests/http/wpt/service-workers/serviceworker-in-sharedworker.https.html 2022-04-11 21:16:16 UTC (rev 292722)
@@ -0,0 +1,19 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+<script>
+var worker;
+
+promise_test(async (test) => {
+ worker = new SharedWorker('resources/serviceworker-in-sharedworker.js');
+ await new Promise(resolve => worker.port._onmessage_ = resolve);
+ const registrations = await navigator.serviceWorker.getRegistrations();
+ assert_equals(registrations.length, 1);
+}, "Register service worker in worker");
+</script>
+</body>
+</html>
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (292721 => 292722)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-04-11 20:59:13 UTC (rev 292721)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-04-11 21:16:16 UTC (rev 292722)
@@ -1,3 +1,15 @@
+2022-04-11 Youenn Fablet <[email protected]>
+
+ Expose more ServiceWorker interfaces to workers
+ https://bugs.webkit.org/show_bug.cgi?id=238992
+
+ Reviewed by Chris Dumez.
+
+ * web-platform-tests/notifications/idlharness.https.any.worker-expected.txt:
+ * web-platform-tests/push-api/idlharness.https.any.worker-expected.txt:
+ * web-platform-tests/service-workers/idlharness.https.any.sharedworker-expected.txt:
+ * web-platform-tests/service-workers/idlharness.https.any.worker-expected.txt:
+
2022-04-08 Antti Koivisto <[email protected]>
[CSS Container Queries] Search query containers for ::slotted and and ::part rules in their scope
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/idlharness.https.any.worker-expected.txt (292721 => 292722)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/idlharness.https.any.worker-expected.txt 2022-04-11 20:59:13 UTC (rev 292721)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/idlharness.https.any.worker-expected.txt 2022-04-11 21:16:16 UTC (rev 292722)
@@ -61,6 +61,6 @@
FAIL Notification interface: notification must inherit property "actions" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
FAIL Notification interface: notification must inherit property "close()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
PASS NotificationEvent interface: existence and properties of interface object
-FAIL ServiceWorkerRegistration interface: operation showNotification(DOMString, optional NotificationOptions) assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: operation getNotifications(optional GetNotificationOptions) assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
+PASS ServiceWorkerRegistration interface: operation showNotification(DOMString, optional NotificationOptions)
+PASS ServiceWorkerRegistration interface: operation getNotifications(optional GetNotificationOptions)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any.worker-expected.txt (292721 => 292722)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any.worker-expected.txt 2022-04-11 20:59:13 UTC (rev 292721)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/push-api/idlharness.https.any.worker-expected.txt 2022-04-11 21:16:16 UTC (rev 292722)
@@ -40,5 +40,5 @@
PASS PushMessageData interface: existence and properties of interface object
PASS PushEvent interface: existence and properties of interface object
PASS PushSubscriptionChangeEvent interface: existence and properties of interface object
-FAIL ServiceWorkerRegistration interface: attribute pushManager assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
+PASS ServiceWorkerRegistration interface: attribute pushManager
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/idlharness.https.any.sharedworker-expected.txt (292721 => 292722)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/idlharness.https.any.sharedworker-expected.txt 2022-04-11 20:59:13 UTC (rev 292721)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/idlharness.https.any.sharedworker-expected.txt 2022-04-11 21:16:16 UTC (rev 292722)
@@ -28,48 +28,48 @@
PASS WorkerNavigator includes NavigatorConcurrentHardware: member names are unique
PASS Window includes WindowSessionStorage: member names are unique
PASS Window includes WindowLocalStorage: member names are unique
-FAIL ServiceWorker interface: existence and properties of interface object assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorker interface object length assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorker interface object name assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorker interface: existence and properties of interface prototype object assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorker interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorker interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorker interface: attribute scriptURL assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorker interface: attribute state assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorker interface: operation postMessage(any, sequence<object>) assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorker interface: operation postMessage(any, optional StructuredSerializeOptions) assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorker interface: attribute onstatechange assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorkerRegistration interface: existence and properties of interface object assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface object length assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface object name assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: existence and properties of interface prototype object assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: attribute installing assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: attribute waiting assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: attribute active assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: attribute navigationPreload assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: attribute scope assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: attribute updateViaCache assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: operation update() assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: operation unregister() assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: attribute onupdatefound assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerContainer interface: existence and properties of interface object assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface object length assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface object name assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: existence and properties of interface prototype object assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: attribute controller assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: attribute ready assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: operation register(USVString, optional RegistrationOptions) assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: operation getRegistration(optional USVString) assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: operation getRegistrations() assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: operation startMessages() assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: attribute oncontrollerchange assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: attribute onmessage assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: attribute onmessageerror assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer must be primary interface of navigator.serviceWorker assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
+PASS ServiceWorker interface: existence and properties of interface object
+PASS ServiceWorker interface object length
+PASS ServiceWorker interface object name
+PASS ServiceWorker interface: existence and properties of interface prototype object
+PASS ServiceWorker interface: existence and properties of interface prototype object's "constructor" property
+PASS ServiceWorker interface: existence and properties of interface prototype object's @@unscopables property
+PASS ServiceWorker interface: attribute scriptURL
+PASS ServiceWorker interface: attribute state
+PASS ServiceWorker interface: operation postMessage(any, sequence<object>)
+PASS ServiceWorker interface: operation postMessage(any, optional StructuredSerializeOptions)
+PASS ServiceWorker interface: attribute onstatechange
+PASS ServiceWorkerRegistration interface: existence and properties of interface object
+PASS ServiceWorkerRegistration interface object length
+PASS ServiceWorkerRegistration interface object name
+PASS ServiceWorkerRegistration interface: existence and properties of interface prototype object
+PASS ServiceWorkerRegistration interface: existence and properties of interface prototype object's "constructor" property
+PASS ServiceWorkerRegistration interface: existence and properties of interface prototype object's @@unscopables property
+PASS ServiceWorkerRegistration interface: attribute installing
+PASS ServiceWorkerRegistration interface: attribute waiting
+PASS ServiceWorkerRegistration interface: attribute active
+PASS ServiceWorkerRegistration interface: attribute navigationPreload
+PASS ServiceWorkerRegistration interface: attribute scope
+PASS ServiceWorkerRegistration interface: attribute updateViaCache
+PASS ServiceWorkerRegistration interface: operation update()
+PASS ServiceWorkerRegistration interface: operation unregister()
+PASS ServiceWorkerRegistration interface: attribute onupdatefound
+PASS ServiceWorkerContainer interface: existence and properties of interface object
+PASS ServiceWorkerContainer interface object length
+PASS ServiceWorkerContainer interface object name
+PASS ServiceWorkerContainer interface: existence and properties of interface prototype object
+PASS ServiceWorkerContainer interface: existence and properties of interface prototype object's "constructor" property
+PASS ServiceWorkerContainer interface: existence and properties of interface prototype object's @@unscopables property
+PASS ServiceWorkerContainer interface: attribute controller
+PASS ServiceWorkerContainer interface: attribute ready
+PASS ServiceWorkerContainer interface: operation register(USVString, optional RegistrationOptions)
+PASS ServiceWorkerContainer interface: operation getRegistration(optional USVString)
+PASS ServiceWorkerContainer interface: operation getRegistrations()
+PASS ServiceWorkerContainer interface: operation startMessages()
+PASS ServiceWorkerContainer interface: attribute oncontrollerchange
+PASS ServiceWorkerContainer interface: attribute onmessage
+PASS ServiceWorkerContainer interface: attribute onmessageerror
+PASS ServiceWorkerContainer must be primary interface of navigator.serviceWorker
PASS Stringification of navigator.serviceWorker
PASS ServiceWorkerContainer interface: navigator.serviceWorker must inherit property "controller" with the proper type
PASS ServiceWorkerContainer interface: navigator.serviceWorker must inherit property "ready" with the proper type
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/idlharness.https.any.worker-expected.txt (292721 => 292722)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/idlharness.https.any.worker-expected.txt 2022-04-11 20:59:13 UTC (rev 292721)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/idlharness.https.any.worker-expected.txt 2022-04-11 21:16:16 UTC (rev 292722)
@@ -28,48 +28,48 @@
PASS WorkerNavigator includes NavigatorConcurrentHardware: member names are unique
PASS Window includes WindowSessionStorage: member names are unique
PASS Window includes WindowLocalStorage: member names are unique
-FAIL ServiceWorker interface: existence and properties of interface object assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorker interface object length assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorker interface object name assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorker interface: existence and properties of interface prototype object assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorker interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorker interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorker interface: attribute scriptURL assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorker interface: attribute state assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorker interface: operation postMessage(any, sequence<object>) assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorker interface: operation postMessage(any, optional StructuredSerializeOptions) assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorker interface: attribute onstatechange assert_own_property: self does not have own property "ServiceWorker" expected property "ServiceWorker" missing
-FAIL ServiceWorkerRegistration interface: existence and properties of interface object assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface object length assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface object name assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: existence and properties of interface prototype object assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: attribute installing assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: attribute waiting assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: attribute active assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: attribute navigationPreload assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: attribute scope assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: attribute updateViaCache assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: operation update() assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: operation unregister() assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerRegistration interface: attribute onupdatefound assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
-FAIL ServiceWorkerContainer interface: existence and properties of interface object assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface object length assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface object name assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: existence and properties of interface prototype object assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: attribute controller assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: attribute ready assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: operation register(USVString, optional RegistrationOptions) assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: operation getRegistration(optional USVString) assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: operation getRegistrations() assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: operation startMessages() assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: attribute oncontrollerchange assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: attribute onmessage assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer interface: attribute onmessageerror assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
-FAIL ServiceWorkerContainer must be primary interface of navigator.serviceWorker assert_own_property: self does not have own property "ServiceWorkerContainer" expected property "ServiceWorkerContainer" missing
+PASS ServiceWorker interface: existence and properties of interface object
+PASS ServiceWorker interface object length
+PASS ServiceWorker interface object name
+PASS ServiceWorker interface: existence and properties of interface prototype object
+PASS ServiceWorker interface: existence and properties of interface prototype object's "constructor" property
+PASS ServiceWorker interface: existence and properties of interface prototype object's @@unscopables property
+PASS ServiceWorker interface: attribute scriptURL
+PASS ServiceWorker interface: attribute state
+PASS ServiceWorker interface: operation postMessage(any, sequence<object>)
+PASS ServiceWorker interface: operation postMessage(any, optional StructuredSerializeOptions)
+PASS ServiceWorker interface: attribute onstatechange
+PASS ServiceWorkerRegistration interface: existence and properties of interface object
+PASS ServiceWorkerRegistration interface object length
+PASS ServiceWorkerRegistration interface object name
+PASS ServiceWorkerRegistration interface: existence and properties of interface prototype object
+PASS ServiceWorkerRegistration interface: existence and properties of interface prototype object's "constructor" property
+PASS ServiceWorkerRegistration interface: existence and properties of interface prototype object's @@unscopables property
+PASS ServiceWorkerRegistration interface: attribute installing
+PASS ServiceWorkerRegistration interface: attribute waiting
+PASS ServiceWorkerRegistration interface: attribute active
+PASS ServiceWorkerRegistration interface: attribute navigationPreload
+PASS ServiceWorkerRegistration interface: attribute scope
+PASS ServiceWorkerRegistration interface: attribute updateViaCache
+PASS ServiceWorkerRegistration interface: operation update()
+PASS ServiceWorkerRegistration interface: operation unregister()
+PASS ServiceWorkerRegistration interface: attribute onupdatefound
+PASS ServiceWorkerContainer interface: existence and properties of interface object
+PASS ServiceWorkerContainer interface object length
+PASS ServiceWorkerContainer interface object name
+PASS ServiceWorkerContainer interface: existence and properties of interface prototype object
+PASS ServiceWorkerContainer interface: existence and properties of interface prototype object's "constructor" property
+PASS ServiceWorkerContainer interface: existence and properties of interface prototype object's @@unscopables property
+PASS ServiceWorkerContainer interface: attribute controller
+PASS ServiceWorkerContainer interface: attribute ready
+PASS ServiceWorkerContainer interface: operation register(USVString, optional RegistrationOptions)
+PASS ServiceWorkerContainer interface: operation getRegistration(optional USVString)
+PASS ServiceWorkerContainer interface: operation getRegistrations()
+PASS ServiceWorkerContainer interface: operation startMessages()
+PASS ServiceWorkerContainer interface: attribute oncontrollerchange
+PASS ServiceWorkerContainer interface: attribute onmessage
+PASS ServiceWorkerContainer interface: attribute onmessageerror
+PASS ServiceWorkerContainer must be primary interface of navigator.serviceWorker
PASS Stringification of navigator.serviceWorker
PASS ServiceWorkerContainer interface: navigator.serviceWorker must inherit property "controller" with the proper type
PASS ServiceWorkerContainer interface: navigator.serviceWorker must inherit property "ready" with the proper type
Copied: trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/notifications/idlharness.https.any.worker-expected.txt (from rev 292721, trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/idlharness.https.any.worker-expected.txt) (0 => 292722)
--- trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/notifications/idlharness.https.any.worker-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/notifications/idlharness.https.any.worker-expected.txt 2022-04-11 21:16:16 UTC (rev 292722)
@@ -0,0 +1,66 @@
+
+FAIL idl_test setup promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: Notification"
+PASS idl_test validation
+PASS Partial interface ServiceWorkerRegistration: original interface defined
+PASS Partial interface ServiceWorkerRegistration: member names are unique
+PASS Partial interface ServiceWorkerGlobalScope: original interface defined
+PASS Partial interface ServiceWorkerGlobalScope: member names are unique
+PASS WorkerGlobalScope includes WindowOrWorkerGlobalScope: member names are unique
+FAIL Notification interface: existence and properties of interface object assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface object length assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface object name assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: existence and properties of interface prototype object assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: attribute permission assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: member requestPermission undefined is not an Object. (evaluating 'member.name in this.get_interface_object()')
+FAIL Notification interface: attribute maxActions assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: attribute onclick assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: attribute onshow assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: attribute onerror assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: attribute onclose assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: attribute title assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: attribute dir assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: attribute lang assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: attribute body assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: attribute tag assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: attribute image assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: attribute icon assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: attribute badge assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: attribute vibrate assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: attribute timestamp assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: attribute renotify assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: attribute silent assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: attribute requireInteraction assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: attribute data assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: attribute actions assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification interface: operation close() assert_own_property: self does not have own property "Notification" expected property "Notification" missing
+FAIL Notification must be primary interface of notification assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Stringification of notification assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "permission" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must not have property "requestPermission" assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "maxActions" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "onclick" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "onshow" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "onerror" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "onclose" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "title" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "dir" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "lang" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "body" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "tag" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "image" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "icon" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "badge" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "vibrate" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "timestamp" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "renotify" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "silent" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "requireInteraction" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "data" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "actions" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+FAIL Notification interface: notification must inherit property "close()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: notification"
+PASS NotificationEvent interface: existence and properties of interface object
+FAIL ServiceWorkerRegistration interface: operation showNotification(DOMString, optional NotificationOptions) assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
+FAIL ServiceWorkerRegistration interface: operation getNotifications(optional GetNotificationOptions) assert_own_property: self does not have own property "ServiceWorkerRegistration" expected property "ServiceWorkerRegistration" missing
+
Modified: trunk/Source/WebCore/ChangeLog (292721 => 292722)
--- trunk/Source/WebCore/ChangeLog 2022-04-11 20:59:13 UTC (rev 292721)
+++ trunk/Source/WebCore/ChangeLog 2022-04-11 21:16:16 UTC (rev 292722)
@@ -1,3 +1,27 @@
+2022-04-11 Youenn Fablet <[email protected]>
+
+ Expose more ServiceWorker interfaces to workers
+ https://bugs.webkit.org/show_bug.cgi?id=238992
+
+ Reviewed by Chris Dumez.
+
+ Expose ServiceWorker, ServiceWorkerContainer and ServiceWorkerRegistration interfaces.
+ Update task posting to support workers and shared workers.
+
+ Tests: http/wpt/service-workers/serviceworker-in-dedicatedworker.https.html
+ http/wpt/service-workers/serviceworker-in-sharedworker.https.html
+
+ * workers/Worker.cpp:
+ * workers/Worker.h:
+ * workers/service/SWClientConnection.cpp:
+ * workers/service/ServiceWorker.idl:
+ * workers/service/ServiceWorkerContainer.idl:
+ * workers/service/ServiceWorkerRegistration.idl:
+ * workers/service/context/SWContextManager.cpp:
+ * workers/service/context/SWContextManager.h:
+ * workers/shared/context/SharedWorkerContextManager.cpp:
+ * workers/shared/context/SharedWorkerContextManager.h:
+
2022-04-11 Sihui Liu <[email protected]>
Fix size computation in WebCore::StorageMap
Modified: trunk/Source/WebCore/workers/Worker.cpp (292721 => 292722)
--- trunk/Source/WebCore/workers/Worker.cpp 2022-04-11 20:59:13 UTC (rev 292721)
+++ trunk/Source/WebCore/workers/Worker.cpp 2022-04-11 21:16:16 UTC (rev 292722)
@@ -242,11 +242,17 @@
});
}
+#endif
void Worker::postTaskToWorkerGlobalScope(Function<void(ScriptExecutionContext&)>&& task)
{
m_contextProxy.postTaskToWorkerGlobalScope(WTFMove(task));
}
-#endif
+void Worker::forEachWorker(const Function<Function<void(ScriptExecutionContext&)>()>& callback)
+{
+ for (auto* worker : allWorkers())
+ worker->postTaskToWorkerGlobalScope(callback());
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/workers/Worker.h (292721 => 292722)
--- trunk/Source/WebCore/workers/Worker.h 2022-04-11 20:59:13 UTC (rev 292721)
+++ trunk/Source/WebCore/workers/Worker.h 2022-04-11 21:16:16 UTC (rev 292722)
@@ -76,11 +76,13 @@
#if ENABLE(WEB_RTC)
void createRTCRtpScriptTransformer(RTCRtpScriptTransform&, MessageWithMessagePorts&&);
- void postTaskToWorkerGlobalScope(Function<void(ScriptExecutionContext&)>&&);
#endif
WorkerType type() const { return m_options.type; }
+ void postTaskToWorkerGlobalScope(Function<void(ScriptExecutionContext&)>&&);
+ static void forEachWorker(const Function<Function<void(ScriptExecutionContext&)>()>&);
+
private:
explicit Worker(ScriptExecutionContext&, JSC::RuntimeFlags, WorkerOptions&&);
Modified: trunk/Source/WebCore/workers/service/SWClientConnection.cpp (292721 => 292722)
--- trunk/Source/WebCore/workers/service/SWClientConnection.cpp 2022-04-11 20:59:13 UTC (rev 292721)
+++ trunk/Source/WebCore/workers/service/SWClientConnection.cpp 2022-04-11 21:16:16 UTC (rev 292722)
@@ -36,6 +36,8 @@
#include "ServiceWorkerGlobalScope.h"
#include "ServiceWorkerJobData.h"
#include "ServiceWorkerRegistration.h"
+#include "SharedWorkerContextManager.h"
+#include "Worker.h"
#include "WorkerFetchResult.h"
#include <wtf/CrossThreadCopier.h>
@@ -44,20 +46,12 @@
static bool dispatchToContextThreadIfNecessary(const ServiceWorkerOrClientIdentifier& contextIdentifier, Function<void(ScriptExecutionContext&)>&& task)
{
RELEASE_ASSERT(isMainThread());
- bool wasPosted = false;
- switchOn(contextIdentifier, [&] (ScriptExecutionContextIdentifier identifier) {
- // FIXME: We should probably just use ScriptExecutionContext::postTaskTo().
- auto* document = Document::allDocumentsMap().get(identifier);
- if (!document)
- return;
- task(*document);
- wasPosted = true;
+
+ return switchOn(contextIdentifier, [&] (ScriptExecutionContextIdentifier identifier) {
+ return ScriptExecutionContext::postTaskTo(identifier, WTFMove(task));
}, [&](ServiceWorkerIdentifier identifier) {
- wasPosted = SWContextManager::singleton().postTaskToServiceWorker(identifier, [task = WTFMove(task)](auto& scope) mutable {
- task(scope);
- });
+ return SWContextManager::singleton().postTaskToServiceWorker(identifier, WTFMove(task));
});
- return wasPosted;
}
SWClientConnection::SWClientConnection() = default;
@@ -133,21 +127,28 @@
container->postMessage(WTFMove(message), WTFMove(sourceData), WTFMove(sourceOrigin));
}
+static void forAllWorkers(const Function<Function<void(ScriptExecutionContext&)>()>& callback)
+{
+ SWContextManager::singleton().forEachServiceWorker(callback);
+ Worker::forEachWorker(callback);
+ SharedWorkerContextManager::singleton().forEachSharedWorker(callback);
+}
+
void SWClientConnection::updateRegistrationState(ServiceWorkerRegistrationIdentifier identifier, ServiceWorkerRegistrationState state, const std::optional<ServiceWorkerData>& serviceWorkerData)
{
ASSERT(isMainThread());
- SWContextManager::singleton().forEachServiceWorkerThread([identifier, state, &serviceWorkerData] (auto& workerThread) {
- workerThread.thread().runLoop().postTask([identifier, state, serviceWorkerData = crossThreadCopy(serviceWorkerData)](ScriptExecutionContext& context) mutable {
- if (auto* container = context.serviceWorkerContainer())
- container->updateRegistrationState(identifier, state, WTFMove(serviceWorkerData));
- });
- });
-
for (auto* document : Document::allDocuments()) {
if (auto* container = document->serviceWorkerContainer())
container->updateRegistrationState(identifier, state, serviceWorkerData);
}
+
+ forAllWorkers([identifier, state, &serviceWorkerData] {
+ return [identifier, state, serviceWorkerData = crossThreadCopy(serviceWorkerData)] (auto& context) mutable {
+ if (auto* container = context.serviceWorkerContainer())
+ container->updateRegistrationState(identifier, state, WTFMove(serviceWorkerData));
+ };
+ });
}
void SWClientConnection::updateWorkerState(ServiceWorkerIdentifier identifier, ServiceWorkerState state)
@@ -154,17 +155,17 @@
{
ASSERT(isMainThread());
- SWContextManager::singleton().forEachServiceWorkerThread([identifier, state] (auto& workerThread) {
- workerThread.thread().runLoop().postTask([identifier, state](ScriptExecutionContext& context) {
- if (auto* container = context.serviceWorkerContainer())
- container->updateWorkerState(identifier, state);
- });
- });
-
for (auto* document : Document::allDocuments()) {
if (auto* container = document->serviceWorkerContainer())
container->updateWorkerState(identifier, state);
}
+
+ forAllWorkers([identifier, state] {
+ return [identifier, state] (auto& context) {
+ if (auto* container = context.serviceWorkerContainer())
+ container->updateWorkerState(identifier, state);
+ };
+ });
}
void SWClientConnection::fireUpdateFoundEvent(ServiceWorkerRegistrationIdentifier identifier)
@@ -171,17 +172,17 @@
{
ASSERT(isMainThread());
- SWContextManager::singleton().forEachServiceWorkerThread([identifier] (auto& workerThread) {
- workerThread.thread().runLoop().postTask([identifier](ScriptExecutionContext& context) {
- if (auto* container = context.serviceWorkerContainer())
- container->queueTaskToFireUpdateFoundEvent(identifier);
- });
- });
-
for (auto* document : Document::allDocuments()) {
if (auto* container = document->serviceWorkerContainer())
container->queueTaskToFireUpdateFoundEvent(identifier);
}
+
+ forAllWorkers([identifier] {
+ return [identifier] (auto& context) {
+ if (auto* container = context.serviceWorkerContainer())
+ container->queueTaskToFireUpdateFoundEvent(identifier);
+ };
+ });
}
void SWClientConnection::setRegistrationLastUpdateTime(ServiceWorkerRegistrationIdentifier identifier, WallTime lastUpdateTime)
@@ -188,15 +189,6 @@
{
ASSERT(isMainThread());
- SWContextManager::singleton().forEachServiceWorkerThread([identifier, lastUpdateTime] (auto& workerThread) {
- workerThread.thread().runLoop().postTask([identifier, lastUpdateTime](ScriptExecutionContext& context) {
- if (auto* container = context.serviceWorkerContainer()) {
- if (auto* registration = container->registration(identifier))
- registration->setLastUpdateTime(lastUpdateTime);
- }
- });
- });
-
for (auto* document : Document::allDocuments()) {
if (auto* container = document->serviceWorkerContainer()) {
if (auto* registration = container->registration(identifier))
@@ -203,6 +195,15 @@
registration->setLastUpdateTime(lastUpdateTime);
}
}
+
+ forAllWorkers([identifier, lastUpdateTime] {
+ return [identifier, lastUpdateTime] (auto& context) {
+ if (auto* container = context.serviceWorkerContainer()) {
+ if (auto* registration = container->registration(identifier))
+ registration->setLastUpdateTime(lastUpdateTime);
+ }
+ };
+ });
}
void SWClientConnection::setRegistrationUpdateViaCache(ServiceWorkerRegistrationIdentifier identifier, ServiceWorkerUpdateViaCache updateViaCache)
@@ -209,15 +210,6 @@
{
ASSERT(isMainThread());
- SWContextManager::singleton().forEachServiceWorkerThread([identifier, updateViaCache] (auto& workerThread) {
- workerThread.thread().runLoop().postTask([identifier, updateViaCache](ScriptExecutionContext& context) {
- if (auto* container = context.serviceWorkerContainer()) {
- if (auto* registration = container->registration(identifier))
- registration->setUpdateViaCache(updateViaCache);
- }
- });
- });
-
for (auto* document : Document::allDocuments()) {
if (auto* container = document->serviceWorkerContainer()) {
if (auto* registration = container->registration(identifier))
@@ -224,6 +216,15 @@
registration->setUpdateViaCache(updateViaCache);
}
}
+
+ forAllWorkers([identifier, updateViaCache] {
+ return [identifier, updateViaCache] (auto& context) {
+ if (auto* container = context.serviceWorkerContainer()) {
+ if (auto* registration = container->registration(identifier))
+ registration->setUpdateViaCache(updateViaCache);
+ }
+ };
+ });
}
void SWClientConnection::notifyClientsOfControllerChange(const HashSet<ScriptExecutionContextIdentifier>& contextIdentifiers, ServiceWorkerData&& newController)
Modified: trunk/Source/WebCore/workers/service/ServiceWorker.idl (292721 => 292722)
--- trunk/Source/WebCore/workers/service/ServiceWorker.idl 2022-04-11 20:59:13 UTC (rev 292721)
+++ trunk/Source/WebCore/workers/service/ServiceWorker.idl 2022-04-11 21:16:16 UTC (rev 292722)
@@ -29,7 +29,7 @@
[
ActiveDOMObject,
SecureContext,
- Exposed=(Window,ServiceWorker),
+ Exposed=(Window,Worker),
Conditional=SERVICE_WORKER,
EnabledBySetting=ServiceWorkersEnabled,
ExportMacro=WEBCORE_EXPORT
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.idl (292721 => 292722)
--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.idl 2022-04-11 20:59:13 UTC (rev 292721)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.idl 2022-04-11 21:16:16 UTC (rev 292722)
@@ -29,7 +29,7 @@
[
ActiveDOMObject,
SecureContext,
- Exposed=(Window,ServiceWorker),
+ Exposed=(Window,Worker),
Conditional=SERVICE_WORKER,
EnabledBySetting=ServiceWorkersEnabled,
GenerateIsReachable=ReachableFromNavigator
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.idl (292721 => 292722)
--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.idl 2022-04-11 20:59:13 UTC (rev 292721)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.idl 2022-04-11 21:16:16 UTC (rev 292722)
@@ -29,7 +29,7 @@
[
ActiveDOMObject,
SecureContext,
- Exposed=(Window,ServiceWorker),
+ Exposed=(Window,Worker),
Conditional=SERVICE_WORKER,
EnabledBySetting=ServiceWorkersEnabled,
GenerateIsReachable=Impl,
Modified: trunk/Source/WebCore/workers/service/context/SWContextManager.cpp (292721 => 292722)
--- trunk/Source/WebCore/workers/service/context/SWContextManager.cpp 2022-04-11 20:59:13 UTC (rev 292721)
+++ trunk/Source/WebCore/workers/service/context/SWContextManager.cpp 2022-04-11 21:16:16 UTC (rev 292722)
@@ -177,10 +177,10 @@
});
}
-void SWContextManager::forEachServiceWorkerThread(const Function<void(ServiceWorkerThreadProxy&)>& apply)
+void SWContextManager::forEachServiceWorker(const Function<Function<void(ScriptExecutionContext&)>()>& createTask)
{
- for (auto& workerThread : m_workerMap.values())
- apply(workerThread);
+ for (auto& worker : m_workerMap.values())
+ worker->thread().runLoop().postTask(createTask());
}
bool SWContextManager::postTaskToServiceWorker(ServiceWorkerIdentifier identifier, Function<void(ServiceWorkerGlobalScope&)>&& task)
Modified: trunk/Source/WebCore/workers/service/context/SWContextManager.h (292721 => 292722)
--- trunk/Source/WebCore/workers/service/context/SWContextManager.h 2022-04-11 20:59:13 UTC (rev 292721)
+++ trunk/Source/WebCore/workers/service/context/SWContextManager.h 2022-04-11 21:16:16 UTC (rev 292722)
@@ -105,7 +105,7 @@
WEBCORE_EXPORT void terminateWorker(ServiceWorkerIdentifier, Seconds timeout, Function<void()>&&);
WEBCORE_EXPORT void didSaveScriptsToDisk(ServiceWorkerIdentifier, ScriptBuffer&&, HashMap<URL, ScriptBuffer>&& importedScripts);
- void forEachServiceWorkerThread(const Function<void(ServiceWorkerThreadProxy&)>&);
+ void forEachServiceWorker(const Function<Function<void(ScriptExecutionContext&)>()>&);
WEBCORE_EXPORT bool postTaskToServiceWorker(ServiceWorkerIdentifier, Function<void(ServiceWorkerGlobalScope&)>&&);
Modified: trunk/Source/WebCore/workers/shared/context/SharedWorkerContextManager.cpp (292721 => 292722)
--- trunk/Source/WebCore/workers/shared/context/SharedWorkerContextManager.cpp 2022-04-11 20:59:13 UTC (rev 292721)
+++ trunk/Source/WebCore/workers/shared/context/SharedWorkerContextManager.cpp 2022-04-11 21:16:16 UTC (rev 292722)
@@ -113,4 +113,10 @@
SharedWorkerContextManager::singleton().stopSharedWorker(sharedWorkerIdentifier);
}
+void SharedWorkerContextManager::forEachSharedWorker(const Function<Function<void(ScriptExecutionContext&)>()>& createTask)
+{
+ for (auto& worker : m_workerMap.values())
+ worker->thread().runLoop().postTask(createTask());
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/workers/shared/context/SharedWorkerContextManager.h (292721 => 292722)
--- trunk/Source/WebCore/workers/shared/context/SharedWorkerContextManager.h 2022-04-11 20:59:13 UTC (rev 292721)
+++ trunk/Source/WebCore/workers/shared/context/SharedWorkerContextManager.h 2022-04-11 21:16:16 UTC (rev 292722)
@@ -31,6 +31,7 @@
namespace WebCore {
+class ScriptExecutionContext;
class SharedWorkerThreadProxy;
class SharedWorkerContextManager {
@@ -65,6 +66,8 @@
WEBCORE_EXPORT void registerSharedWorkerThread(Ref<SharedWorkerThreadProxy>&&);
+ void forEachSharedWorker(const Function<Function<void(ScriptExecutionContext&)>()>&);
+
private:
friend class NeverDestroyed<SharedWorkerContextManager>;