WebKit Bugzilla
Attachment 362139 Details for
Bug 158496
: WKWebView should expose API for disabling/enabling navigating Universal Links to native applications
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-158496-20190215114857.patch (text/plain), 4.54 KB, created by
michaeldo
on 2019-02-15 11:48:58 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
michaeldo
Created:
2019-02-15 11:48:58 PST
Size:
4.54 KB
patch
obsolete
>Subversion Revision: 241319 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 6a3f7cac7a34f88dbc88773c448769d59d1543c7..912e3fbbe7ff656085115c77901763b7c7546d0a 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,22 @@ >+2019-02-15 Mike Dougherty <michaeldo@chromium.org> >+ >+ Add preference to control opening universal links in navtive applications. >+ https://bugs.webkit.org/show_bug.cgi?id=158496 >+ <rdar://problem/26683207> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Shared/WebPreferences.yaml: >+ * UIProcess/API/Cocoa/WKPreferences.mm: >+ (-[WKPreferences _setLaunchNativeApplicationsEnabled:]): >+ (-[WKPreferences _launchNativeApplicationsEnabled]): >+ * UIProcess/API/Cocoa/WKPreferencesPrivate.h: >+ Add private preference to control whether or not native applications can handle navigations to universal links. >+ >+ * UIProcess/Cocoa/NavigationState.mm: >+ (WebKit::tryInterceptNavigation): >+ Check newly added preference value to determine if a native application should handle the navigation. >+ > 2019-02-12 Alex Christensen <achristensen@webkit.org> > > Remove setDefersLoading infrastructure from WebKit2 >diff --git a/Source/WebKit/Shared/WebPreferences.yaml b/Source/WebKit/Shared/WebPreferences.yaml >index cce4ace8356325e7a0a00e523f9e4c992f9152ff..b6d0de05add6dae3bd617faf3fbfb917991878e9 100644 >--- a/Source/WebKit/Shared/WebPreferences.yaml >+++ b/Source/WebKit/Shared/WebPreferences.yaml >@@ -1009,6 +1009,11 @@ ShouldIgnoreMetaViewport: > type: bool > defaultValue: false > >+LaunchNativeApplicationsEnabled: >+ type: bool >+ defaultValue: true >+ webcoreBinding: none >+ > # Debug Preferences > > AcceleratedDrawingEnabled: >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm b/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm >index 461c8754f94073c17788cf7ae9ce7cba97064125..0963a5216f4b763bd937ffdf309ff4ba900d4396 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm >@@ -1372,6 +1372,16 @@ - (BOOL)_deviceOrientationEventEnabled > #endif > } > >+- (void)_setLaunchNativeApplicationsEnabled:(BOOL)enabled >+{ >+ return _preferences->setLaunchNativeApplicationsEnabled(enabled); >+} >+ >+- (BOOL)_launchNativeApplicationsEnabled >+{ >+ return _preferences->launchNativeApplicationsEnabled(); >+} >+ > @end > > #endif // WK_API_ENABLED >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h b/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h >index cb39fa8e04e128b9be3c6c1a703d21f2244d21a9..3633e97a4c46ee4f5ca0e7503a23a55f34ae4d1f 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h >@@ -154,6 +154,7 @@ typedef NS_ENUM(NSInteger, _WKEditableLinkBehavior) { > @property (nonatomic, setter=_setNeedsSiteSpecificQuirks:) BOOL _needsSiteSpecificQuirks WK_API_AVAILABLE(macosx(10.13.4), ios(WK_IOS_TBA)); > @property (nonatomic, setter=_setItpDebugModeEnabled:) BOOL _itpDebugModeEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); > @property (nonatomic, setter=_setMediaSourceEnabled:) BOOL _mediaSourceEnabled WK_API_AVAILABLE(macosx(10.13.4), ios(WK_IOS_TBA)); >+@property (nonatomic, setter=_setLaunchNativeApplicationsEnabled:) BOOL _launchNativeApplicationsEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); > > #if !TARGET_OS_IPHONE > @property (nonatomic, setter=_setWebGLEnabled:) BOOL _webGLEnabled WK_API_AVAILABLE(macosx(10.13.4)); >diff --git a/Source/WebKit/UIProcess/Cocoa/NavigationState.mm b/Source/WebKit/UIProcess/Cocoa/NavigationState.mm >index b050b6d07efc08c0b20ca9de135ca9aa3410db44..900b9ad1e34e5db28f823833ebfe6cab951bf088 100644 >--- a/Source/WebKit/UIProcess/Cocoa/NavigationState.mm >+++ b/Source/WebKit/UIProcess/Cocoa/NavigationState.mm >@@ -478,7 +478,7 @@ static void tryOptimizingLoad(const WebCore::ResourceRequest&, WebPageProxy&, Fu > static void tryInterceptNavigation(Ref<API::NavigationAction>&& navigationAction, WebPageProxy& page, WTF::Function<void(bool)>&& completionHandler) > { > #if HAVE(APP_LINKS) >- if (navigationAction->shouldOpenAppLinks()) { >+ if (navigationAction->shouldOpenAppLinks() && page.preferences().launchNativeApplicationsEnabled()) { > 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) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
michaeldo:
review?
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 158496
: 362139