Title: [290156] trunk
Revision
290156
Author
cdu...@apple.com
Date
2022-02-18 12:58:46 -0800 (Fri, 18 Feb 2022)

Log Message

ServiceWorkerGlobalScope+PushAPI requires PushAPIEnabled
https://bugs.webkit.org/show_bug.cgi?id=236846

Patch by Sam Sneddon <gsnedd...@apple.com> on 2022-02-18
Reviewed by Chris Dumez.

Source/WebCore:

Tests: http/wpt/push-api/onpush-disabled.html
       http/wpt/push-api/onpush-enabled.html

* Modules/push-api/ServiceWorkerGlobalScope+PushAPI.idl:

LayoutTests:

* http/wpt/push-api/onpush-disabled-expected.txt: Added.
* http/wpt/push-api/onpush-disabled.html: Added.
* http/wpt/push-api/onpush-disabled.js: Added.
(test):
* http/wpt/push-api/onpush-enabled-expected.txt: Added.
* http/wpt/push-api/onpush-enabled.html: Added.
* http/wpt/push-api/onpush-enabled.js: Added.
(test):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (290155 => 290156)


--- trunk/LayoutTests/ChangeLog	2022-02-18 20:42:39 UTC (rev 290155)
+++ trunk/LayoutTests/ChangeLog	2022-02-18 20:58:46 UTC (rev 290156)
@@ -1,3 +1,19 @@
+2022-02-18  Sam Sneddon  <gsnedd...@apple.com>
+
+        ServiceWorkerGlobalScope+PushAPI requires PushAPIEnabled
+        https://bugs.webkit.org/show_bug.cgi?id=236846
+
+        Reviewed by Chris Dumez.
+
+        * http/wpt/push-api/onpush-disabled-expected.txt: Added.
+        * http/wpt/push-api/onpush-disabled.html: Added.
+        * http/wpt/push-api/onpush-disabled.js: Added.
+        (test):
+        * http/wpt/push-api/onpush-enabled-expected.txt: Added.
+        * http/wpt/push-api/onpush-enabled.html: Added.
+        * http/wpt/push-api/onpush-enabled.js: Added.
+        (test):
+
 2022-02-18  Jon Lee  <jon...@apple.com>
 
         Follow up to b236802. Unreviewed.

Added: trunk/LayoutTests/http/wpt/push-api/onpush-disabled-expected.txt (0 => 290156)


--- trunk/LayoutTests/http/wpt/push-api/onpush-disabled-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/onpush-disabled-expected.txt	2022-02-18 20:58:46 UTC (rev 290156)
@@ -0,0 +1,4 @@
+
+PASS onpush should not be exposed on ServiceWorkerGlobalScope
+PASS onpushsubscriptionchange should not be exposed on ServiceWorkerGlobalScope
+

Added: trunk/LayoutTests/http/wpt/push-api/onpush-disabled.html (0 => 290156)


--- trunk/LayoutTests/http/wpt/push-api/onpush-disabled.html	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/onpush-disabled.html	2022-02-18 20:58:46 UTC (rev 290156)
@@ -0,0 +1,16 @@
+<!-- webkit-test-runner [ PushAPIEnabled=false ] -->
+<!doctype html>
+<meta charset=utf-8>
+
+<script src=""
+<script src=""
+<div id=log></div>
+<script>
+(async function() {
+  const scope = 'does/not/exist';
+  let reg = await navigator.serviceWorker.getRegistration(scope);
+  if (reg) await reg.unregister();
+  reg = await navigator.serviceWorker.register("onpush-disabled.js", {scope});
+  fetch_tests_from_worker(reg.installing);
+})();
+</script>

Added: trunk/LayoutTests/http/wpt/push-api/onpush-disabled.js (0 => 290156)


--- trunk/LayoutTests/http/wpt/push-api/onpush-disabled.js	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/onpush-disabled.js	2022-02-18 20:58:46 UTC (rev 290156)
@@ -0,0 +1,9 @@
+importScripts("/resources/testharness.js");
+
+test(() => {
+    assert_false("onpush" in self);
+}, "onpush should not be exposed on ServiceWorkerGlobalScope");
+
+test(() => {
+    assert_false("onpushsubscriptionchange" in self);
+}, "onpushsubscriptionchange should not be exposed on ServiceWorkerGlobalScope");

Added: trunk/LayoutTests/http/wpt/push-api/onpush-enabled-expected.txt (0 => 290156)


--- trunk/LayoutTests/http/wpt/push-api/onpush-enabled-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/onpush-enabled-expected.txt	2022-02-18 20:58:46 UTC (rev 290156)
@@ -0,0 +1,4 @@
+
+PASS onpush should be exposed on ServiceWorkerGlobalScope
+PASS onpushsubscriptionchange should be exposed on ServiceWorkerGlobalScope
+

Added: trunk/LayoutTests/http/wpt/push-api/onpush-enabled.html (0 => 290156)


--- trunk/LayoutTests/http/wpt/push-api/onpush-enabled.html	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/onpush-enabled.html	2022-02-18 20:58:46 UTC (rev 290156)
@@ -0,0 +1,16 @@
+<!-- webkit-test-runner [ PushAPIEnabled=true ] -->
+<!doctype html>
+<meta charset=utf-8>
+
+<script src=""
+<script src=""
+<div id=log></div>
+<script>
+(async function() {
+  const scope = 'does/not/exist';
+  let reg = await navigator.serviceWorker.getRegistration(scope);
+  if (reg) await reg.unregister();
+  reg = await navigator.serviceWorker.register("onpush-enabled.js", {scope});
+  fetch_tests_from_worker(reg.installing);
+})();
+</script>

Added: trunk/LayoutTests/http/wpt/push-api/onpush-enabled.js (0 => 290156)


--- trunk/LayoutTests/http/wpt/push-api/onpush-enabled.js	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/push-api/onpush-enabled.js	2022-02-18 20:58:46 UTC (rev 290156)
@@ -0,0 +1,9 @@
+importScripts("/resources/testharness.js");
+
+test(() => {
+    assert_true("onpush" in self);
+}, "onpush should be exposed on ServiceWorkerGlobalScope");
+
+test(() => {
+    assert_true("onpushsubscriptionchange" in self);
+}, "onpushsubscriptionchange should be exposed on ServiceWorkerGlobalScope");

Modified: trunk/Source/WebCore/ChangeLog (290155 => 290156)


--- trunk/Source/WebCore/ChangeLog	2022-02-18 20:42:39 UTC (rev 290155)
+++ trunk/Source/WebCore/ChangeLog	2022-02-18 20:58:46 UTC (rev 290156)
@@ -1,3 +1,15 @@
+2022-02-18  Sam Sneddon  <gsnedd...@apple.com>
+
+        ServiceWorkerGlobalScope+PushAPI requires PushAPIEnabled
+        https://bugs.webkit.org/show_bug.cgi?id=236846
+
+        Reviewed by Chris Dumez.
+
+        Tests: http/wpt/push-api/onpush-disabled.html
+               http/wpt/push-api/onpush-enabled.html
+
+        * Modules/push-api/ServiceWorkerGlobalScope+PushAPI.idl:
+
 2022-02-18  Mark Lam  <mark....@apple.com>
 
         Fix copy-paste error in r290129.

Modified: trunk/Source/WebCore/Modules/push-api/ServiceWorkerGlobalScope+PushAPI.idl (290155 => 290156)


--- trunk/Source/WebCore/Modules/push-api/ServiceWorkerGlobalScope+PushAPI.idl	2022-02-18 20:42:39 UTC (rev 290155)
+++ trunk/Source/WebCore/Modules/push-api/ServiceWorkerGlobalScope+PushAPI.idl	2022-02-18 20:58:46 UTC (rev 290156)
@@ -24,7 +24,8 @@
  */
 
 [
-    EnabledAtRuntime=ServiceWorkerEnabled
+    Conditional=SERVICE_WORKER,
+    EnabledAtRuntime=ServiceWorkerEnabled&PushAPIEnabled
 ] partial interface ServiceWorkerGlobalScope {
     attribute EventHandler onpush;
     attribute EventHandler onpushsubscriptionchange;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to