Title: [183403] trunk
Revision
183403
Author
[email protected]
Date
2015-04-27 11:38:29 -0700 (Mon, 27 Apr 2015)

Log Message

REGRESSION(r182879): Images and video can no longer be downloaded
https://bugs.webkit.org/show_bug.cgi?id=144267
<rdar://problem/20702844>

Reviewed by Simon Fraser.

Source/WebKit/mac:

* WebView/WebActionMenuController.mm:
(-[WebActionMenuController _createActionMenuItemForTag:]): Check for
"!WebCore::protocolIs(..., "file")" for image and media downloads.

Source/WebKit2:

* UIProcess/mac/WKActionMenuController.mm:
(-[WKActionMenuController _createActionMenuItemForTag:]): Check for
"!WebCore::protocolIs(..., "file")" for image and media downloads.

Tools:

Revise tests to check for proper download menu state.
1. Downloading a loal image should be disabled.
2. Downloading a local media file should be disabled.
3. Downloading non-downloadable media should be disabled.

* TestWebKitAPI/Tests/WebKit2ObjC/ActionMenus.mm:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (183402 => 183403)


--- trunk/Source/WebKit/mac/ChangeLog	2015-04-27 18:36:14 UTC (rev 183402)
+++ trunk/Source/WebKit/mac/ChangeLog	2015-04-27 18:38:29 UTC (rev 183403)
@@ -1,3 +1,15 @@
+2015-04-27  Brent Fulgham  <[email protected]>
+
+        REGRESSION(r182879): Images and video can no longer be downloaded
+        https://bugs.webkit.org/show_bug.cgi?id=144267
+        <rdar://problem/20702844>
+
+        Reviewed by Simon Fraser.
+
+        * WebView/WebActionMenuController.mm:
+        (-[WebActionMenuController _createActionMenuItemForTag:]): Check for
+        "!WebCore::protocolIs(..., "file")" for image and media downloads.
+
 2015-04-26  Yusuke Suzuki  <[email protected]>
 
         [ES6] Implement ES6 template literals

Modified: trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm (183402 => 183403)


--- trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm	2015-04-27 18:36:14 UTC (rev 183402)
+++ trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm	2015-04-27 18:38:29 UTC (rev 183403)
@@ -691,7 +691,7 @@
         selector = @selector(_saveImageToDownloads:);
         title = WEB_UI_STRING_KEY("Save to Downloads", "Save to Downloads (image action menu item)", "image action menu item");
         image = [NSImage imageNamed:@"NSActionMenuSaveToDownloads"];
-        enabled = WebCore::protocolIs(_hitTestResult.absoluteImageURL(), "file");
+        enabled = !WebCore::protocolIs(_hitTestResult.absoluteImageURL(), "file");
         break;
 
     case WebActionMenuItemTagCopyVideoURL:
@@ -704,7 +704,7 @@
         selector = @selector(_saveVideoToDownloads:);
         title = WEB_UI_STRING_KEY("Save to Downloads", "Save to Downloads (video action menu item)", "video action menu item");
         image = [NSImage imageNamed:@"NSActionMenuSaveToDownloads"];
-        enabled = WebCore::protocolIs(_hitTestResult.absoluteMediaURL(), "file");
+        enabled = !WebCore::protocolIs(_hitTestResult.absoluteMediaURL(), "file") && _hitTestResult.isDownloadableMedia();
         break;
 
     default:

Modified: trunk/Source/WebKit2/ChangeLog (183402 => 183403)


--- trunk/Source/WebKit2/ChangeLog	2015-04-27 18:36:14 UTC (rev 183402)
+++ trunk/Source/WebKit2/ChangeLog	2015-04-27 18:38:29 UTC (rev 183403)
@@ -1,3 +1,15 @@
+2015-04-27  Brent Fulgham  <[email protected]>
+
+        REGRESSION(r182879): Images and video can no longer be downloaded
+        https://bugs.webkit.org/show_bug.cgi?id=144267
+        <rdar://problem/20702844>
+
+        Reviewed by Simon Fraser.
+
+        * UIProcess/mac/WKActionMenuController.mm:
+        (-[WKActionMenuController _createActionMenuItemForTag:]): Check for
+        "!WebCore::protocolIs(..., "file")" for image and media downloads.
+
 2015-04-27  Csaba Osztrogonác  <[email protected]>
 
         [EFL] TestWebKitAPI's forwarding header generator should depend on WebKit2's generator

Modified: trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (183402 => 183403)


--- trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm	2015-04-27 18:36:14 UTC (rev 183402)
+++ trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm	2015-04-27 18:38:29 UTC (rev 183403)
@@ -590,7 +590,7 @@
         selector = @selector(_saveImageToDownloads:);
         title = WEB_UI_STRING_KEY("Save to Downloads", "Save to Downloads (image action menu item)", "image action menu item");
         image = [NSImage imageNamed:@"NSActionMenuSaveToDownloads"];
-        enabled = WebCore::protocolIs(hitTestResult->absoluteImageURL(), "file");
+        enabled = !WebCore::protocolIs(hitTestResult->absoluteImageURL(), "file");
         break;
 
     case kWKContextActionItemTagCopyText:
@@ -621,7 +621,7 @@
         selector = @selector(_saveVideoToDownloads:);
         title = WEB_UI_STRING_KEY("Save to Downloads", "Save to Downloads (video action menu item)", "video action menu item");
         image = [NSImage imageNamed:@"NSActionMenuSaveToDownloads"];
-        enabled = WebCore::protocolIs(hitTestResult->absoluteMediaURL(), "file");
+        enabled = !WebCore::protocolIs(hitTestResult->absoluteMediaURL(), "file") && hitTestResult->isDownloadableMedia();
         break;
 
     default:

Modified: trunk/Tools/ChangeLog (183402 => 183403)


--- trunk/Tools/ChangeLog	2015-04-27 18:36:14 UTC (rev 183402)
+++ trunk/Tools/ChangeLog	2015-04-27 18:38:29 UTC (rev 183403)
@@ -1,3 +1,19 @@
+2015-04-27  Brent Fulgham  <[email protected]>
+
+        REGRESSION(r182879): Images and video can no longer be downloaded
+        https://bugs.webkit.org/show_bug.cgi?id=144267
+        <rdar://problem/20702844>
+
+        Reviewed by Simon Fraser.
+
+        Revise tests to check for proper download menu state.
+        1. Downloading a loal image should be disabled.
+        2. Downloading a local media file should be disabled.
+        3. Downloading non-downloadable media should be disabled.
+
+        * TestWebKitAPI/Tests/WebKit2ObjC/ActionMenus.mm:
+        (TestWebKitAPI::TEST):
+
 2015-04-27  Csaba Osztrogonác  <[email protected]>
 
         Merge run-launcher into run-minibrowser

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2ObjC/ActionMenus.mm (183402 => 183403)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2ObjC/ActionMenus.mm	2015-04-27 18:36:14 UTC (rev 183402)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2ObjC/ActionMenus.mm	2015-04-27 18:38:29 UTC (rev 183403)
@@ -665,14 +665,11 @@
         EXPECT_EQ(174, image.size.height);
     }];
 
-    // Download an image.
+    // Download a local image (should be disabled)
     activeDownloadContext.shouldCheckForImage = true;
     [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::Image) preDidCloseMenuHandler:^() {
         EXPECT_EQ(kWKActionMenuImage, [wkView _actionMenuResult].type);
-
-        didFinishDownload = false;
-        performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 2, kWKContextActionItemTagSaveImageToDownloads);
-        Util::run(&didFinishDownload);
+        ensureMenuItemAtIndexOfTypeIsDisabled([wkView _actionMenu], 2, kWKContextActionItemTagSaveImageToDownloads);
     }];
     activeDownloadContext.shouldCheckForImage = false;
 
@@ -689,6 +686,9 @@
         performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 0, kWKContextActionItemTagCopyVideoURL);
         NSString *videoURL = watchPasteboardForString();
         EXPECT_WK_STREQ(@"test.mp4", [videoURL lastPathComponent]);
+
+        // Since this video is a local file, it should be disabled.
+        ensureMenuItemAtIndexOfTypeIsDisabled([wkView _actionMenu], 2, kWKContextActionItemTagSaveVideoToDownloads);
     }];
 
     // Copying a video URL for a non-downloadable video should result in copying the page URL instead.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to