RESOLVED FIXED209686
[iOS] Delay process suspension for a while after loading an app link
https://bugs.webkit.org/show_bug.cgi?id=209686
Summary [iOS] Delay process suspension for a while after loading an app link
Chris Dumez
Reported 2020-03-27 15:34:04 PDT
Delay process suspension for a while after loading an app link. This will allow the page's script to pass information more reliably to the native app handling the navigation.
Attachments
Patch (5.56 KB, patch)
2020-03-27 15:38 PDT, Chris Dumez
no flags
Patch (5.73 KB, patch)
2020-03-27 16:10 PDT, Chris Dumez
no flags
Follow-up (1.78 KB, patch)
2020-03-27 19:34 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2020-03-27 15:34:36 PDT
Chris Dumez
Comment 2 2020-03-27 15:38:24 PDT
Darin Adler
Comment 3 2020-03-27 15:49:42 PDT
Comment on attachment 394765 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=394765&action=review > Source/WebKit/ChangeLog:13 > + This patch adds a [WKWebView _willOpenAppLink] SPI that the client needs to call before opening the > + app link. Why SPI instead of API? > Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:1550 > + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(25 * NSEC_PER_SEC)), dispatch_get_main_queue(), [weakThis = makeWeakPtr(*this)] { Seems like typecasting 25 seconds to int64_t *after* doing the multiplication is too late to avoid overflow. I understand know why a typecast is needed at all, but if one is needed, I’d think we’d need to cast before doing the math. The comment should explain where the 25 second duration comes from, its rationale, so someone doesn’t just change it randomly later without understanding how we chose 25 seconds.
Chris Dumez
Comment 4 2020-03-27 15:52:39 PDT
(In reply to Darin Adler from comment #3) > Comment on attachment 394765 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=394765&action=review > > > Source/WebKit/ChangeLog:13 > > + This patch adds a [WKWebView _willOpenAppLink] SPI that the client needs to call before opening the > > + app link. > > Why SPI instead of API? For now, I am merely trying to address the issue in MobileSafari and SVC so an SPI is sufficient. I am not aware of this being requested by app developers. If it ever does, we can think about it harder and provide some kind of SPI. > > > Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:1550 > > + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(25 * NSEC_PER_SEC)), dispatch_get_main_queue(), [weakThis = makeWeakPtr(*this)] { > > Seems like typecasting 25 seconds to int64_t *after* doing the > multiplication is too late to avoid overflow. I understand know why a > typecast is needed at all, but if one is needed, I’d think we’d need to cast > before doing the math. > > The comment should explain where the 25 second duration comes from, its > rationale, so someone doesn’t just change it randomly later without > understanding how we chose 25 seconds. I will check. I copy / pasted from existing code :)
Chris Dumez
Comment 5 2020-03-27 16:10:50 PDT
EWS
Comment 6 2020-03-27 16:44:52 PDT
Committed r259146: <https://trac.webkit.org/changeset/259146> All reviewed patches have been landed. Closing bug and clearing flags on attachment 394768 [details].
Darin Adler
Comment 7 2020-03-27 16:58:01 PDT
Comment on attachment 394765 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=394765&action=review >>> Source/WebKit/ChangeLog:13 >>> + app link. >> >> Why SPI instead of API? > > For now, I am merely trying to address the issue in MobileSafari and SVC so an SPI is sufficient. I am not aware of this being requested by app developers. If it ever does, we can think about it harder and provide some kind of SPI. Not needed by other iOS browsers?
Chris Dumez
Comment 8 2020-03-27 18:43:01 PDT
(In reply to Darin Adler from comment #7) > Comment on attachment 394765 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=394765&action=review > > >>> Source/WebKit/ChangeLog:13 > >>> + app link. > >> > >> Why SPI instead of API? > > > > For now, I am merely trying to address the issue in MobileSafari and SVC so an SPI is sufficient. I am not aware of this being requested by app developers. If it ever does, we can think about it harder and provide some kind of SPI. > > Not needed by other iOS browsers? Looks like in other apps than Safari, WebKit takes care of opening AppLinks in tryInterceptNavigation(), in NavigationState.mm. I will update that method in a follow-up.
Chris Dumez
Comment 9 2020-03-27 19:31:50 PDT
Reopening for follow-up.
Chris Dumez
Comment 10 2020-03-27 19:34:44 PDT
Created attachment 394783 [details] Follow-up
EWS
Comment 11 2020-03-28 19:05:46 PDT
Committed r259166: <https://trac.webkit.org/changeset/259166> All reviewed patches have been landed. Closing bug and clearing flags on attachment 394783 [details].
Darin Adler
Comment 12 2020-03-28 22:55:33 PDT
Comment on attachment 394783 [details] Follow-up View in context: https://bugs.webkit.org/attachment.cgi?id=394783&action=review > Source/WebKit/UIProcess/Cocoa/NavigationState.mm:511 > + if (success && weakPage) > + weakPage->willOpenAppLink(); This breaking the build on newer versions of Mac. Needs to be inside #if PLATFORM(IOS_FAMILY) because the code in WebPageProxy.h is inside that.
David Kilzer (:ddkilzer)
Comment 13 2020-03-29 02:09:44 PDT
Comment on attachment 394783 [details] Follow-up View in context: https://bugs.webkit.org/attachment.cgi?id=394783&action=review >> Source/WebKit/UIProcess/Cocoa/NavigationState.mm:511 >> + weakPage->willOpenAppLink(); > > This breaking the build on newer versions of Mac. Needs to be inside #if PLATFORM(IOS_FAMILY) because the code in WebPageProxy.h is inside that. Fixed in commit r259177: <https://trac.webkit.org/changeset/259177/webkit> Fixed my missing ChangeLog entry in r259178: <https://trac.webkit.org/changeset/259178/webkit>
Note You need to log in before you can comment on or make changes to this bug.