[WebNN] Add "webnn" permissions policy feature#60418
Open
chromium-wpt-export-bot wants to merge 1 commit into
Open
[WebNN] Add "webnn" permissions policy feature#60418chromium-wpt-export-bot wants to merge 1 commit into
chromium-wpt-export-bot wants to merge 1 commit into
Conversation
9b2ae6c to
6c0f8ab
Compare
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}
6c0f8ab to
7746aac
Compare
wpt-pr-bot
approved these changes
Jun 5, 2026
Collaborator
wpt-pr-bot
left a comment
There was a problem hiding this comment.
The review process for this patch is being conducted in the Chromium project.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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}