⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 259605 in webkit


Ignore:
Timestamp:
Apr 6, 2020, 4:05:26 PM (6 years ago)
Author:
Alan Coon
Message:

Cherry-pick r259580. rdar://problem/61352477

CrashTracer: MobileSafari at WebKit: WebKit::SystemPreviewController::updateProgress
https://bugs.webkit.org/show_bug.cgi?id=210040
rdar://51410841

Reviewed by Darin Adler.

It appears that the SystemPreviewController on WebPageProxy can
become null causing a call to an in-progress download to crash
as it tries to talk to the QuickLook delegate. Guard against this
by checking the SystemPreviewController each time.

  • UIProcess/Cocoa/DownloadClient.mm: (WebKit::systemPreviewController): (WebKit::DownloadClient::didReceiveResponse): (WebKit::DownloadClient::didReceiveData): (WebKit::DownloadClient::processDidCrash): (WebKit::DownloadClient::didFinish): (WebKit::DownloadClient::didFail): (WebKit::DownloadClient::didCancel):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259580 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-609-branch/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-609-branch/Source/WebKit/ChangeLog

    r259601 r259605  
     12020-04-06  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r259580. rdar://problem/61352477
     4
     5    CrashTracer: MobileSafari at WebKit: WebKit::SystemPreviewController::updateProgress
     6    https://bugs.webkit.org/show_bug.cgi?id=210040
     7    rdar://51410841
     8   
     9    Reviewed by Darin Adler.
     10   
     11    It appears that the SystemPreviewController on WebPageProxy can
     12    become null causing a call to an in-progress download to crash
     13    as it tries to talk to the QuickLook delegate. Guard against this
     14    by checking the SystemPreviewController each time.
     15   
     16    * UIProcess/Cocoa/DownloadClient.mm:
     17    (WebKit::systemPreviewController):
     18    (WebKit::DownloadClient::didReceiveResponse):
     19    (WebKit::DownloadClient::didReceiveData):
     20    (WebKit::DownloadClient::processDidCrash):
     21    (WebKit::DownloadClient::didFinish):
     22    (WebKit::DownloadClient::didFail):
     23    (WebKit::DownloadClient::didCancel):
     24   
     25    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259580 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     26
     27    2020-04-06  Dean Jackson  <dino@apple.com>
     28
     29            CrashTracer: MobileSafari at WebKit: WebKit::SystemPreviewController::updateProgress
     30            https://bugs.webkit.org/show_bug.cgi?id=210040
     31            rdar://51410841
     32
     33            Reviewed by Darin Adler.
     34
     35            It appears that the SystemPreviewController on WebPageProxy can
     36            become null causing a call to an in-progress download to crash
     37            as it tries to talk to the QuickLook delegate. Guard against this
     38            by checking the SystemPreviewController each time.
     39
     40            * UIProcess/Cocoa/DownloadClient.mm:
     41            (WebKit::systemPreviewController):
     42            (WebKit::DownloadClient::didReceiveResponse):
     43            (WebKit::DownloadClient::didReceiveData):
     44            (WebKit::DownloadClient::processDidCrash):
     45            (WebKit::DownloadClient::didFinish):
     46            (WebKit::DownloadClient::didFail):
     47            (WebKit::DownloadClient::didCancel):
     48
    1492020-04-06  Alan Coon  <alancoon@apple.com>
    250
  • branches/safari-609-branch/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm

    r252011 r259605  
    6666}
    6767
     68#if USE(SYSTEM_PREVIEW)
     69static SystemPreviewController* systemPreviewController(DownloadProxy& downloadProxy)
     70{
     71    auto* page = downloadProxy.originatingPage();
     72    if (!page)
     73        return nullptr;
     74    return page->systemPreviewController();
     75}
     76#endif
     77
    6878void DownloadClient::didStart(DownloadProxy& downloadProxy)
    6979{
     
    8999        downloadProxy.setExpectedContentLength(response.expectedContentLength());
    90100        downloadProxy.setBytesLoaded(0);
    91         if (auto* webPage = downloadProxy.originatingPage())
    92             webPage->systemPreviewController()->updateProgress(0);
     101        if (auto* controller = systemPreviewController(downloadProxy))
     102            controller->updateProgress(0);
    93103        return;
    94104    }
     
    104114    if (downloadProxy.isSystemPreviewDownload()) {
    105115        downloadProxy.setBytesLoaded(downloadProxy.bytesLoaded() + length);
    106         if (auto* webPage = downloadProxy.originatingPage())
    107             webPage->systemPreviewController()->updateProgress(static_cast<float>(downloadProxy.bytesLoaded()) / downloadProxy.expectedContentLength());
     116        if (auto* controller = systemPreviewController(downloadProxy))
     117            controller->updateProgress(static_cast<float>(downloadProxy.bytesLoaded()) / downloadProxy.expectedContentLength());
    108118        return;
    109119    }
     
    165175#if USE(SYSTEM_PREVIEW)
    166176    if (downloadProxy.isSystemPreviewDownload()) {
    167         if (auto* webPage = downloadProxy.originatingPage())
    168             webPage->systemPreviewController()->cancel();
     177        if (auto* controller = systemPreviewController(downloadProxy))
     178            controller->cancel();
    169179        releaseActivityTokenIfNecessary(downloadProxy);
    170180        return;
     
    210220#if USE(SYSTEM_PREVIEW)
    211221    if (downloadProxy.isSystemPreviewDownload()) {
    212         if (auto* webPage = downloadProxy.originatingPage()) {
     222        if (auto* controller = systemPreviewController(downloadProxy)) {
    213223            WTF::URL destinationURL = WTF::URL::fileURLWithFileSystemPath(downloadProxy.destinationFilename());
    214224            if (!destinationURL.fragmentIdentifier().length())
    215225                destinationURL.setFragmentIdentifier(downloadProxy.request().url().fragmentIdentifier());
    216             webPage->systemPreviewController()->finish(destinationURL);
     226            controller->finish(destinationURL);
    217227        }
    218228        releaseActivityTokenIfNecessary(downloadProxy);
     
    229239#if USE(SYSTEM_PREVIEW)
    230240    if (downloadProxy.isSystemPreviewDownload()) {
    231         if (auto* webPage = downloadProxy.originatingPage())
    232             webPage->systemPreviewController()->fail(error);
     241        if (auto* controller = systemPreviewController(downloadProxy))
     242            controller->fail(error);
    233243        releaseActivityTokenIfNecessary(downloadProxy);
    234244        return;
     
    244254#if USE(SYSTEM_PREVIEW)
    245255    if (downloadProxy.isSystemPreviewDownload()) {
    246         if (auto* webPage = downloadProxy.originatingPage())
    247             webPage->systemPreviewController()->cancel();
     256        if (auto* controller = systemPreviewController(downloadProxy))
     257            controller->cancel();
    248258        releaseActivityTokenIfNecessary(downloadProxy);
    249259        return;
Note: See TracChangeset for help on using the changeset viewer.