commit 42a782f56c6ecbcc96a0bffdf561e8251217357f
parent eab20be72f44608a08e503aca35708d817324ee0
Author: Ravjit Uppal <ravjit@chromium.org>
Date: Wed, 3 Dec 2025 14:49:32 +0000
Bug 1997175 [wpt PR 55749] - [PEPC] Precise attribute is no longer set-once-only, a=testonly
Automatic update from web-platform-tests
[PEPC] Precise attribute is no longer set-once-only
Precise attribute can now be set and unset multiple times. This has no
side-effect the first time it is set, but every subsequent change to the
attribute, the permission element will be disabled for 500ms.
Bug: 452297243
Change-Id: Ia8c80a50dd37174451756d9f34d1f855a7e2ffa8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7056358
Reviewed-by: Joey Arhar <jarhar@chromium.org>
Reviewed-by: Andy Paicu <andypaicu@chromium.org>
Commit-Queue: Ravjit Uppal <ravjit@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1552848}
--
wpt-commits: 8dca6fa9a27f05c885cdb2a4f562c79f8a57b075
wpt-pr: 55749
Diffstat:
1 file changed, 53 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/tests/html/semantics/permission-element/precise-attribute-changed.html b/testing/web-platform/tests/html/semantics/permission-element/precise-attribute-changed.html
@@ -0,0 +1,53 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <title>Permission Element: invalid if precise attribute is changed</title>
+ <link rel="help" href="https://github.com/WICG/PEPC/blob/main/explainer.md" />
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script>
+ promise_test(async (t) => {
+ let is_element_valid = false;
+ const element = document.createElement("permission");
+ element.setAttribute("type", "geolocation");
+ element.onvalidationstatuschange = t.step_func(() => {
+ if (element.invalidReason == "") {
+ is_element_valid = true;
+ }
+ if ( element.invalidReason == "attribute_changed" ||
+ element.invalidReason == "intersection_changed") {
+ is_element_valid = false;
+ }
+ });
+ document.body.appendChild(element);
+
+ await t.step_wait(() => is_element_valid === true, "Wait for the element to be ready.");
+
+ // setting the preciselocation attribute should temporarily disable the element.
+ element.setAttribute("preciselocation", "");
+ await t.step_wait(
+ () => is_element_valid === false,
+ "Element should become invalid after preciselocation is set.",
+ );
+ await t.step_wait(
+ () => is_element_valid === true,
+ "Element should automatically become valid again after 500ms after the attribute is set.",
+ );
+
+ // uusetting the preciselocation attribute should temporarily disable the element.
+ element.removeAttribute("preciselocation");
+ await t.step_wait(
+ () => is_element_valid === false,
+ "Element should become invalid after preciselocation is unset.",
+ );
+ await t.step_wait(
+ () => is_element_valid === true,
+ "Element should automatically become valid again after 500ms after the attribute is unset.",
+ );
+ }, "Permission element is invalid temporarily if the precise attribute is changed.");
+ </script>
+ </body>
+</html>