Skip to content

Commit

Permalink
Move popover stack manipulation later in the hide process
Browse files Browse the repository at this point in the history
This also makes the IsPopoverReady arguments mandatory, since there
was a document check missing one place.

Bug: 1307772
Change-Id: Ic9e701d656c2f7f727e41634c114dcb2592a9166
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4461952
Auto-Submit: Mason Freed <[email protected]>
Code-Coverage: Findit <[email protected]>
Commit-Queue: Joey Arhar <[email protected]>
Reviewed-by: Joey Arhar <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1134899}
  • Loading branch information
mfreed7 authored and chromium-wpt-export-bot committed Apr 24, 2023
1 parent 866be8b commit 5d9b186
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion html/semantics/popovers/popover-light-dismiss.html
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,10 @@
if (e.newState === "closed")
p20.showPopover();
},{once:true});
p19.hidePopover();
// Because the `beforetoggle` handler shows a different popover,
// and that action closes the p19 popover, the call to hidePopover()
// will result in an exception.
assert_throws_dom('InvalidStateError',() => p19.hidePopover());
assert_false(p19.matches(':popover-open'));
assert_true(p20.matches(':popover-open'));
},'Show an unrelated popover during "hide popover"');
Expand Down
5 changes: 4 additions & 1 deletion html/semantics/popovers/popover-move-documents.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
assert_true(p2.matches(':popover-open'),
'The popover should be open after calling showPopover()');

p2.hidePopover();
// Because the `beforetoggle` handler changes the document,
// and that action closes the popover, the call to hidePopover()
// will result in an exception.
assert_throws_dom('InvalidStateError',() => p2.hidePopover());
assert_false(p2.matches(':popover-open'),
'The popover should be closed after moving it between documents.');
}, 'Moving popovers between documents while hiding should not throw an exception.');
Expand Down

0 comments on commit 5d9b186

Please sign in to comment.