REGRESSION (PSON): Firefox app lacks Open in New Tab in menu
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Jan 2019 23:30:07 +0000 (23:30 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Jan 2019 23:30:07 +0000 (23:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193366
<rdar://problem/46097212>

Reviewed by Simon Fraser.

Source/WebCore:

* platform/RuntimeApplicationChecks.h:
* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::IOSApplication::isFirefox):
Add a Firefox Mobile bundle check.

Source/WebKit:

A pair of unrelated changes broke Firefox's use of WKWebView internals
to override the long-press menu. Maintain binary compatibility by
introducing linked-on-or-after checks.

* UIProcess/Cocoa/VersionChecks.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::createWebPage):
Disable PSON in Firefox when linked against an SDK where PSON wasn't enabled by default.
Because gestures are very stateful, we always swap them out when swapping
processes (changing that behavior is fairly risky). Also, we don't always
inform the client when we swap processes (only when the process actually crashes),
so they currently don't re-adjust the gesture recognizers when a PSON swap occurs.

* UIProcess/ios/WKContentView.mm:
(-[WKContentView _commonInitializationWithProcessPool:configuration:]):
Synchronously install gesture recognizers under -init when linked against
an SDK before the version that introduces lazy gesture recognizer installation.
r237331 is an optimization that made us lazily install gestures when the
view is parented, but Firefox (and potentially other clients) depend
on them being installed synchronously in order to find and override them.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/RuntimeApplicationChecks.h
Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Cocoa/VersionChecks.h
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/ios/WKContentView.mm

index d3f0521..fdedb8f 100644 (file)
@@ -1,3 +1,16 @@
+2019-01-11  Tim Horton  <timothy_horton@apple.com>
+
+        REGRESSION (PSON): Firefox app lacks Open in New Tab in menu
+        https://bugs.webkit.org/show_bug.cgi?id=193366
+        <rdar://problem/46097212>
+
+        Reviewed by Simon Fraser.
+
+        * platform/RuntimeApplicationChecks.h:
+        * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
+        (WebCore::IOSApplication::isFirefox):
+        Add a Firefox Mobile bundle check.
+
 2019-01-11  Antti Koivisto  <antti@apple.com>
 
         Release assert when removing element with a map element in the shadow tree
index 3285c53..ba0d46f 100644 (file)
@@ -90,6 +90,7 @@ WEBCORE_EXPORT bool isTheSecretSocietyHiddenMystery();
 WEBCORE_EXPORT bool isCardiogram();
 WEBCORE_EXPORT bool isNike();
 bool isMoviStarPlus();
+WEBCORE_EXPORT bool isFirefox();
 
 } // IOSApplication
 
index c54b288..60b2330 100644 (file)
@@ -276,7 +276,13 @@ bool IOSApplication::isMoviStarPlus()
     static bool isMoviStarPlus = applicationBundleIsEqualTo("com.prisatv.yomvi"_s);
     return isMoviStarPlus;
 }
-    
+
+bool IOSApplication::isFirefox()
+{
+    static bool isFirefox = applicationBundleIsEqualTo("org.mozilla.ios.Firefox"_s);
+    return isFirefox;
+}
+
 #endif
 
 } // namespace WebCore
index d53cc33..e7c7878 100644 (file)
@@ -1,3 +1,32 @@
+2019-01-11  Tim Horton  <timothy_horton@apple.com>
+
+        REGRESSION (PSON): Firefox app lacks Open in New Tab in menu
+        https://bugs.webkit.org/show_bug.cgi?id=193366
+        <rdar://problem/46097212>
+
+        Reviewed by Simon Fraser.
+
+        A pair of unrelated changes broke Firefox's use of WKWebView internals
+        to override the long-press menu. Maintain binary compatibility by
+        introducing linked-on-or-after checks.
+
+        * UIProcess/Cocoa/VersionChecks.h:
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::createWebPage):
+        Disable PSON in Firefox when linked against an SDK where PSON wasn't enabled by default.
+        Because gestures are very stateful, we always swap them out when swapping
+        processes (changing that behavior is fairly risky). Also, we don't always
+        inform the client when we swap processes (only when the process actually crashes),
+        so they currently don't re-adjust the gesture recognizers when a PSON swap occurs.
+
+        * UIProcess/ios/WKContentView.mm:
+        (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
+        Synchronously install gesture recognizers under -init when linked against
+        an SDK before the version that introduces lazy gesture recognizer installation.
+        r237331 is an optimization that made us lazily install gestures when the
+        view is parented, but Firefox (and potentially other clients) depend
+        on them being installed synchronously in order to find and override them.
+
 2019-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Introduce IDL files for runtime-enabled UndoManager and UndoItem JavaScript API
index d369507..a9c03ce 100644 (file)
 
 #import <wtf/spi/darwin/dyldSPI.h>
 
+#if USE(APPLE_INTERNAL_SDK)
+#import <WebKitAdditions/VersionChecksAdditions.h>
+#else
+#define DYLD_IOS_VERSION_FIRST_WITH_LAZY_GESTURE_RECOGNIZER_INSTALLATION 0
+#define DYLD_IOS_VERSION_FIRST_WITH_PROCESS_SWAP_ON_CROSS_SITE_NAVIGATION 0
+#endif
+
 namespace WebKit {
 
 enum class SDKVersion : uint32_t {
@@ -41,6 +48,8 @@ enum class SDKVersion : uint32_t {
     FirstWhereScrollViewContentInsetsAreNotObscuringInsets = DYLD_IOS_VERSION_12_0,
     FirstWhereUIScrollViewDoesNotApplyKeyboardInsetsUnconditionally = DYLD_IOS_VERSION_12_0,
     FirstWithMainThreadReleaseAssertionInWebPageProxy = DYLD_IOS_VERSION_12_0,
+    FirstWithLazyGestureRecognizerInstallation = DYLD_IOS_VERSION_FIRST_WITH_LAZY_GESTURE_RECOGNIZER_INSTALLATION,
+    FirstWithProcessSwapOnCrossSiteNavigation = DYLD_IOS_VERSION_FIRST_WITH_PROCESS_SWAP_ON_CROSS_SITE_NAVIGATION,
 #elif PLATFORM(MAC)
     FirstWithNetworkCache = DYLD_MACOSX_VERSION_10_11,
     FirstWithExceptionsForDuplicateCompletionHandlerCalls = DYLD_MACOSX_VERSION_10_13,
index 3f1406e..a628aff 100644 (file)
@@ -87,6 +87,7 @@
 #include <WebCore/Process.h>
 #include <WebCore/ProcessWarming.h>
 #include <WebCore/ResourceRequest.h>
+#include <WebCore/RuntimeApplicationChecks.h>
 #include <pal/SessionID.h>
 #include <wtf/Language.h>
 #include <wtf/MainThread.h>
 #include <WebCore/PlatformDisplay.h>
 #endif
 
+#if PLATFORM(COCOA)
+#include "VersionChecks.h"
+#endif
+
 #ifndef NDEBUG
 #include <wtf/RefCountedLeakCounter.h>
 #endif
@@ -1145,7 +1150,14 @@ Ref<WebPageProxy> WebProcessPool::createWebPage(PageClient& pageClient, Ref<API:
 #endif
 
     auto page = process->createWebPage(pageClient, WTFMove(pageConfiguration));
-    m_configuration->setProcessSwapsOnNavigationFromExperimentalFeatures(page->preferences().processSwapOnCrossSiteNavigationEnabled());
+
+    bool enableProcessSwapOnCrossSiteNavigation = page->preferences().processSwapOnCrossSiteNavigationEnabled();
+#if PLATFORM(IOS_FAMILY)
+    if (WebCore::IOSApplication::isFirefox() && !linkedOnOrAfter(WebKit::SDKVersion::FirstWithProcessSwapOnCrossSiteNavigation))
+        enableProcessSwapOnCrossSiteNavigation = false;
+#endif
+
+    m_configuration->setProcessSwapsOnNavigationFromExperimentalFeatures(enableProcessSwapOnCrossSiteNavigation);
     m_configuration->setShouldCaptureAudioInUIProcess(page->preferences().captureAudioInUIProcessEnabled());
     m_configuration->setShouldCaptureVideoInUIProcess(page->preferences().captureVideoInUIProcessEnabled());
 
index eb2aed5..c27ebca 100644 (file)
@@ -39,6 +39,7 @@
 #import "RemoteScrollingCoordinatorProxy.h"
 #import "SmartMagnificationController.h"
 #import "UIKitSPI.h"
+#import "VersionChecks.h"
 #import "WKBrowsingContextControllerInternal.h"
 #import "WKBrowsingContextGroupPrivate.h"
 #import "WKInspectorHighlightView.h"
@@ -219,6 +220,8 @@ private:
     [self addSubview:_fixedClippingView.get()];
     [_fixedClippingView addSubview:_rootContentView.get()];
 
+    if (!linkedOnOrAfter(WebKit::SDKVersion::FirstWithLazyGestureRecognizerInstallation))
+        [self setupInteraction];
     [self setUserInteractionEnabled:YES];
 
     self.layer.hitTestsAsOpaque = YES;