RESOLVED FIXED 143544
Allow LaunchServices to handle URLs on link navigations
https://bugs.webkit.org/show_bug.cgi?id=143544
Summary Allow LaunchServices to handle URLs on link navigations
Sam Weinig
Reported 2015-04-08 17:38:38 PDT
Allow LaunchServices to handle URLs on link navigations.
Attachments
Patch (23.06 KB, patch)
2015-04-08 17:44 PDT, Sam Weinig
andersca: review+
Sam Weinig
Comment 1 2015-04-08 17:38:57 PDT
Sam Weinig
Comment 2 2015-04-08 17:44:27 PDT
WebKit Commit Bot
Comment 3 2015-04-08 17:47:21 PDT
Attachment 250398 [details] did not pass style-queue: ERROR: Source/WebKit2/UIProcess/Cocoa/NavigationState.mm:231: Extra space before ( in function call [whitespace/parens] [4] ERROR: Source/WebKit2/UIProcess/Cocoa/NavigationState.mm:231: The parameter type should use PassRefPtr instead of RefPtr. [readability/pass_ptr] [5] ERROR: Source/WebKit2/UIProcess/Cocoa/NavigationState.mm:237: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/WebKit2/UIProcess/Cocoa/NavigationState.mm:291: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm:912: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm:924: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm:2365: Place brace on its own line for function definitions. [whitespace/braces] [4] Total errors found: 7 in 11 files If any of these errors are false positives, please file a bug against check-webkit-style.
Anders Carlsson
Comment 4 2015-04-08 18:14:29 PDT
Comment on attachment 250398 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=250398&action=review > Source/WebCore/platform/spi/ios/LaunchServicesSPI.h:39 > +typedef void (^ LSAppLinkOpenCompletionHandler)(BOOL success, NSError *error); No space after ^. > Source/WebKit2/UIProcess/Cocoa/NavigationState.mm:240 > + dispatch_async(dispatch_get_main_queue(), [completionHandler, success] { > + completionHandler(success); > + }); This is copying the completion handler on a background queue - that's not thread safe and will break if the completion handler has bound strings for example. I think you're going to have to create an std::function pointer and pass it across the thread boundary and then explicitly delete it on the main thread. > Source/WebKit2/UIProcess/Cocoa/NavigationState.mm:255 > + tryAppLink(localNavigationAction, [localListener, localNavigationAction] (bool followedLinkToApp) { What's ensuring that the web view doesn't go away while waiting for the completion handler to be invoked?
Sam Weinig
Comment 5 2015-04-10 10:53:39 PDT
(In reply to comment #4) > Comment on attachment 250398 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=250398&action=review > > > Source/WebCore/platform/spi/ios/LaunchServicesSPI.h:39 > > +typedef void (^ LSAppLinkOpenCompletionHandler)(BOOL success, NSError *error); > > No space after ^. Fixed. > > > Source/WebKit2/UIProcess/Cocoa/NavigationState.mm:240 > > + dispatch_async(dispatch_get_main_queue(), [completionHandler, success] { > > + completionHandler(success); > > + }); > > This is copying the completion handler on a background queue - that's not > thread safe and will break if the completion handler has bound strings for > example. I think you're going to have to create an std::function pointer and > pass it across the thread boundary and then explicitly delete it on the main > thread. Ok. How about if I just use a block? > > > Source/WebKit2/UIProcess/Cocoa/NavigationState.mm:255 > > + tryAppLink(localNavigationAction, [localListener, localNavigationAction] (bool followedLinkToApp) { > > What's ensuring that the web view doesn't go away while waiting for the > completion handler to be invoked? Nothing, though that should be fine. The listener will be invalidated and thus when it is called with success or failure, it will just do nothing.
Sam Weinig
Comment 6 2015-04-10 18:45:59 PDT
Alexey Proskuryakov
Comment 7 2015-04-10 22:08:35 PDT
Note You need to log in before you can comment on or make changes to this bug.