Skip to content

Commit 56e837d

Browse files
authored
Adapt tests to the updated navigator.cookieEnabled behavior. (#18)
Chromium change: commit 2c885728f29b653f404e6a42da86b19e055def72 Author: Ari Chivukula <[email protected]> Date: Mon May 6 20:03:59 2024 +0000 [CookieEnabled] Align with spec navigator.cookieEnabled currently indicates if “the user agent attempts to handle cookies” in a given context. A change in Chrome, shipping as part of third-party cookie deprecation (3PCD), would cause it to indicate whether unpartitioned cookie access is possible (causing it to return false in most cross-site iframes). We should restore the prior behavior of navigator.cookieEnabled which indicated only if cookies were enabled/disabled for the site and rely on the cross-vendor function document.hasStorageAccess to indicate if unpartitioned cookie access is possible. whatwg/html#10256 https://chromestatus.com/feature/6227655153418240 https://groups.google.com/a/chromium.org/g/blink-dev/c/xU3gTW4aTfg Bug: 335553590 Change-Id: I6cc1f2a9caea6220b6f85240ae9875a65a91d179 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5464207 Commit-Queue: Daniel Cheng <[email protected]> Auto-Submit: Ari Chivukula <[email protected]> Reviewed-by: Jonathan Njeunje <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Cr-Commit-Position: refs/heads/main@{#1297071}
1 parent 69c8f9f commit 56e837d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

static/js/frames/ephemeral-storage.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
const clearStorage = async key => {
3232
const result = Object.create(null)
3333
try {
34-
if (W.navigator.cookieEnabled === false) {
34+
if (W.navigator.cookieEnabled === false || !await W.document.hasStorageAccess()) {
3535
result['dom-cookies'] = exceptionEncoding
3636
} else {
3737
C.remove(key, {
@@ -71,7 +71,7 @@
7171
const readStorageAction = async key => {
7272
const result = Object.create(null)
7373
try {
74-
if (W.navigator.cookieEnabled === false) {
74+
if (W.navigator.cookieEnabled === false || !await W.document.hasStorageAccess()) {
7575
result['dom-cookies'] = exceptionEncoding
7676
} else {
7777
const readCookieValue = C.get(key)
@@ -106,7 +106,7 @@
106106
const writeStorageAction = async (key, value) => {
107107
const result = Object.create(null)
108108
try {
109-
if (W.navigator.cookieEnabled === false) {
109+
if (W.navigator.cookieEnabled === false || !await W.document.hasStorageAccess()) {
110110
result['dom-cookies'] = false
111111
} else {
112112
C.set(key, value, {

0 commit comments

Comments
 (0)