Skip to content

Commit

Permalink
Make closeWatcher.requestClose() not require user activation
Browse files Browse the repository at this point in the history
Per the conversation here:

openui/open-ui#1128 (comment)

There's a desire to ship closeWatcher.requestClose() along with
dialog.requestclose() both not requiring user activation.

The spec PR has been updated accordingly:
whatwg/html#10737

(in this commit:
whatwg/html@76619aa)

Fixed: 383593252
Change-Id: I8c05e352d8b4964407a1cee36f35372e192e2ca5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6092173
Auto-Submit: Mason Freed <[email protected]>
Reviewed-by: David Baron <[email protected]>
Reviewed-by: Mason Freed <[email protected]>
Commit-Queue: Mason Freed <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1396007}
  • Loading branch information
mfreed7 authored and chromium-wpt-export-bot committed Dec 13, 2024
1 parent 24f3b8d commit c669093
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions close-watcher/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

watcher.requestClose();

assert_array_equals(events, ["cancel[cancelable=false]", "close"]);
assert_array_equals(events, ["cancel[cancelable=true]", "close"]);
}, "requestClose() with no user activation");

test(t => {
Expand Down Expand Up @@ -43,10 +43,10 @@
let watcher = createRecordingCloseWatcher(t, events);

watcher.requestClose();
assert_array_equals(events, ["cancel[cancelable=false]", "close"]);
assert_array_equals(events, ["cancel[cancelable=true]", "close"]);

watcher.destroy();
assert_array_equals(events, ["cancel[cancelable=false]", "close"]);
assert_array_equals(events, ["cancel[cancelable=true]", "close"]);
}, "requestClose() then destroy()");

test(t => {
Expand Down
12 changes: 6 additions & 6 deletions close-watcher/inside-event-listeners.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
watcher.onclose = () => { watcher.destroy(); }

watcher.requestClose();
assert_array_equals(events, ["cancel[cancelable=false]", "close"]);
assert_array_equals(events, ["cancel[cancelable=true]", "close"]);

watcher.requestClose();
assert_array_equals(events, ["cancel[cancelable=false]", "close"], "since it was inactive, no more events fired");
assert_array_equals(events, ["cancel[cancelable=true]", "close"], "since it was inactive, no more events fired");
}, "destroy() inside onclose");

promise_test(async t => {
Expand All @@ -58,10 +58,10 @@
watcher.onclose = () => { watcher.close(); }

watcher.requestClose();
assert_array_equals(events, ["cancel[cancelable=false]", "close"]);
assert_array_equals(events, ["cancel[cancelable=true]", "close"]);

watcher.requestClose();
assert_array_equals(events, ["cancel[cancelable=false]", "close"], "since it was inactive, no more events fired");
assert_array_equals(events, ["cancel[cancelable=true]", "close"], "since it was inactive, no more events fired");
}, "close() inside onclose");

promise_test(async t => {
Expand All @@ -86,9 +86,9 @@
watcher.onclose = () => { watcher.requestClose(); }

watcher.requestClose();
assert_array_equals(events, ["cancel[cancelable=false]", "close"]);
assert_array_equals(events, ["cancel[cancelable=true]", "close"]);

watcher.requestClose();
assert_array_equals(events, ["cancel[cancelable=false]", "close"], "since it was inactive, no more events fired");
assert_array_equals(events, ["cancel[cancelable=true]", "close"], "since it was inactive, no more events fired");
}, "requestClose() inside onclose");
</script>

0 comments on commit c669093

Please sign in to comment.