Changeset 252000 in webkit


Ignore:
Timestamp:
Nov 4, 2019 10:20:56 AM (4 years ago)
Author:
commit-queue@webkit.org
Message:

REGRESSION(r243947) Epson software updater fails to install new version
https://bugs.webkit.org/show_bug.cgi?id=203809
<rdar://problem/56002179>

Patch by Alex Christensen <achristensen@webkit.org> on 2019-11-04
Reviewed by Brady Eidson.

Source/WebCore:

I manually verified this fixes the issue. See the radar.

  • platform/RuntimeApplicationChecks.h:
  • platform/cocoa/RuntimeApplicationChecksCocoa.mm:

(WebCore::MacApplication::isEpsonSoftwareUpdater):

Source/WebKitLegacy/mac:

  • Misc/WebDownload.mm:

(shouldCallOnNetworkThread):
(callOnDelegateThread):
(isDelegateThread):
(-[WebDownloadInternal downloadDidBegin:]):
(-[WebDownloadInternal download:willSendRequest:redirectResponse:]):
(-[WebDownloadInternal download:didReceiveAuthenticationChallenge:]):
(-[WebDownloadInternal download:didReceiveResponse:]):
(-[WebDownloadInternal download:didReceiveDataOfLength:]):
(-[WebDownloadInternal download:shouldDecodeSourceDataOfMIMEType:]):
(-[WebDownloadInternal download:decideDestinationWithSuggestedFilename:]):
(-[WebDownloadInternal download:didCreateDestination:]):
(-[WebDownloadInternal downloadDidFinish:]):
(-[WebDownloadInternal download:didFailWithError:]):

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r251999 r252000  
     12019-11-04  Alex Christensen  <achristensen@webkit.org>
     2
     3        REGRESSION(r243947) Epson software updater fails to install new version
     4        https://bugs.webkit.org/show_bug.cgi?id=203809
     5        <rdar://problem/56002179>
     6
     7        Reviewed by Brady Eidson.
     8
     9        I manually verified this fixes the issue.  See the radar.
     10
     11        * platform/RuntimeApplicationChecks.h:
     12        * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
     13        (WebCore::MacApplication::isEpsonSoftwareUpdater):
     14
    1152019-11-04  Ross Kirsling  <ross.kirsling@sony.com>
    216
  • trunk/Source/WebCore/platform/RuntimeApplicationChecks.h

    r251108 r252000  
    6969WEBCORE_EXPORT bool isHRBlock();
    7070WEBCORE_EXPORT bool isIAdProducer();
     71WEBCORE_EXPORT bool isEpsonSoftwareUpdater();
    7172
    7273} // MacApplication
  • trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm

    r251108 r252000  
    194194}
    195195
     196bool MacApplication::isEpsonSoftwareUpdater()
     197{
     198    static bool isEpsonSoftwareUpdater = applicationBundleIsEqualTo("com.epson.EPSON_Software_Updater"_s);
     199    return isEpsonSoftwareUpdater;
     200}
     201
    196202#endif // PLATFORM(MAC)
    197203
  • trunk/Source/WebKitLegacy/mac/ChangeLog

    r251963 r252000  
     12019-11-04  Alex Christensen  <achristensen@webkit.org>
     2
     3        REGRESSION(r243947) Epson software updater fails to install new version
     4        https://bugs.webkit.org/show_bug.cgi?id=203809
     5        <rdar://problem/56002179>
     6
     7        Reviewed by Brady Eidson.
     8
     9        * Misc/WebDownload.mm:
     10        (shouldCallOnNetworkThread):
     11        (callOnDelegateThread):
     12        (isDelegateThread):
     13        (-[WebDownloadInternal downloadDidBegin:]):
     14        (-[WebDownloadInternal download:willSendRequest:redirectResponse:]):
     15        (-[WebDownloadInternal download:didReceiveAuthenticationChallenge:]):
     16        (-[WebDownloadInternal download:didReceiveResponse:]):
     17        (-[WebDownloadInternal download:didReceiveDataOfLength:]):
     18        (-[WebDownloadInternal download:shouldDecodeSourceDataOfMIMEType:]):
     19        (-[WebDownloadInternal download:decideDestinationWithSuggestedFilename:]):
     20        (-[WebDownloadInternal download:didCreateDestination:]):
     21        (-[WebDownloadInternal downloadDidFinish:]):
     22        (-[WebDownloadInternal download:didFailWithError:]):
     23
    1242019-11-02  Devin Rousso  <drousso@apple.com>
    225
  • trunk/Source/WebKitLegacy/mac/Misc/WebDownload.mm

    r247837 r252000  
    3737#import <WebCore/NetworkStorageSession.h>
    3838#import <WebCore/ProtectionSpace.h>
     39#import <WebCore/RuntimeApplicationChecks.h>
    3940#import <WebKitLegacy/WebPanelAuthenticationHandler.h>
    4041#import <pal/spi/cocoa/NSURLDownloadSPI.h>
    4142#import <wtf/Assertions.h>
    4243#import <wtf/MainThread.h>
     44#import <wtf/spi/darwin/dyldSPI.h>
     45
     46static bool shouldCallOnNetworkThread()
     47{
     48#if PLATFORM(MAC)
     49    static bool isOldEpsonSoftwareUpdater = WebCore::MacApplication::isEpsonSoftwareUpdater() && dyld_get_program_sdk_version() < DYLD_MACOSX_VERSION_10_15;
     50    return isOldEpsonSoftwareUpdater;
     51#else
     52    return false;
     53#endif
     54}
     55
     56static void callOnDelegateThread(Function<void()>&& function)
     57{
     58    if (shouldCallOnNetworkThread())
     59        function();
     60    callOnMainThread(WTFMove(function));
     61}
     62
     63template<typename Callable>
     64static void callOnDelegateThreadAndWait(Callable&& work)
     65{
     66    if (shouldCallOnNetworkThread() || isMainThread())
     67        work();
     68    else
     69        dispatch_sync(dispatch_get_main_queue(), work);
     70}
    4371
    4472using namespace WebCore;
     
    84112- (void)downloadDidBegin:(NSURLDownload *)download
    85113{
    86     callOnMainThread([realDelegate = retainPtr(realDelegate), download = retainPtr(download)] {
     114    callOnDelegateThread([realDelegate = retainPtr(realDelegate), download = retainPtr(download)] {
    87115        [realDelegate downloadDidBegin:download.get()];
    88116    });
     
    96124        returnValue = [realDelegate download:download willSendRequest:request redirectResponse:redirectResponse];
    97125    };
    98     if (isMainThread())
    99         work();
    100     else
    101         dispatch_sync(dispatch_get_main_queue(), work);
     126    callOnDelegateThreadAndWait(WTFMove(work));
    102127    return returnValue.autorelease();
    103128}
     
    116141
    117142    if ([realDelegate respondsToSelector:@selector(download:didReceiveAuthenticationChallenge:)]) {
    118         callOnMainThread([realDelegate = retainPtr(realDelegate), download = retainPtr(download), challenge = retainPtr(challenge)] {
     143        callOnDelegateThread([realDelegate = retainPtr(realDelegate), download = retainPtr(download), challenge = retainPtr(challenge)] {
    119144            [realDelegate download:download.get() didReceiveAuthenticationChallenge:challenge.get()];
    120145        });
    121146    } else {
    122         callOnMainThread([realDelegate = retainPtr(realDelegate), download = retainPtr(download), challenge = retainPtr(challenge)] {
     147        callOnDelegateThread([realDelegate = retainPtr(realDelegate), download = retainPtr(download), challenge = retainPtr(challenge)] {
    123148            NSWindow *window = nil;
    124149            if ([realDelegate respondsToSelector:@selector(downloadWindowForAuthenticationSheet:)])
     
    133158- (void)download:(NSURLDownload *)download didReceiveResponse:(NSURLResponse *)response
    134159{
    135     callOnMainThread([realDelegate = retainPtr(realDelegate), download = retainPtr(download), response = retainPtr(response)] {
     160    callOnDelegateThread([realDelegate = retainPtr(realDelegate), download = retainPtr(download), response = retainPtr(response)] {
    136161        [realDelegate download:download.get() didReceiveResponse:response.get()];
    137162    });
     
    140165- (void)download:(NSURLDownload *)download didReceiveDataOfLength:(NSUInteger)length
    141166{
    142     callOnMainThread([realDelegate = retainPtr(realDelegate), download = retainPtr(download), length] {
     167    callOnDelegateThread([realDelegate = retainPtr(realDelegate), download = retainPtr(download), length] {
    143168        [realDelegate download:download.get() didReceiveDataOfLength:length];
    144169    });
     
    151176        returnValue = [realDelegate download:download shouldDecodeSourceDataOfMIMEType:encodingType];
    152177    };
    153     if (isMainThread())
    154         work();
    155     else
    156         dispatch_sync(dispatch_get_main_queue(), work);
     178    callOnDelegateThreadAndWait(WTFMove(work));
    157179    return returnValue;
    158180}
     
    160182- (void)download:(NSURLDownload *)download decideDestinationWithSuggestedFilename:(NSString *)filename
    161183{
    162     callOnMainThread([realDelegate = retainPtr(realDelegate), download = retainPtr(download), filename = retainPtr(filename)] {
     184    callOnDelegateThread([realDelegate = retainPtr(realDelegate), download = retainPtr(download), filename = retainPtr(filename)] {
    163185        [realDelegate download:download.get() decideDestinationWithSuggestedFilename:filename.get()];
    164186    });
     
    167189- (void)download:(NSURLDownload *)download didCreateDestination:(NSString *)path
    168190{
    169     callOnMainThread([realDelegate = retainPtr(realDelegate), download = retainPtr(download), path = retainPtr(path)] {
     191    callOnDelegateThread([realDelegate = retainPtr(realDelegate), download = retainPtr(download), path = retainPtr(path)] {
    170192        [realDelegate download:download.get() didCreateDestination:path.get()];
    171193    });
     
    174196- (void)downloadDidFinish:(NSURLDownload *)download
    175197{
    176     callOnMainThread([realDelegate = retainPtr(realDelegate), download = retainPtr(download)] {
     198    callOnDelegateThread([realDelegate = retainPtr(realDelegate), download = retainPtr(download)] {
    177199        [realDelegate downloadDidFinish:download.get()];
    178200    });
     
    181203- (void)download:(NSURLDownload *)download didFailWithError:(NSError *)error
    182204{
    183     callOnMainThread([realDelegate = retainPtr(realDelegate), download = retainPtr(download), error = retainPtr(error)] {
     205    callOnDelegateThread([realDelegate = retainPtr(realDelegate), download = retainPtr(download), error = retainPtr(error)] {
    184206        [realDelegate download:download.get() didFailWithError:error.get()];
    185207    });
Note: See TracChangeset for help on using the changeset viewer.