-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REGRESSION (271805@main): [iOS] Updating options in a visible <select…
…> menu can result in hangs https://bugs.webkit.org/show_bug.cgi?id=271138 rdar://124576235 Reviewed by Abrar Rahman Protyasha. 271805@main introduced logic that would update a visible <select> menu's options as they are changed. Currently, the logic sends an update every time an option is added or removed. This is problematic when options are added in a loop, as (n - 1) unnecessary IPC messages are sent, and O(n^2) menu items are constructed in the UI process. Additionally, there is further overhead from auto layout. Consequently, adding options in a loop can result in a hang when there is a visible <select> menu. Fix by adding a debouncing mechanism, so that changes to options can be coalesced into a single update. * LayoutTests/fast/forms/ios/select-option-removed-update.html: * LayoutTests/fast/forms/ios/select-option-update-1000-expected.txt: Added. * LayoutTests/fast/forms/ios/select-option-update-1000.html: Added. * Source/WebKit/WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::close): (WebKit::WebPage::elementDidFocus): (WebKit::WebPage::focusedSelectElementDidChangeOptions): * Source/WebKit/WebProcess/WebPage/WebPage.h: Use a `DeferrableOneShotTimer` to ensure that any changes that happen within 100ms are coalesced into a single update. * Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::updateFocusedElementInformation): Canonical link: https://commits.webkit.org/276349@main
- Loading branch information
Showing
6 changed files
with
85 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
LayoutTests/fast/forms/ios/select-option-update-1000-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
This test verifies that updating a <select> element's menu while it is visible does not result in a hang. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS items.length is 1 | ||
PASS items.length is 1001 | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | ||
<script src="../../../resources/js-test.js"></script> | ||
<script src="../../../resources/ui-helper.js"></script> | ||
</head> | ||
<body> | ||
<select id="select"> | ||
<option>1</option> | ||
</select> | ||
</body> | ||
<script> | ||
jsTestIsAsync = true; | ||
|
||
addEventListener("load", async () => { | ||
description("This test verifies that updating a <select> element's menu while it is visible does not result in a hang."); | ||
|
||
await UIHelper.activateElement(select); | ||
|
||
items = await UIHelper.selectMenuItems(); | ||
shouldBeEqualToNumber("items.length", 1); | ||
|
||
for (let i = 1; i <= 1000; i++) { | ||
let option = document.createElement("option"); | ||
option.text = i + 1; | ||
select.appendChild(option); | ||
} | ||
|
||
await UIHelper.delayFor(200); | ||
|
||
items = await UIHelper.selectMenuItems(); | ||
shouldBeEqualToNumber("items.length", 1001); | ||
|
||
await UIHelper.selectFormAccessoryPickerRow(1); | ||
await UIHelper.waitForContextMenuToHide(); | ||
|
||
finishJSTest(); | ||
}); | ||
</script> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters