Title: [195900] trunk/Source/WebCore
Revision
195900
Author
[email protected]
Date
2016-01-30 11:22:58 -0800 (Sat, 30 Jan 2016)

Log Message

[iOS] WebKit1 apps crash in ___ZN7WebCore16DiskCacheMonitorC2ERKNS_15ResourceRequestENS_9SessionIDEPK20_CFCachedURLResponse_block_invoke1
<http://webkit.org/b/153710>
<rdar://problem/23116706>

Reviewed by Darin Adler.

* loader/cocoa/DiskCacheMonitorCocoa.mm:
(WebCore::DiskCacheMonitor::DiskCacheMonitor):
- Fix race condition on iOS WebKit1 clients by calling the block
  to cancel the DiskCacheMonitor on the WebThread, which is the
  same thread where the CFCachedURLResponseCallBackBlock is
  called.
- Removed whitespace to adhere to style.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (195899 => 195900)


--- trunk/Source/WebCore/ChangeLog	2016-01-30 18:38:20 UTC (rev 195899)
+++ trunk/Source/WebCore/ChangeLog	2016-01-30 19:22:58 UTC (rev 195900)
@@ -1,3 +1,19 @@
+2016-01-30  David Kilzer  <[email protected]>
+
+        [iOS] WebKit1 apps crash in ___ZN7WebCore16DiskCacheMonitorC2ERKNS_15ResourceRequestENS_9SessionIDEPK20_CFCachedURLResponse_block_invoke1
+        <http://webkit.org/b/153710>
+        <rdar://problem/23116706>
+
+        Reviewed by Darin Adler.
+
+        * loader/cocoa/DiskCacheMonitorCocoa.mm:
+        (WebCore::DiskCacheMonitor::DiskCacheMonitor):
+        - Fix race condition on iOS WebKit1 clients by calling the block
+          to cancel the DiskCacheMonitor on the WebThread, which is the
+          same thread where the CFCachedURLResponseCallBackBlock is
+          called.
+        - Removed whitespace to adhere to style.
+
 2016-01-30  Ryosuke Niwa  <[email protected]>
 
         TouchList should be retargeted

Modified: trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.mm (195899 => 195900)


--- trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.mm	2016-01-30 18:38:20 UTC (rev 195899)
+++ trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.mm	2016-01-30 19:22:58 UTC (rev 195900)
@@ -71,12 +71,21 @@
 
     // Set up a delayed callback to cancel this monitor if the resource hasn't been cached yet.
     __block DiskCacheMonitor* rawMonitor = this;
-
-    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * diskCacheMonitorTimeout), dispatch_get_main_queue(), ^{
+    auto cancelMonitorBlock = ^{
         delete rawMonitor; // Balanced by "new DiskCacheMonitor" in monitorFileBackingStoreCreation.
         rawMonitor = nullptr;
-    });
+    };
 
+#if USE(WEB_THREAD)
+    auto cancelMonitorBlockToRun = ^{
+        WebThreadRun(cancelMonitorBlock);
+    };
+#else
+    auto cancelMonitorBlockToRun = cancelMonitorBlock;
+#endif
+
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * diskCacheMonitorTimeout), dispatch_get_main_queue(), cancelMonitorBlockToRun);
+
     // Set up the disk caching callback to create the ShareableResource and send it to the WebProcess.
     CFCachedURLResponseCallBackBlock block = ^(CFCachedURLResponseRef cachedResponse)
     {
@@ -96,10 +105,10 @@
     };
 
 #if USE(WEB_THREAD)
-    CFCachedURLResponseCallBackBlock blockToRun = ^ (CFCachedURLResponseRef response)
+    CFCachedURLResponseCallBackBlock blockToRun = ^(CFCachedURLResponseRef response)
     {
         CFRetain(response);
-        WebThreadRun(^ {
+        WebThreadRun(^{
             block(response);
             CFRelease(response);
         });
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to