Changeset 183403 in webkit


Ignore:
Timestamp:
Apr 27, 2015 11:38:29 AM (9 years ago)
Author:
Brent Fulgham
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):

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/mac/ChangeLog

    r183373 r183403  
     12015-04-27  Brent Fulgham  <bfulgham@apple.com>
     2
     3        REGRESSION(r182879): Images and video can no longer be downloaded
     4        https://bugs.webkit.org/show_bug.cgi?id=144267
     5        <rdar://problem/20702844>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * WebView/WebActionMenuController.mm:
     10        (-[WebActionMenuController _createActionMenuItemForTag:]): Check for
     11        "!WebCore::protocolIs(..., "file")" for image and media downloads.
     12
    1132015-04-26  Yusuke Suzuki  <utatane.tea@gmail.com>
    214
  • trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm

    r183136 r183403  
    692692        title = WEB_UI_STRING_KEY("Save to Downloads", "Save to Downloads (image action menu item)", "image action menu item");
    693693        image = [NSImage imageNamed:@"NSActionMenuSaveToDownloads"];
    694         enabled = WebCore::protocolIs(_hitTestResult.absoluteImageURL(), "file");
     694        enabled = !WebCore::protocolIs(_hitTestResult.absoluteImageURL(), "file");
    695695        break;
    696696
     
    705705        title = WEB_UI_STRING_KEY("Save to Downloads", "Save to Downloads (video action menu item)", "video action menu item");
    706706        image = [NSImage imageNamed:@"NSActionMenuSaveToDownloads"];
    707         enabled = WebCore::protocolIs(_hitTestResult.absoluteMediaURL(), "file");
     707        enabled = !WebCore::protocolIs(_hitTestResult.absoluteMediaURL(), "file") && _hitTestResult.isDownloadableMedia();
    708708        break;
    709709
  • trunk/Source/WebKit2/ChangeLog

    r183389 r183403  
     12015-04-27  Brent Fulgham  <bfulgham@apple.com>
     2
     3        REGRESSION(r182879): Images and video can no longer be downloaded
     4        https://bugs.webkit.org/show_bug.cgi?id=144267
     5        <rdar://problem/20702844>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * UIProcess/mac/WKActionMenuController.mm:
     10        (-[WKActionMenuController _createActionMenuItemForTag:]): Check for
     11        "!WebCore::protocolIs(..., "file")" for image and media downloads.
     12
    1132015-04-27  Csaba Osztrogonác  <ossy@webkit.org>
    214
  • trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm

    r182879 r183403  
    591591        title = WEB_UI_STRING_KEY("Save to Downloads", "Save to Downloads (image action menu item)", "image action menu item");
    592592        image = [NSImage imageNamed:@"NSActionMenuSaveToDownloads"];
    593         enabled = WebCore::protocolIs(hitTestResult->absoluteImageURL(), "file");
     593        enabled = !WebCore::protocolIs(hitTestResult->absoluteImageURL(), "file");
    594594        break;
    595595
     
    622622        title = WEB_UI_STRING_KEY("Save to Downloads", "Save to Downloads (video action menu item)", "video action menu item");
    623623        image = [NSImage imageNamed:@"NSActionMenuSaveToDownloads"];
    624         enabled = WebCore::protocolIs(hitTestResult->absoluteMediaURL(), "file");
     624        enabled = !WebCore::protocolIs(hitTestResult->absoluteMediaURL(), "file") && hitTestResult->isDownloadableMedia();
    625625        break;
    626626
  • trunk/Tools/ChangeLog

    r183400 r183403  
     12015-04-27  Brent Fulgham  <bfulgham@apple.com>
     2
     3        REGRESSION(r182879): Images and video can no longer be downloaded
     4        https://bugs.webkit.org/show_bug.cgi?id=144267
     5        <rdar://problem/20702844>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Revise tests to check for proper download menu state.
     10        1. Downloading a loal image should be disabled.
     11        2. Downloading a local media file should be disabled.
     12        3. Downloading non-downloadable media should be disabled.
     13
     14        * TestWebKitAPI/Tests/WebKit2ObjC/ActionMenus.mm:
     15        (TestWebKitAPI::TEST):
     16
    1172015-04-27  Csaba Osztrogonác  <ossy@webkit.org>
    218
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2ObjC/ActionMenus.mm

    r183298 r183403  
    666666    }];
    667667
    668     // Download an image.
     668    // Download a local image (should be disabled)
    669669    activeDownloadContext.shouldCheckForImage = true;
    670670    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::Image) preDidCloseMenuHandler:^() {
    671671        EXPECT_EQ(kWKActionMenuImage, [wkView _actionMenuResult].type);
    672 
    673         didFinishDownload = false;
    674         performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 2, kWKContextActionItemTagSaveImageToDownloads);
    675         Util::run(&didFinishDownload);
     672        ensureMenuItemAtIndexOfTypeIsDisabled([wkView _actionMenu], 2, kWKContextActionItemTagSaveImageToDownloads);
    676673    }];
    677674    activeDownloadContext.shouldCheckForImage = false;
     
    690687        NSString *videoURL = watchPasteboardForString();
    691688        EXPECT_WK_STREQ(@"test.mp4", [videoURL lastPathComponent]);
     689
     690        // Since this video is a local file, it should be disabled.
     691        ensureMenuItemAtIndexOfTypeIsDisabled([wkView _actionMenu], 2, kWKContextActionItemTagSaveVideoToDownloads);
    692692    }];
    693693
Note: See TracChangeset for help on using the changeset viewer.