Unreviewed, build fix after r240805
authorjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2019 00:34:58 +0000 (00:34 +0000)
committerjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2019 00:34:58 +0000 (00:34 +0000)
This patch reverts the BlockPtr change since it breaks iOS builds.

* UIProcess/Cocoa/NavigationState.mm:
(WebKit::tryInterceptNavigation):

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Cocoa/NavigationState.mm

index a9bb66e..c2532a7 100644 (file)
@@ -1,3 +1,12 @@
+2019-01-31  Jiewen Tan  <jiewen_tan@apple.com>
+
+        Unreviewed, build fix after r240805
+
+        This patch reverts the BlockPtr change since it breaks iOS builds.
+
+        * UIProcess/Cocoa/NavigationState.mm:
+        (WebKit::tryInterceptNavigation):
+
 2019-01-31  Chris Dumez  <cdumez@apple.com>
 
         Page zoom level is lost after a process swap or a crash
index f444796..b050b6d 100644 (file)
@@ -479,16 +479,20 @@ static void tryInterceptNavigation(Ref<API::NavigationAction>&& navigationAction
 {
 #if HAVE(APP_LINKS)
     if (navigationAction->shouldOpenAppLinks()) {
-        auto callback = makeBlockPtr([request = navigationAction->request().isolatedCopy(), weakPage = makeWeakPtr(page), completionHandler = WTFMove(completionHandler)] (BOOL success, NSError *) mutable {
-            RunLoop::main().dispatch([request = request.isolatedCopy(), weakPage, completionHandler = WTFMove(completionHandler), success]() mutable {
-                if (!success && weakPage) {
-                    tryOptimizingLoad(request, *weakPage, WTFMove(completionHandler));
-                    return;
-                }
-                completionHandler(success);
-            });
+        auto* localCompletionHandler = new WTF::Function<void (bool)>([request = navigationAction->request().isolatedCopy(), weakPage = makeWeakPtr(page), completionHandler = WTFMove(completionHandler)] (bool success) mutable {
+            ASSERT(RunLoop::isMain());
+            if (!success && weakPage) {
+                tryOptimizingLoad(request, *weakPage, WTFMove(completionHandler));
+                return;
+            }
+            completionHandler(success);
         });
-        [LSAppLink openWithURL:navigationAction->request().url() completionHandler:callback.get()];
+        [LSAppLink openWithURL:navigationAction->request().url() completionHandler:[localCompletionHandler](BOOL success, NSError *) {
+            dispatch_async(dispatch_get_main_queue(), [localCompletionHandler, success] {
+                (*localCompletionHandler)(success);
+                delete localCompletionHandler;
+            });
+        }];
         return;
     }
 #endif