Title: [278489] branches/safari-611-branch/Source/WebKit
Revision
278489
Author
[email protected]
Date
2021-06-04 13:24:17 -0700 (Fri, 04 Jun 2021)

Log Message

Cherry-pick r276514. rdar://problem/78875360

    Web Inspector: [Cocoa] WKInspectorResourceURLSchemeHandler needs to serialize cleanup actions
    https://bugs.webkit.org/show_bug.cgi?id=224986
    <rdar://76768454>

    Reviewed by Devin Rousso.

    * UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm:
    (-[WKInspectorResourceURLSchemeHandler webView:startURLSchemeTask:]):
    Do cleanup on the main queue so that it can be serialized with reads.

    (-[WKInspectorResourceURLSchemeHandler webView:stopURLSchemeTask:]):
    Ensure that all removals from the map are processed before doing a lookup.

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

Modified Paths

Diff

Modified: branches/safari-611-branch/Source/WebKit/ChangeLog (278488 => 278489)


--- branches/safari-611-branch/Source/WebKit/ChangeLog	2021-06-04 20:24:14 UTC (rev 278488)
+++ branches/safari-611-branch/Source/WebKit/ChangeLog	2021-06-04 20:24:17 UTC (rev 278489)
@@ -1,5 +1,40 @@
 2021-06-04  Alan Coon  <[email protected]>
 
+        Cherry-pick r276514. rdar://problem/78875360
+
+    Web Inspector: [Cocoa] WKInspectorResourceURLSchemeHandler needs to serialize cleanup actions
+    https://bugs.webkit.org/show_bug.cgi?id=224986
+    <rdar://76768454>
+    
+    Reviewed by Devin Rousso.
+    
+    * UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm:
+    (-[WKInspectorResourceURLSchemeHandler webView:startURLSchemeTask:]):
+    Do cleanup on the main queue so that it can be serialized with reads.
+    
+    (-[WKInspectorResourceURLSchemeHandler webView:stopURLSchemeTask:]):
+    Ensure that all removals from the map are processed before doing a lookup.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-04-23  BJ Burg  <[email protected]>
+
+            Web Inspector: [Cocoa] WKInspectorResourceURLSchemeHandler needs to serialize cleanup actions
+            https://bugs.webkit.org/show_bug.cgi?id=224986
+            <rdar://76768454>
+
+            Reviewed by Devin Rousso.
+
+            * UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm:
+            (-[WKInspectorResourceURLSchemeHandler webView:startURLSchemeTask:]):
+            Do cleanup on the main queue so that it can be serialized with reads.
+
+            (-[WKInspectorResourceURLSchemeHandler webView:stopURLSchemeTask:]):
+            Ensure that all removals from the map are processed before doing a lookup.
+
+2021-06-04  Alan Coon  <[email protected]>
+
         Cherry-pick r275886. rdar://problem/78874996
 
     StorageArea in LocalStorageNamespace can be abandoned

Modified: branches/safari-611-branch/Source/WebKit/UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm (278488 => 278489)


--- branches/safari-611-branch/Source/WebKit/UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm	2021-06-04 20:24:14 UTC (rev 278488)
+++ branches/safari-611-branch/Source/WebKit/UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm	2021-06-04 20:24:17 UTC (rev 278489)
@@ -65,7 +65,9 @@
     }
 
     NSBlockOperation *operation = [NSBlockOperation blockOperationWithBlock:^{
-        [_fileLoadOperations removeObjectForKey:urlSchemeTask];
+        dispatch_async(dispatch_get_main_queue(), ^{
+            [_fileLoadOperations removeObjectForKey:urlSchemeTask];
+        });
 
         NSURL *requestURL = urlSchemeTask.request.URL;
         NSURL *fileURLForRequest = [_cachedBundle URLForResource:requestURL.relativePath withExtension:@""];
@@ -106,10 +108,13 @@
 
 - (void)webView:(WKWebView *)webView stopURLSchemeTask:(id <WKURLSchemeTask>)urlSchemeTask
 {
-    if (NSOperation *operation = [_fileLoadOperations objectForKey:urlSchemeTask]) {
-        [operation cancel];
-        [_fileLoadOperations removeObjectForKey:urlSchemeTask];
-    }
+    // Ensure that all blocks with pending removals are dispatched before doing a map lookup.
+    dispatch_async(dispatch_get_main_queue(), ^{
+        if (NSOperation *operation = [_fileLoadOperations objectForKey:urlSchemeTask]) {
+            [operation cancel];
+            [_fileLoadOperations removeObjectForKey:urlSchemeTask];
+        }
+    });
 }
 
 @end
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to