Skip to content

Commit

Permalink
Bug 1936066 [wpt PR 49592] - Remove exception from requestClose, a=te…
Browse files Browse the repository at this point in the history
…stonly

Automatic update from web-platform-tests
Remove exception from requestClose

See this conversation:

https://github.com/whatwg/html/pull/10737/files#r1873864137

There doesn't seem to be a reason to require `closedby` to be used
in order for `requestClose()` to work.

Bug: 376516550
Change-Id: I1d942ccafec9c30bad1bc6c4b3dfbb3f7782750b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6077771
Commit-Queue: David Baron <dbaronchromium.org>
Auto-Submit: Mason Freed <masonfchromium.org>
Reviewed-by: David Baron <dbaronchromium.org>
Cr-Commit-Position: refs/heads/main{#1393736}

--

wpt-commits: 9d055431b6064c81efc9102d2af1ddb0355eb588
wpt-pr: 49592

UltraBlame original commit: 62c924b9659286fd82fb710f8d6bbece49b08f5d
  • Loading branch information
marco-c committed Dec 13, 2024
1 parent 656982e commit 3418dea
Showing 1 changed file with 11 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,8 @@
promise_test(async (t) => {
await setup(t,closedby);
openDialog(modal);
if (dialog.closedBy != "none") {
dialog.requestClose();
assert_false(dialog.open);
} else {
assert_throws_dom('InvalidStateError',() => dialog.requestClose());
assert_true(dialog.open);
}
dialog.requestClose();
assert_false(dialog.open);
},`requestClose basic behavior ${testDescription}`);

promise_test(async (t) => {
Expand All @@ -78,15 +73,11 @@
dialog.addEventListener('close',() => events.push('close'),{signal});
openDialog(modal);
assert_array_equals(events,[]);
if (dialog.closedBy != "none") {
dialog.requestClose();
assert_false(dialog.open);
assert_array_equals(events,['cancel'],'close is scheduled');
await new Promise(resolve => requestAnimationFrame(resolve));
assert_array_equals(events,['cancel','close']);
} else {
assert_throws_dom('InvalidStateError',() => dialog.requestClose());
}
dialog.requestClose();
assert_false(dialog.open);
assert_array_equals(events,['cancel'],'close is scheduled');
await new Promise(resolve => requestAnimationFrame(resolve));
assert_array_equals(events,['cancel','close']);
},`requestClose fires both cancel and close ${testDescription}`);

promise_test(async (t) => {
Expand All @@ -97,12 +88,8 @@
openDialog(modal);
dialog.setAttribute('closedby',closedby);
assert_array_equals(events,[]);
if (dialog.closedBy != "none") {
dialog.requestClose();
assert_false(dialog.open);
} else {
assert_throws_dom('InvalidStateError',() => dialog.requestClose());
}
dialog.requestClose();
assert_false(dialog.open);
},`changing closedby from 'none' to '${closedby}' for ${modal ? "modal" : "modeless"} dialog`);

promise_test(async (t) => {
Expand All @@ -113,12 +100,8 @@
openDialog(modal);
dialog.removeAttribute('closedby');
assert_array_equals(events,[]);
if (dialog.closedBy != "none") {
dialog.requestClose();
assert_false(dialog.open);
} else {
assert_throws_dom('InvalidStateError',() => dialog.requestClose());
}
dialog.requestClose();
assert_false(dialog.open);
},`Removing closedby when closedby='${closedby}' for ${modal ? "modal" : "modeless"} dialog`);

if (dialog.closedBy != "none") {
Expand Down

0 comments on commit 3418dea

Please sign in to comment.