From 7ffe5b8a432465cbb117c388047b9b8c1490eaa1 Mon Sep 17 00:00:00 2001 From: Shuran Huang Date: Fri, 23 Jun 2023 08:49:25 -0700 Subject: [PATCH] Include unpartitioned cookie availability check in hasStorageAccess() This change is based on spec PR https://github.com/privacycg/storage-access/pull/174. Bug: 1433013 Change-Id: I6c29b2a2afddb288d40d946040dc73fbe76b6fcb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4611289 Reviewed-by: Mason Freed Commit-Queue: Shuran Huang Reviewed-by: Chris Fredrickson Cr-Commit-Position: refs/heads/main@{#1161766} --- storage-access-api/hasStorageAccess.sub.https.window.js | 3 +++ .../resources/hasStorageAccess-ABA-iframe.https.html | 2 ++ .../resources/hasStorageAccess-ABA-iframe.sub.https.window.js | 2 ++ .../resources/hasStorageAccess-iframe.https.html | 2 ++ 4 files changed, 9 insertions(+) diff --git a/storage-access-api/hasStorageAccess.sub.https.window.js b/storage-access-api/hasStorageAccess.sub.https.window.js index d7ed42baa0da9e..0efc687199a92c 100644 --- a/storage-access-api/hasStorageAccess.sub.https.window.js +++ b/storage-access-api/hasStorageAccess.sub.https.window.js @@ -1,4 +1,6 @@ // META: script=helpers.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js 'use strict'; const {testPrefix, topLevelDocument} = processQueryParams(); @@ -9,6 +11,7 @@ promise_test(async () => { }, "[" + testPrefix + "] document.hasStorageAccess() should exist on the document interface"); promise_test(async () => { + await MaybeSetStorageAccess("*", "*", "blocked"); const hasAccess = await document.hasStorageAccess(); if (topLevelDocument || testPrefix.includes('same-origin')) { assert_true(hasAccess, "Access should be granted in top-level frame or iframe that is in first-party context by default."); diff --git a/storage-access-api/resources/hasStorageAccess-ABA-iframe.https.html b/storage-access-api/resources/hasStorageAccess-ABA-iframe.https.html index c9f23f02ac2e4f..fdceefc0ab83be 100644 --- a/storage-access-api/resources/hasStorageAccess-ABA-iframe.https.html +++ b/storage-access-api/resources/hasStorageAccess-ABA-iframe.https.html @@ -2,6 +2,8 @@ + + \ No newline at end of file diff --git a/storage-access-api/resources/hasStorageAccess-ABA-iframe.sub.https.window.js b/storage-access-api/resources/hasStorageAccess-ABA-iframe.sub.https.window.js index 126ae002010fa8..d6227ee47eba27 100644 --- a/storage-access-api/resources/hasStorageAccess-ABA-iframe.sub.https.window.js +++ b/storage-access-api/resources/hasStorageAccess-ABA-iframe.sub.https.window.js @@ -1,4 +1,6 @@ // META: script=../helpers.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js 'use strict'; // This expects to be run in an iframe that is cross-site to the top-level frame. diff --git a/storage-access-api/resources/hasStorageAccess-iframe.https.html b/storage-access-api/resources/hasStorageAccess-iframe.https.html index 95169503c2a846..46194adcf80410 100644 --- a/storage-access-api/resources/hasStorageAccess-iframe.https.html +++ b/storage-access-api/resources/hasStorageAccess-iframe.https.html @@ -2,6 +2,8 @@ + +