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):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183403
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-04-27 Brent Fulgham <bfulgham@apple.com>
+
+ 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 <utatane.tea@gmail.com>
[ES6] Implement ES6 template literals
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:
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:
+2015-04-27 Brent Fulgham <bfulgham@apple.com>
+
+ 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 <ossy@webkit.org>
[EFL] TestWebKitAPI's forwarding header generator should depend on WebKit2's generator
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:
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:
+2015-04-27 Brent Fulgham <bfulgham@apple.com>
+
+ 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 <ossy@webkit.org>
Merge run-launcher into run-minibrowser
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;
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.