RESOLVED FIXED 215792
Trying to lookup when WebView is in a popover causes process to hang. Fix for Legacy WebView.
https://bugs.webkit.org/show_bug.cgi?id=215792
Summary Trying to lookup when WebView is in a popover causes process to hang. Fix for...
Megan Gardner
Reported 2020-08-24 19:51:23 PDT
Trying to lookup when WebView is in a popover causes process to hang. Fix for Legacy WebView.
Attachments
Patch (2.71 KB, patch)
2020-08-24 19:53 PDT, Megan Gardner
thorton: review+
Patch (4.68 KB, patch)
2020-08-25 10:36 PDT, Megan Gardner
no flags
Megan Gardner
Comment 1 2020-08-24 19:53:52 PDT
Megan Gardner
Comment 2 2020-08-24 19:54:10 PDT
Darin Adler
Comment 3 2020-08-24 20:03:44 PDT
Comment on attachment 407163 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=407163&action=review > Source/WebKitLegacy/mac/WebView/WebHTMLView.mm:3682 > - auto defaultMenuItems = createMenuItems(hitTestResult, defaultMenu.items()); > + Vector<WebCore::ContextMenuItem> filteredItems; > + filteredItems.reserveInitialCapacity(defaultMenu.items().size()); > + > + bool isPopover = webView.window._childWindowOrderingPriority == NSWindowChildOrderingPriorityPopover; > + bool isLookupDisabled = [NSUserDefaults.standardUserDefaults boolForKey:@"LULookupDisabled"]; > > + for (WebCore::ContextMenuItem item : defaultMenu.items()) { > + if (item.action() != WebCore::ContextMenuItemTagLookUpInDictionary || (!isLookupDisabled && !isPopover)) > + filteredItems.uncheckedAppend(item); > + } > + > + auto defaultMenuItems = createMenuItems(hitTestResult, filteredItems); Here’s a simpler way to write it (roughly, not sure I have the syntax right: auto filteredItems = defaultMenu.items(); if (!isLookupDisabled && !isPopover) { filteredItems.removeAllMatching([] (auto& item) { return item.action() == WebCore::ContextMenuItemTagLookUpInDictionary; }); } auto defaultMenuItems = createMenuItems(hitTestResult, filteredItems);
Darin Adler
Comment 4 2020-08-24 20:04:22 PDT
Not a lot simpler (I accidentally left out the isPopover and isLookupDisabled part), but still I think it’s better than writing our own loop.
Megan Gardner
Comment 5 2020-08-25 10:36:58 PDT
EWS
Comment 6 2020-08-25 14:34:23 PDT
Committed r266143: <https://trac.webkit.org/changeset/266143> All reviewed patches have been landed. Closing bug and clearing flags on attachment 407206 [details].
Note You need to log in before you can comment on or make changes to this bug.