Skip to content

Commit 870673e

Browse files
authored
Suggestion to add Permission Policy and Worker note
Analog to the other APIs (e.g., the [Prompt API](https://github.com/webmachinelearning/prompt-api?tab=readme-ov-file#permissions-policy-iframes-and-workers)), this API will likely integrate with Permission Policy.
1 parent 2870e45 commit 870673e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ if (inputRenderIndex !== input.length){
242242
243243
### Full API surface in Web IDL
244244
```js
245-
[Exposed=(Window,Worker), SecureContext]
245+
[Exposed=Window, SecureContext]
246246
interface Proofreader {
247247
static Promise<Proofreader> create(optional ProofreaderCreateOptions options = {});
248248
static Promise<AIAvailability> availability(optional ProofreaderCreateCoreOptions options = {});
@@ -305,6 +305,18 @@ enum CorrectionType {
305305
};
306306
```
307307
308+
## Permissions policy, iframes, and workers
309+
310+
By default, this API is only available to top-level `Window`s, and to their same-origin iframes. Access to the API can be delegated to cross-origin iframes using the [Permissions Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Permissions_Policy) `allow=""` attribute:
311+
312+
```html
313+
<iframe src="https://example.com/" allow="proofreader"></iframe>
314+
```
315+
316+
This API is currently not available in workers, due to the complexity of establishing a responsible document for each worker in order to check the permissions policy status. See [this discussion](https://github.com/webmachinelearning/translation-api/issues/18#issuecomment-2705630392) for more. It may be possible to loosen this restriction over time, if use cases arise.
317+
318+
Note that although the API is not exposed to web platform workers, a browser could expose them to extension service workers, which are outside the scope of web platform specifications and have a different permissions model.
319+
308320
## Alternatives considered and under consideration
309321
310322
### Provide explanations only asynchronously

0 commit comments

Comments
 (0)