[Maintenance] Rename setup3pIframe() to reflect non-3p contexts
The ServiceWorker WPT resource helper function setup3pIframe()
was recently used in non-3p contexts. This is a simple renaming
refactor to reflect this new context.
Change-Id: I489dfb5a769d7d4c73078597b647f0245614a60e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3615312
Commit-Queue: Kyra Seevers <kyraseevers@chromium.org>
Reviewed-by: Steven Bingler <bingler@chromium.org>
Cr-Commit-Position: refs/heads/main@{#999085}
diff --git a/service-workers/service-worker/resources/partitioned-service-worker-iframe-claim.html b/service-workers/service-worker/resources/partitioned-service-worker-iframe-claim.html
index 8135d27..12b048e 100644
--- a/service-workers/service-worker/resources/partitioned-service-worker-iframe-claim.html
+++ b/service-workers/service-worker/resources/partitioned-service-worker-iframe-claim.html
@@ -26,7 +26,7 @@
// 3p mode will tell its SW to claim and then postMessage its results
// automatically.
async function onLoad3pMode() {
- reg = await setup3pIframe();
+ reg = await setupServiceWorker();
if(navigator.serviceWorker.controller != null){
//This iframe is already under control of a service worker, testing for
diff --git a/service-workers/service-worker/resources/partitioned-service-worker-nested-iframe-child.html b/service-workers/service-worker/resources/partitioned-service-worker-nested-iframe-child.html
index 5dd58f3..0362b58 100644
--- a/service-workers/service-worker/resources/partitioned-service-worker-nested-iframe-child.html
+++ b/service-workers/service-worker/resources/partitioned-service-worker-nested-iframe-child.html
@@ -16,7 +16,7 @@
async function onLoad() {
// Set-up the ServiceWorker for this iframe.
- await setup3pIframe();
+ await setupServiceWorker();
// When the SW's iframe finishes it'll post a message. This forwards
// it up to the middle-iframe.
diff --git a/service-workers/service-worker/resources/partitioned-service-worker-third-party-iframe-getRegistrations.html b/service-workers/service-worker/resources/partitioned-service-worker-third-party-iframe-getRegistrations.html
index 4aceb56..747c058 100644
--- a/service-workers/service-worker/resources/partitioned-service-worker-third-party-iframe-getRegistrations.html
+++ b/service-workers/service-worker/resources/partitioned-service-worker-third-party-iframe-getRegistrations.html
@@ -15,7 +15,7 @@
const scope = './partitioned-'
const absoluteScope = new URL(scope, window.location).href;
- await setup3pIframe();
+ await setupServiceWorker();
// Once the SW sends us its ID, forward it up to the window.
navigator.serviceWorker.addEventListener('message', evt => {
diff --git a/service-workers/service-worker/resources/partitioned-service-worker-third-party-iframe-matchAll.html b/service-workers/service-worker/resources/partitioned-service-worker-third-party-iframe-matchAll.html
index 8be1210..7a2c366 100644
--- a/service-workers/service-worker/resources/partitioned-service-worker-third-party-iframe-matchAll.html
+++ b/service-workers/service-worker/resources/partitioned-service-worker-third-party-iframe-matchAll.html
@@ -11,7 +11,7 @@
SW's response up, eventually, to the test.
<script>
async function onLoad() {
- reg = await setup3pIframe();
+ reg = await setupServiceWorker();
// Once the SW sends us its ID, forward it up to the window.
navigator.serviceWorker.addEventListener('message', evt => {
diff --git a/service-workers/service-worker/resources/partitioned-service-worker-third-party-iframe.html b/service-workers/service-worker/resources/partitioned-service-worker-third-party-iframe.html
index 624a8e2..1b7f671 100644
--- a/service-workers/service-worker/resources/partitioned-service-worker-third-party-iframe.html
+++ b/service-workers/service-worker/resources/partitioned-service-worker-third-party-iframe.html
@@ -12,7 +12,7 @@
<script>
async function onLoad() {
- await setup3pIframe();
+ await setupServiceWorker();
// When the SW's iframe finishes it'll post a message. This forwards it up to
// the window.
diff --git a/service-workers/service-worker/resources/partitioned-utils.js b/service-workers/service-worker/resources/partitioned-utils.js
index 5d9b4e2..22e90be 100644
--- a/service-workers/service-worker/resources/partitioned-utils.js
+++ b/service-workers/service-worker/resources/partitioned-utils.js
@@ -57,8 +57,10 @@
return message_promise;
}
-// 3p iframe utilities
-async function setup3pIframe() {
+// Checks for an existing service worker registration. If not present,
+// registers and maintains a service worker. Used in windows or iframes
+// that will be partitioned from the main frame.
+async function setupServiceWorker() {
const script = './partitioned-storage-sw.js';
const scope = './partitioned-';