Skip to content

[WebNN] Add "webnn" permissions policy feature#60418

Open
chromium-wpt-export-bot wants to merge 1 commit into
masterfrom
chromium-export-cl-7885337
Open

[WebNN] Add "webnn" permissions policy feature#60418
chromium-wpt-export-bot wants to merge 1 commit into
masterfrom
chromium-export-cl-7885337

Conversation

@chromium-wpt-export-bot
Copy link
Copy Markdown
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Jun 5, 2026

Implement the "webnn" policy-controlled feature as specified in the
WebNN specification [1]. The default allowlist is 'self', which means
the WebNN API is available to top-level documents and same-origin
iframes by default, but blocked in cross-origin iframes unless
explicitly granted via the Permissions-Policy header or iframe allow
attribute.

When the feature is disabled, navigator.ml.createContext() rejects
with a "SecurityError" DOMException per the spec.

This CL also changes the WebIDL to only expose the WebNN interfaces
to DedicatedWorker and updates related WPTs.

[1] https://www.w3.org/TR/webnn/#permissions-policy-integration

Bug: 502083483
Change-Id: I5c723e0ea03864fd0b122aed8b3d31f602545a2e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7885337
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Kent Tamura <tkent@chromium.org>
Reviewed-by: Steven Holte <holte@chromium.org>
Commit-Queue: Wang, Wei4 <wei4.wang@intel.com>
Cr-Commit-Position: refs/heads/main@{#1642237}

Implement the "webnn" policy-controlled feature as specified in the
WebNN specification [1]. The default allowlist is 'self', which means
the WebNN API is available to top-level documents and same-origin
iframes by default, but blocked in cross-origin iframes unless
explicitly granted via the Permissions-Policy header or iframe allow
attribute.

When the feature is disabled, navigator.ml.createContext() rejects
with a "SecurityError" DOMException per the spec.

This CL also changes the WebIDL to only expose the WebNN interfaces
to DedicatedWorker and updates related WPTs.

[1] https://www.w3.org/TR/webnn/#permissions-policy-integration

Bug: 502083483
Change-Id: I5c723e0ea03864fd0b122aed8b3d31f602545a2e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7885337
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Kent Tamura <tkent@chromium.org>
Reviewed-by: Steven Holte <holte@chromium.org>
Commit-Queue: Wang, Wei4 <wei4.wang@intel.com>
Cr-Commit-Position: refs/heads/main@{#1642237}
Copy link
Copy Markdown
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants