Diff
Modified: trunk/LayoutTests/ChangeLog (247721 => 247722)
--- trunk/LayoutTests/ChangeLog 2019-07-23 09:09:18 UTC (rev 247721)
+++ trunk/LayoutTests/ChangeLog 2019-07-23 14:47:37 UTC (rev 247722)
@@ -1,3 +1,19 @@
+2019-07-23 Wenson Hsieh <[email protected]>
+
+ [macOS 10.15] Web process crashes when attempting to show the font panel via Font > Show Fonts
+ https://bugs.webkit.org/show_bug.cgi?id=200021
+ <rdar://problem/53301325>
+
+ Reviewed by Ryosuke Niwa.
+
+ Add a new layout test to verify that attempting to show the font panel doesn't crash the web process in WebKit2.
+ This test is skipped in WebKit1, since EventSender::contextClick() in WebKit1 only returns an array of strings
+ corresponding to the titles of each menu item.
+
+ * editing/mac/style/do-not-crash-when-showing-font-panel-expected.txt: Added.
+ * editing/mac/style/do-not-crash-when-showing-font-panel.html: Added.
+ * platform/mac-wk1/TestExpectations:
+
2019-07-23 Ryosuke Niwa <[email protected]>
WebKit should strip away system font names from the pasted content
Added: trunk/LayoutTests/editing/mac/style/do-not-crash-when-showing-font-panel-expected.txt (0 => 247722)
--- trunk/LayoutTests/editing/mac/style/do-not-crash-when-showing-font-panel-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/mac/style/do-not-crash-when-showing-font-panel-expected.txt 2019-07-23 14:47:37 UTC (rev 247722)
@@ -0,0 +1,13 @@
+WebKit
+This test verifies that choosing 'Font' > 'Show Fonts' via context menu doesn't crash the web process. To test manually, right click 'WebKit' above and choose Font > Show Fonts.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Found the 'Font' menu item.
+PASS Found the 'Show Fonts' submenu item.
+PASS Clicked the 'Show Fonts' item.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/editing/mac/style/do-not-crash-when-showing-font-panel.html (0 => 247722)
--- trunk/LayoutTests/editing/mac/style/do-not-crash-when-showing-font-panel.html (rev 0)
+++ trunk/LayoutTests/editing/mac/style/do-not-crash-when-showing-font-panel.html 2019-07-23 14:47:37 UTC (rev 247722)
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<style>
+ #target {
+ font-size: 50px;
+ margin: 0;
+ }
+</style>
+</head>
+<body contenteditable>
+ <p id="target">WebKit</p>
+</body>
+<p id="description"></p>
+<p id="console"></p>
+<script>
+addEventListener("load", () => {
+ description("This test verifies that choosing 'Font' > 'Show Fonts' via context menu doesn't crash the web process. To test manually, right click 'WebKit' above and choose Font > Show Fonts.");
+ if (!window.eventSender)
+ return;
+
+ eventSender.mouseMoveTo(40, 40);
+
+ const fontMenuItem = eventSender.contextClick().find(item => item.title === "Font");
+ if (fontMenuItem)
+ testPassed("Found the 'Font' menu item.");
+ else
+ testFailed("Failed to find the 'Font' menu item.");
+
+ const showFontsItem = fontMenuItem.children.find(item => item.title === "Show Fonts");
+ if (showFontsItem)
+ testPassed("Found the 'Show Fonts' submenu item.");
+ else
+ testFailed("Failed to find the 'Show Fonts' submenu item.");
+
+ showFontsItem.click();
+ testPassed("Clicked the 'Show Fonts' item.");
+});
+</script>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (247721 => 247722)
--- trunk/LayoutTests/platform/mac-wk1/TestExpectations 2019-07-23 09:09:18 UTC (rev 247721)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations 2019-07-23 14:47:37 UTC (rev 247722)
@@ -209,6 +209,7 @@
http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-insecure-sync-xhr-in-main-frame.html [ Skip ]
webkit.org/b/187230 editing/mac/pasteboard/can-copy-url-without-title.html [ Skip ]
+webkit.org/b/187230 editing/mac/style/do-not-crash-when-showing-font-panel.html [ Skip ]
### END OF (1) Failures with bug reports
########################################
Modified: trunk/Source/WebCore/ChangeLog (247721 => 247722)
--- trunk/Source/WebCore/ChangeLog 2019-07-23 09:09:18 UTC (rev 247721)
+++ trunk/Source/WebCore/ChangeLog 2019-07-23 14:47:37 UTC (rev 247722)
@@ -1,3 +1,27 @@
+2019-07-23 Wenson Hsieh <[email protected]>
+
+ [macOS 10.15] Web process crashes when attempting to show the font panel via Font > Show Fonts
+ https://bugs.webkit.org/show_bug.cgi?id=200021
+ <rdar://problem/53301325>
+
+ Reviewed by Ryosuke Niwa.
+
+ In macOS 10.15, attempting to access ~/Library/FontCollections/ from the web process causes a Sandbox violation
+ and a subsequent crash. This can be triggered by trying to show the font panel via Font > Show Fonts in the
+ context menu after right clicking.
+
+ In the (near) future, we should fix this by moving logic to show the font panel, color panel and styles panel
+ from the Editor in the web process to the UI process in WebKit2. However, for the time being, we can just work
+ around this by adding a new EditorClient hook to determine whether to allow the font panel to show; this returns
+ true in the legacy macOS WebKit port, and false everywhere else.
+
+ Test: editing/mac/style/do-not-crash-when-showing-font-panel.html
+
+ * editing/mac/EditorMac.mm:
+ (WebCore::Editor::showFontPanel):
+ * loader/EmptyClients.cpp:
+ * page/EditorClient.h:
+
2019-07-23 Ryosuke Niwa <[email protected]>
WebKit should strip away system font names from the pasted content
Modified: trunk/Source/WebCore/editing/mac/EditorMac.mm (247721 => 247722)
--- trunk/Source/WebCore/editing/mac/EditorMac.mm 2019-07-23 09:09:18 UTC (rev 247721)
+++ trunk/Source/WebCore/editing/mac/EditorMac.mm 2019-07-23 14:47:37 UTC (rev 247722)
@@ -63,6 +63,10 @@
void Editor::showFontPanel()
{
+ auto* client = this->client();
+ if (!client || !client->canShowFontPanel())
+ return;
+
[[NSFontManager sharedFontManager] orderFrontFontPanel:nil];
}
Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (247721 => 247722)
--- trunk/Source/WebCore/loader/EmptyClients.cpp 2019-07-23 09:09:18 UTC (rev 247721)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp 2019-07-23 14:47:37 UTC (rev 247722)
@@ -268,6 +268,8 @@
void willSetInputMethodState() final { }
void setInputMethodState(bool) final { }
+ bool canShowFontPanel() const final { return false; }
+
class EmptyTextCheckerClient final : public TextCheckerClient {
bool shouldEraseMarkersAfterChangeSelection(TextCheckingType) const final { return true; }
void ignoreWordInSpellDocument(const String&) final { }
Modified: trunk/Source/WebCore/page/EditorClient.h (247721 => 247722)
--- trunk/Source/WebCore/page/EditorClient.h 2019-07-23 09:09:18 UTC (rev 247721)
+++ trunk/Source/WebCore/page/EditorClient.h 2019-07-23 14:47:37 UTC (rev 247722)
@@ -184,6 +184,8 @@
virtual bool supportsGlobalSelection() { return false; }
virtual bool performTwoStepDrop(DocumentFragment&, Range& destination, bool isMove) = 0;
+
+ virtual bool canShowFontPanel() const = 0;
};
}
Modified: trunk/Source/WebKit/ChangeLog (247721 => 247722)
--- trunk/Source/WebKit/ChangeLog 2019-07-23 09:09:18 UTC (rev 247721)
+++ trunk/Source/WebKit/ChangeLog 2019-07-23 14:47:37 UTC (rev 247722)
@@ -1,3 +1,15 @@
+2019-07-23 Wenson Hsieh <[email protected]>
+
+ [macOS 10.15] Web process crashes when attempting to show the font panel via Font > Show Fonts
+ https://bugs.webkit.org/show_bug.cgi?id=200021
+ <rdar://problem/53301325>
+
+ Reviewed by Ryosuke Niwa.
+
+ Always return false from canShowFontPanel in WebKit2.
+
+ * WebProcess/WebCoreSupport/WebEditorClient.h:
+
2019-07-23 Carlos Garcia Campos <[email protected]>
Unreviewed. Update OptionsGTK.cmake and NEWS for 2.25.3 release
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h (247721 => 247722)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h 2019-07-23 09:09:18 UTC (rev 247721)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h 2019-07-23 14:47:37 UTC (rev 247722)
@@ -185,6 +185,13 @@
bool performTwoStepDrop(WebCore::DocumentFragment&, WebCore::Range&, bool isMove) final;
bool supportsGlobalSelection() final;
+ bool canShowFontPanel() const final
+ {
+ // FIXME: Support for showing the system font panel (as well as other font styling controls) is
+ // tracked in <rdar://problem/21577518>.
+ return false;
+ }
+
WebPage* m_page;
};
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (247721 => 247722)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2019-07-23 09:09:18 UTC (rev 247721)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2019-07-23 14:47:37 UTC (rev 247722)
@@ -1,3 +1,15 @@
+2019-07-23 Wenson Hsieh <[email protected]>
+
+ [macOS 10.15] Web process crashes when attempting to show the font panel via Font > Show Fonts
+ https://bugs.webkit.org/show_bug.cgi?id=200021
+ <rdar://problem/53301325>
+
+ Reviewed by Ryosuke Niwa.
+
+ Implement a new editing client hook. In WebKit1, this always returns true on macOS and false on iOS.
+
+ * WebCoreSupport/WebEditorClient.h:
+
2019-07-22 Simon Fraser <[email protected]>
Fix WebView iframe rendering in macOS Catalina
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h (247721 => 247722)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h 2019-07-23 09:09:18 UTC (rev 247721)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h 2019-07-23 14:47:37 UTC (rev 247722)
@@ -175,6 +175,15 @@
void registerUndoOrRedoStep(WebCore::UndoStep&, bool isRedo);
+ bool canShowFontPanel() const final
+ {
+#if PLATFORM(MAC)
+ return true;
+#else
+ return false;
+#endif
+ }
+
WebView *m_webView;
RetainPtr<WebEditorUndoTarget> m_undoTarget;
bool m_haveUndoRedoOperations { false };
Modified: trunk/Source/WebKitLegacy/win/ChangeLog (247721 => 247722)
--- trunk/Source/WebKitLegacy/win/ChangeLog 2019-07-23 09:09:18 UTC (rev 247721)
+++ trunk/Source/WebKitLegacy/win/ChangeLog 2019-07-23 14:47:37 UTC (rev 247722)
@@ -1,3 +1,15 @@
+2019-07-23 Wenson Hsieh <[email protected]>
+
+ [macOS 10.15] Web process crashes when attempting to show the font panel via Font > Show Fonts
+ https://bugs.webkit.org/show_bug.cgi?id=200021
+ <rdar://problem/53301325>
+
+ Reviewed by Ryosuke Niwa.
+
+ Implement a new editing client hook.
+
+ * WebCoreSupport/WebEditorClient.h:
+
2019-07-13 Zalan Bujtas <[email protected]>
Cannot bring up custom media controls at all on v.youku.com
Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.h (247721 => 247722)
--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.h 2019-07-23 09:09:18 UTC (rev 247721)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.h 2019-07-23 14:47:37 UTC (rev 247722)
@@ -119,6 +119,8 @@
WebCore::TextCheckerClient* textChecker() final { return this; }
+ bool canShowFontPanel() const final { return false; }
+
WebView* m_webView;
WebEditorUndoTarget* m_undoTarget;
};
Modified: trunk/Tools/ChangeLog (247721 => 247722)
--- trunk/Tools/ChangeLog 2019-07-23 09:09:18 UTC (rev 247721)
+++ trunk/Tools/ChangeLog 2019-07-23 14:47:37 UTC (rev 247722)
@@ -1,3 +1,16 @@
+2019-07-23 Wenson Hsieh <[email protected]>
+
+ [macOS 10.15] Web process crashes when attempting to show the font panel via Font > Show Fonts
+ https://bugs.webkit.org/show_bug.cgi?id=200021
+ <rdar://problem/53301325>
+
+ Reviewed by Ryosuke Niwa.
+
+ Add support for grabbing the child menu items of a context menu item.
+
+ * WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
+ (WTR::getMenuItemChildrenCallback):
+
2019-07-23 Ryosuke Niwa <[email protected]>
WebKit should strip away system font names from the pasted content
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp (247721 => 247722)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp 2019-07-23 09:09:18 UTC (rev 247721)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp 2019-07-23 14:47:37 UTC (rev 247722)
@@ -66,6 +66,27 @@
return JSValueMakeString(context, toJS(wkTitle).get());
}
+static JSClassRef getMenuItemClass();
+
+static JSValueRef getMenuItemChildrenCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
+{
+ MenuItemPrivateData* privateData = static_cast<MenuItemPrivateData*>(JSObjectGetPrivate(object));
+ auto children = adoptWK(WKContextMenuCopySubmenuItems(privateData->m_item.get()));
+
+ JSValueRef arrayResult = JSObjectMakeArray(context, 0, 0, 0);
+ if (!WKArrayGetSize(children.get()))
+ return arrayResult;
+
+ JSObjectRef arrayObject = JSValueToObject(context, arrayResult, 0);
+ for (size_t i = 0; i < WKArrayGetSize(children.get()); ++i) {
+ auto item = static_cast<WKContextMenuItemRef>(WKArrayGetItemAtIndex(children.get(), i));
+ auto* privateData = new MenuItemPrivateData(InjectedBundle::singleton().page()->page(), item);
+ JSObjectSetPropertyAtIndex(context, arrayObject, i, JSObjectMake(context, getMenuItemClass(), privateData), 0);
+ }
+
+ return arrayResult;
+}
+
static JSStaticFunction staticMenuItemFunctions[] = {
{ "click", menuItemClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ 0, 0, 0 }
@@ -73,6 +94,7 @@
static JSStaticValue staticMenuItemValues[] = {
{ "title", getMenuItemTitleCallback, 0, kJSPropertyAttributeReadOnly },
+ { "children", getMenuItemChildrenCallback, 0, kJSPropertyAttributeReadOnly },
{ 0, 0, 0, 0 }
};