Title: [246174] trunk/Source/WebKit
Revision
246174
Author
[email protected]
Date
2019-06-06 16:00:05 -0700 (Thu, 06 Jun 2019)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (246173 => 246174)


--- trunk/Source/WebKit/ChangeLog	2019-06-06 22:34:49 UTC (rev 246173)
+++ trunk/Source/WebKit/ChangeLog	2019-06-06 23:00:05 UTC (rev 246174)
@@ -1,3 +1,24 @@
+2019-06-06  Geoffrey Garen  <[email protected]>
+
+        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.
+
 2019-06-06  Antoine Quint  <[email protected]>
 
         Remove duplicated websiteDataStoreParameters code from WebsitePoliciesData::applyToDocumentLoader()

Modified: trunk/Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp (246173 => 246174)


--- trunk/Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp	2019-06-06 22:34:49 UTC (rev 246173)
+++ trunk/Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp	2019-06-06 23:00:05 UTC (rev 246174)
@@ -62,7 +62,7 @@
             allCookies = getAllDefaultUIProcessCookieStoreCookies();
         allCookies.appendVector(m_owningDataStore->pendingCookies());
 
-        callOnMainThread([completionHandler = WTFMove(completionHandler), allCookies] () mutable {
+        RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), allCookies] () mutable {
             completionHandler(allCookies);
         });
         return;
@@ -86,7 +86,7 @@
                 m_owningDataStore->addPendingCookie(cookie);
         }
 
-        callOnMainThread(WTFMove(completionHandler));
+        RunLoop::main().dispatch(WTFMove(completionHandler));
         return;
     }
 
@@ -105,7 +105,7 @@
         else
             m_owningDataStore->removePendingCookie(cookie);
 
-        callOnMainThread([completionHandler = WTFMove(completionHandler)] () mutable {
+        RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)] () mutable {
             completionHandler();
         });
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to