Changeset 247901 in webkit
- Timestamp:
- Jul 29, 2019 2:07:26 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r247900 r247901 1 2019-07-29 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 Multiple context menu actions broken for YouTube videos 4 https://bugs.webkit.org/show_bug.cgi?id=199999 5 6 Reviewed by Eric Carlson. 7 8 Do not include CopyMediaLinkItem and OpenMediaInNewWindowItem to the context menu when media URL is not 9 downloadable or the request can't be handled. 10 11 * page/ContextMenuController.cpp: 12 (WebCore::ContextMenuController::populate): 13 1 14 2019-07-28 Commit Queue <commit-queue@webkit.org> 2 15 -
trunk/Source/WebCore/page/ContextMenuController.cpp
r247416 r247901 887 887 appendItem(ToggleVideoEnhancedFullscreen, m_contextMenu.get()); 888 888 #endif 889 appendItem(*separatorItem(), m_contextMenu.get());890 appendItem(CopyMediaLinkItem, m_contextMenu.get());891 appendItem(OpenMediaInNewWindowItem, m_contextMenu.get());892 if (m_context.hitTestResult().isDownloadableMedia() && loader.client().canHandleRequest(ResourceRequest(mediaURL)))889 if (m_context.hitTestResult().isDownloadableMedia() && loader.client().canHandleRequest(ResourceRequest(mediaURL))) { 890 appendItem(*separatorItem(), m_contextMenu.get()); 891 appendItem(CopyMediaLinkItem, m_contextMenu.get()); 892 appendItem(OpenMediaInNewWindowItem, m_contextMenu.get()); 893 893 appendItem(DownloadMediaItem, m_contextMenu.get()); 894 } 894 895 } 895 896 -
trunk/Tools/ChangeLog
r247898 r247901 1 2019-07-29 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 Multiple context menu actions broken for YouTube videos 4 https://bugs.webkit.org/show_bug.cgi?id=199999 5 6 Reviewed by Eric Carlson. 7 8 Add a test case to check copy link address, open in new window and download options are not included in the 9 context menu for non-downloadable media. 10 11 * TestWebKitAPI/Tests/WebKitGtk/TestContextMenu.cpp: 12 (writeNextChunk): 13 (serverCallback): 14 (testContextMenuLiveStream): 15 (beforeAll): 16 (afterAll): 17 1 18 2019-07-28 Tim Horton <timothy_horton@apple.com> 2 19 -
trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/TestContextMenu.cpp
r246790 r247901 19 19 20 20 #include "config.h" 21 22 #include "WebKitTestServer.h" 21 23 #include "WebViewTest.h" 22 24 #include <wtf/Vector.h> 23 25 #include <wtf/glib/GRefPtr.h> 26 27 static WebKitTestServer* kServer; 24 28 25 29 class ContextMenuTest: public WebViewTest { … … 296 300 Video, 297 301 Audio, 302 VideoLive, 298 303 Editable, 299 304 Selection … … 391 396 iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_AUDIO_TO_DISK, Visible | Enabled); 392 397 break; 398 case VideoLive: 399 g_assert_false(webkit_hit_test_result_context_is_link(hitTestResult)); 400 g_assert_false(webkit_hit_test_result_context_is_image(hitTestResult)); 401 g_assert_true(webkit_hit_test_result_context_is_media(hitTestResult)); 402 g_assert_false(webkit_hit_test_result_context_is_editable(hitTestResult)); 403 g_assert_false(webkit_hit_test_result_context_is_selection(hitTestResult)); 404 iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_MEDIA_PLAY, Visible | Enabled); 405 iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_MEDIA_MUTE, Visible | Enabled); 406 iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_TOGGLE_MEDIA_CONTROLS, Visible | Enabled); 407 iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_TOGGLE_MEDIA_LOOP, Visible | Enabled); 408 iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_ENTER_VIDEO_FULLSCREEN, Visible | Enabled); 409 break; 393 410 case Editable: 394 411 g_assert_false(webkit_hit_test_result_context_is_link(hitTestResult)); … … 1069 1086 } 1070 1087 1088 static void writeNextChunk(SoupMessage* message) 1089 { 1090 GUniquePtr<char> filePath(g_build_filename(Test::getResourcesDir().data(), "silence.webm", nullptr)); 1091 char* contents; 1092 gsize contentsLength; 1093 if (!g_file_get_contents(filePath.get(), &contents, &contentsLength, nullptr)) { 1094 soup_message_set_status(message, SOUP_STATUS_NOT_FOUND); 1095 soup_message_body_complete(message->response_body); 1096 return; 1097 } 1098 1099 soup_message_body_append(message->response_body, SOUP_MEMORY_TAKE, contents, contentsLength); 1100 soup_message_body_complete(message->response_body); 1101 } 1102 1103 static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer) 1104 { 1105 if (message->method != SOUP_METHOD_GET) { 1106 soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED); 1107 return; 1108 } 1109 1110 soup_message_set_status(message, SOUP_STATUS_OK); 1111 1112 if (g_str_equal(path, "/live-stream")) { 1113 static const char* html = 1114 "<html><body>" 1115 " <video style='position:absolute; left:1; top:1' width='300' height='300'>" 1116 " <source src='/live-stream.webm' type='video/webm' />" 1117 " </video>" 1118 "</body></html>"; 1119 soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, html, strlen(html)); 1120 } else if (g_str_equal(path, "/live-stream.webm")) { 1121 soup_message_headers_set_encoding(message->response_headers, SOUP_ENCODING_CHUNKED); 1122 g_signal_connect(message, "wrote_headers", G_CALLBACK(writeNextChunk), nullptr); 1123 g_signal_connect(message, "wrote_chunk", G_CALLBACK(writeNextChunk), nullptr); 1124 return; 1125 } 1126 1127 soup_message_body_complete(message->response_body); 1128 } 1129 1130 static void testContextMenuLiveStream(ContextMenuDefaultTest* test, gconstpointer) 1131 { 1132 test->showInWindowAndWaitUntilMapped(); 1133 1134 test->loadURI(kServer->getURIForPath("/live-stream").data()); 1135 test->waitUntilLoadFinished(); 1136 1137 test->m_expectedMenuType = ContextMenuDefaultTest::VideoLive; 1138 test->showContextMenuAtPositionAndWaitUntilFinished(1, 1); 1139 } 1140 1071 1141 void beforeAll() 1072 1142 { 1143 kServer = new WebKitTestServer(); 1144 kServer->run(serverCallback); 1145 1073 1146 ContextMenuDefaultTest::add("WebKitWebView", "default-menu", testContextMenuDefaultMenu); 1074 1147 ContextMenuDefaultTest::add("WebKitWebView", "context-menu-key", testContextMenuKey); 1075 1148 ContextMenuDefaultTest::add("WebKitWebView", "popup-event-signal", testPopupEventSignal); 1149 ContextMenuDefaultTest::add("WebKitWebView", "live-stream", testContextMenuLiveStream); 1076 1150 ContextMenuCustomTest::add("WebKitWebView", "populate-menu", testContextMenuPopulateMenu); 1077 1151 ContextMenuCustomFullTest::add("WebKitWebView", "custom-menu", testContextMenuCustomMenu); … … 1085 1159 void afterAll() 1086 1160 { 1087 } 1161 delete kServer; 1162 }
Note: See TracChangeset
for help on using the changeset viewer.