Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hasUnpartitionedCookieAccess #33329

Merged
merged 33 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1e2e976
Create index.md
arichiv Apr 30, 2024
cc5574b
content
arichiv Apr 30, 2024
4e63c08
new spec
arichiv Apr 30, 2024
e091aa1
Merge branch 'main' into patch-2
arichiv Apr 30, 2024
d1cb572
Merge branch 'main' into patch-2
arichiv Apr 30, 2024
dd6550c
Merge branch 'main' into patch-2
arichiv Apr 30, 2024
ffe26a8
Merge branch 'main' into patch-2
arichiv May 1, 2024
97336b4
Merge branch 'main' into patch-2
arichiv May 1, 2024
e6bb8bd
Merge branch 'main' into patch-2
arichiv May 1, 2024
505efee
Merge branch 'main' into patch-2
arichiv May 2, 2024
188c4b9
Merge branch 'main' into patch-2
arichiv May 2, 2024
cac2acc
Merge branch 'main' into patch-2
arichiv May 2, 2024
5992456
Merge branch 'main' into patch-2
arichiv May 2, 2024
0d2f9ce
Merge branch 'main' into patch-2
arichiv May 3, 2024
263cfe2
fix
arichiv May 3, 2024
452e72c
fix
arichiv May 3, 2024
48a2791
fix
arichiv May 5, 2024
2ea98d1
Merge branch 'main' into patch-2
arichiv May 5, 2024
687c25c
Merge branch 'main' into patch-2
arichiv May 6, 2024
03be72c
Merge branch 'main' into patch-2
arichiv May 7, 2024
2146126
Merge branch 'main' into patch-2
arichiv May 13, 2024
ba29b9d
Merge branch 'main' into patch-2
arichiv May 14, 2024
b9d62a0
Merge branch 'main' into patch-2
arichiv May 15, 2024
c5dcf18
Merge branch 'main' into patch-2
arichiv May 16, 2024
3cedfd2
Merge branch 'main' into patch-2
arichiv May 17, 2024
ba57632
Merge branch 'main' into patch-2
arichiv May 20, 2024
8ddd76c
Merge branch 'main' into patch-2
arichiv May 21, 2024
3d7e960
Update index.md
arichiv May 21, 2024
4aac6c8
Update index.md
arichiv May 21, 2024
f4fca91
Update index.md
arichiv May 21, 2024
f43e2da
Merge branch 'main' into patch-2
arichiv May 21, 2024
82e3871
Update index.md
arichiv May 21, 2024
e524cd2
Merge branch 'main' into patch-2
arichiv May 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion files/en-us/web/api/document/hasstorageaccess/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ The **`hasStorageAccess()`** method of the {{domxref("Document")}} interface ret

This method is part of the [Storage Access API](/en-US/docs/Web/API/Storage_Access_API).

This method is another name for {{DOMxRef("Document.hasUnpartitionedCookieAccess()")}}.

There are no current plans to remove this method in favor of {{DOMxRef("Document.hasUnpartitionedCookieAccess()")}}.
arichiv marked this conversation as resolved.
Show resolved Hide resolved

## Syntax

```js-nolint
Expand Down Expand Up @@ -44,9 +48,11 @@ The result returned by this method can be inaccurate in a couple of circumstance
document.hasStorageAccess().then((hasAccess) => {
if (hasAccess) {
// storage access has been granted already.
console.log("cookie access granted");
} else {
// storage access hasn't been granted already;
// you may want to call requestStorageAccess().
console.log("cookie access denied");
}
});
```
Expand All @@ -63,6 +69,6 @@ document.hasStorageAccess().then((hasAccess) => {

## See also

- {{domxref("Document.requestStorageAccess()")}}, {{domxref("Document.requestStorageAccessFor()")}}
- {{domxref("Document.hasUnpartitionedCookieAccess()")}}, {{domxref("Document.requestStorageAccess()")}}, {{domxref("Document.requestStorageAccessFor()")}}
- [Using the Storage Access API](/en-US/docs/Web/API/Storage_Access_API/Using)
- [Introducing Storage Access API](https://webkit.org/blog/8124/introducing-storage-access-api/) (WebKit blog)
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
title: "Document: hasUnpartitionedCookieAccess() method"
short-title: hasUnpartitionedCookieAccess()
slug: Web/API/Document/hasUnpartitionedCookieAccess
page-type: web-api-instance-method
browser-compat: api.Document.hasUnpartitionedCookieAccess
---

arichiv marked this conversation as resolved.
Show resolved Hide resolved
{{APIRef("Storage Access API")}}

The **`hasUnpartitionedCookieAccess()`** method of the {{domxref("Document")}} interface returns a {{jsxref("Promise")}} that resolves with a boolean value indicating whether the document has access to [third-party](/en-US/docs/Web/HTTP/Cookies#third-party_cookies), [unpartitioned](/en-US/docs/Web/API/Storage_Access_API#unpartitioned_versus_partitioned_cookies) cookies.

This method is part of the [Storage Access API](/en-US/docs/Web/API/Storage_Access_API).

This method is a new name for {{DOMxRef("Document.hasStorageAccess()")}}.

## Syntax

```js-nolint
hasUnpartitionedCookieAccess()
```

### Parameters

None.

### Return value

A {{jsxref("Promise")}} that resolves with a boolean value indicating whether the document has access to third-party cookies — `true` if it does, and `false` if not.

See {{DOMxRef("Document.hasStorageAccess()")}} for more details.

### Exceptions

- `InvalidStateError` {{domxref("DOMException")}}
- : Thrown if the current {{domxref("Document")}} is not yet active.

## Examples

```js
document.hasUnpartitionedCookieAccess().then((hasAccess) => {
if (hasAccess) {
// storage access has been granted already.
console.log("cookie access granted");
} else {
// storage access hasn't been granted already;
// you may want to call requestStorageAccess().
console.log("cookie access denied");
}
});
```

> **Note:** See [Using the Storage Access API](/en-US/docs/Web/API/Storage_Access_API/Using) for a more complete example.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("Document.hasStorageAccess()")}}, {{domxref("Document.requestStorageAccess()")}}, {{domxref("Document.requestStorageAccessFor()")}}
- [Using the Storage Access API](/en-US/docs/Web/API/Storage_Access_API/Using)
- [Introducing Storage Access API](https://webkit.org/blog/8124/introducing-storage-access-api/) (WebKit blog)
2 changes: 2 additions & 0 deletions files/en-us/web/api/document/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ _This interface also inherits from the {{DOMxRef("Node")}} and {{DOMxRef("EventT
- : Returns a {{DOMxRef('Selection')}} object representing the range of text selected by the user, or the current position of the caret.
- {{DOMxRef("Document.hasStorageAccess()")}}
- : Returns a {{jsxref("Promise")}} that resolves with a boolean value indicating whether the document has access to unpartitioned cookies.
- {{DOMxRef("Document.hasUnpartitionedCookieAccess()")}}
- : New name for {{DOMxRef("Document.hasStorageAccess()")}}.
- {{DOMxRef("Document.importNode()")}}
- : Returns a clone of a node from an external document.
- {{DOMxRef("Document.mozSetImageElement()")}} {{Non-standard_Inline}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ document.requestStorageAccess().then(

## See also

- {{domxref("Document.hasStorageAccess()")}}, {{domxref("Document.requestStorageAccessFor()")}}
- {{domxref("Document.hasStorageAccess()")}}, {{domxref("Document.hasUnpartitionedCookieAccess()")}}, {{domxref("Document.requestStorageAccessFor()")}}
- [Using the Storage Access API](/en-US/docs/Web/API/Storage_Access_API/Using)
- [Introducing Storage Access API](https://webkit.org/blog/8124/introducing-storage-access-api/) (WebKit blog)
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,6 @@ function checkCookie() {

## See also

- {{domxref("Document.hasStorageAccess()")}}, {{domxref("Document.requestStorageAccess()")}}
- {{domxref("Document.hasStorageAccess()")}}, {{domxref("Document.hasUnpartitionedCookieAccess()")}}, {{domxref("Document.requestStorageAccess()")}}
- [Using the Storage Access API](/en-US/docs/Web/API/Storage_Access_API/Using)
- [Introducing Storage Access API](https://webkit.org/blog/8124/introducing-storage-access-api/) (WebKit blog)
7 changes: 6 additions & 1 deletion files/en-us/web/api/storage_access_api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ slug: Web/API/Storage_Access_API
page-type: web-api-overview
browser-compat:
- api.Document.hasStorageAccess
- api.Document.hasUnpartitionedCookieAccess
- api.Document.requestStorageAccess
- api.Document.requestStorageAccessFor
- api.Permissions.permission_storage-access
spec-urls: https://privacycg.github.io/storage-access/
spec-urls:
- https://privacycg.github.io/storage-access/
- https://privacycg.github.io/saa-non-cookie-storage/
---

{{DefaultAPISidebar("Storage Access API")}}
Expand Down Expand Up @@ -118,6 +121,8 @@ Documentation for Firefox's new storage access policy for blocking tracking cook

- {{domxref("Document.hasStorageAccess()")}}
- : Returns a {{jsxref("Promise")}} that resolves with a boolean value indicating whether the document has access to third-party cookies.
- {{domxref("Document.hasUnpartitionedCookieAccess()")}}
- : New name for {{domxref("Document.hasStorageAccess()")}}.
- {{domxref("Document.requestStorageAccess()")}}
- : Allows content loaded in a third-party context (i.e., embedded in an {{htmlelement("iframe")}}) to request access to third-party cookies; returns a {{jsxref("Promise")}} that resolves if the access was granted, and rejects if access was denied.
- {{domxref("Document.requestStorageAccessFor()")}} {{experimental_inline}}
Expand Down
1 change: 1 addition & 0 deletions files/jsondata/GroupData.json
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,7 @@
"interfaces": [],
"methods": [
"Document.hasStorageAccess()",
"Document.hasUnpartitionedCookieAccess()",
"Document.requestStorageAccess()",
"Document.requestStorageAccessFor()"
],
Expand Down