Skip to content

Commit eab602d

Browse files
Ravjit Uppalchromium-wpt-export-bot
authored andcommitted
[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
1 parent e27546d commit eab602d

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Permission Element: invalid if precise attribute is changed</title>
6+
<link rel="help" href="https://github.com/WICG/PEPC/blob/main/explainer.md" />
7+
<script src="/resources/testharness.js"></script>
8+
<script src="/resources/testharnessreport.js"></script>
9+
</head>
10+
<body>
11+
<script>
12+
promise_test(async (t) => {
13+
let is_element_valid = false;
14+
const element = document.createElement("permission");
15+
element.setAttribute("type", "geolocation");
16+
element.onvalidationstatuschange = t.step_func(() => {
17+
if (element.invalidReason == "") {
18+
is_element_valid = true;
19+
}
20+
if (element.invalidReason == "attribute_changed") {
21+
is_element_valid = false;
22+
}
23+
});
24+
document.body.appendChild(element);
25+
26+
// wait for the element to be ready.
27+
await t.step_wait(() => is_element_valid === true);
28+
29+
// setting the preciselocation attribute should temporarily disable the element.
30+
element.setAttribute("preciselocation", "");
31+
await t.step_wait(() => is_element_valid === false);
32+
await t.step_wait(() => is_element_valid === true);
33+
34+
// uusetting the preciselocation attribute should temporarily disable the element.
35+
element.removeAttribute("preciselocation");
36+
await t.step_wait(() => is_element_valid === false);
37+
await t.step_wait(() => is_element_valid === true);
38+
}, "Permission element is invalid temporarily if the precise attribute is changed.");
39+
</script>
40+
</body>
41+
</html>

0 commit comments

Comments
 (0)