Changeset 246174 in webkit


Ignore:
Timestamp:
Jun 6, 2019 4:00:05 PM (5 years ago)
Author:
ggaren@apple.com
Message:

Crash using WKHTTPCookieStore when you use WKWebView and UIWebView in the same app
https://bugs.webkit.org/show_bug.cgi?id=198622

Reviewed by Chris Dumez.

Today in a WWDC lab, I saw some crash reports from an app that mixed
WKWebView and UIWebView. The proximate cause of the crash is that
WKHTTPCookieStore queues a callOnMainThread function, and then
UIWebView dequeues it on the WebThread.

No test because this crash depends on mixing WKWebView and UIWebView and
getting (un)lucky on the timing.

  • UIProcess/API/APIHTTPCookieStore.cpp:

(API::HTTPCookieStore::cookies):
(API::HTTPCookieStore::setCookies):
(API::HTTPCookieStore::deleteCookie): Avoid using callOnMainThread
becuase it is prohibited in the UI process.

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r246167 r246174  
     12019-06-06  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Crash using WKHTTPCookieStore when you use WKWebView and UIWebView in the same app
     4        https://bugs.webkit.org/show_bug.cgi?id=198622
     5
     6        Reviewed by Chris Dumez.
     7
     8        Today in a WWDC lab, I saw some crash reports from an app that mixed
     9        WKWebView and UIWebView. The proximate cause of the crash is that
     10        WKHTTPCookieStore queues a callOnMainThread function, and then
     11        UIWebView dequeues it on the WebThread.
     12
     13        No test because this crash depends on mixing WKWebView and UIWebView and
     14        getting (un)lucky on the timing.
     15
     16        * UIProcess/API/APIHTTPCookieStore.cpp:
     17        (API::HTTPCookieStore::cookies):
     18        (API::HTTPCookieStore::setCookies):
     19        (API::HTTPCookieStore::deleteCookie): Avoid using callOnMainThread
     20        becuase it is prohibited in the UI process.
     21
    1222019-06-06  Antoine Quint  <graouts@apple.com>
    223
  • trunk/Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp

    r241903 r246174  
    6363        allCookies.appendVector(m_owningDataStore->pendingCookies());
    6464
    65         callOnMainThread([completionHandler = WTFMove(completionHandler), allCookies] () mutable {
     65        RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), allCookies] () mutable {
    6666            completionHandler(allCookies);
    6767        });
     
    8787        }
    8888
    89         callOnMainThread(WTFMove(completionHandler));
     89        RunLoop::main().dispatch(WTFMove(completionHandler));
    9090        return;
    9191    }
     
    106106            m_owningDataStore->removePendingCookie(cookie);
    107107
    108         callOnMainThread([completionHandler = WTFMove(completionHandler)] () mutable {
     108        RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)] () mutable {
    109109            completionHandler();
    110110        });
Note: See TracChangeset for help on using the changeset viewer.