Title: [197902] trunk/Source
Revision
197902
Author
[email protected]
Date
2016-03-09 16:56:31 -0800 (Wed, 09 Mar 2016)

Log Message

REGRESSION (r197149): Missing availability checks when soft-linking DataDetectors.framework
<http://webkit.org/b/155258>

Reviewed by Andy Estes.

Source/WebCore:

* page/mac/ServicesOverlayController.mm:
(WebCore::ServicesOverlayController::Highlight::setDDHighlight):
(WebCore::ServicesOverlayController::Highlight::paintContents):
(WebCore::ServicesOverlayController::mouseIsOverHighlight):
- Add check that returns early if DataDetectors.framework is not
  available.

* platform/spi/mac/DataDetectorsSPI.h:
- Mark Objective-C classses as optional.

Source/WebKit/mac:

* WebView/WebImmediateActionController.mm:
(-[WebImmediateActionController _clearImmediateActionState]):
(-[WebImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
(-[WebImmediateActionController _animationControllerForDataDetectedText]):
(-[WebImmediateActionController _animationControllerForDataDetectedLink]):
- Add check that returns early if DataDetectors.framework is not
  available.

Source/WebKit2:

* Platform/mac/MenuUtilities.mm:
(WebKit::menuItemForTelephoneNumber):
(WebKit::menuForTelephoneNumber):
- Add check that returns early if DataDetectors.framework is not
  available.

* Shared/mac/WebHitTestResultData.mm:
(WebKit::WebHitTestResultData::platformDecode):
- Add Debug assertion.  The soft-linked code should never be
  called if there was no actionContext passed in.

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::dismissContentRelativeChildWindowsFromViewOnly):
- Protect calls to DDActionsManager with availability check.

* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController _clearImmediateActionState]):
(-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
- Protect calls to DDActionsManager with availability check.
(-[WKImmediateActionController _animationControllerForDataDetectedText]):
(-[WKImmediateActionController _animationControllerForDataDetectedLink]):
- Add check that returns early if DataDetectors.framework is not
  available.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (197901 => 197902)


--- trunk/Source/WebCore/ChangeLog	2016-03-10 00:45:35 UTC (rev 197901)
+++ trunk/Source/WebCore/ChangeLog	2016-03-10 00:56:31 UTC (rev 197902)
@@ -1,3 +1,20 @@
+2016-03-09  David Kilzer  <[email protected]>
+
+        REGRESSION (r197149): Missing availability checks when soft-linking DataDetectors.framework
+        <http://webkit.org/b/155258>
+
+        Reviewed by Andy Estes.
+
+        * page/mac/ServicesOverlayController.mm:
+        (WebCore::ServicesOverlayController::Highlight::setDDHighlight):
+        (WebCore::ServicesOverlayController::Highlight::paintContents):
+        (WebCore::ServicesOverlayController::mouseIsOverHighlight):
+        - Add check that returns early if DataDetectors.framework is not
+          available.
+
+        * platform/spi/mac/DataDetectorsSPI.h:
+        - Mark Objective-C classses as optional.
+
 2016-03-09  Jer Noble  <[email protected]>
 
         Add heuristic for "main content" videos which override user gesture requirements

Modified: trunk/Source/WebCore/page/mac/ServicesOverlayController.mm (197901 => 197902)


--- trunk/Source/WebCore/page/mac/ServicesOverlayController.mm	2016-03-10 00:45:35 UTC (rev 197901)
+++ trunk/Source/WebCore/page/mac/ServicesOverlayController.mm	2016-03-10 00:56:31 UTC (rev 197902)
@@ -94,6 +94,9 @@
 
 void ServicesOverlayController::Highlight::setDDHighlight(DDHighlightRef highlight)
 {
+    if (!DataDetectorsLibrary())
+        return;
+
     if (!m_controller)
         return;
 
@@ -129,6 +132,9 @@
 
 void ServicesOverlayController::Highlight::paintContents(const GraphicsLayer*, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const FloatRect&)
 {
+    if (!DataDetectorsLibrary())
+        return;
+
     CGContextRef cgContext = graphicsContext.platformContext();
 
     CGLayerRef highlightLayer = DDHighlightGetLayerWithContext(ddHighlight(), cgContext);
@@ -425,6 +431,9 @@
 
 bool ServicesOverlayController::mouseIsOverHighlight(Highlight& highlight, bool& mouseIsOverButton) const
 {
+    if (!DataDetectorsLibrary())
+        return false;
+
     Boolean onButton;
     bool hovered = DDHighlightPointIsOnHighlight(highlight.ddHighlight(), (CGPoint)m_mousePosition, &onButton);
     mouseIsOverButton = onButton;

Modified: trunk/Source/WebCore/platform/spi/mac/DataDetectorsSPI.h (197901 => 197902)


--- trunk/Source/WebCore/platform/spi/mac/DataDetectorsSPI.h	2016-03-10 00:45:35 UTC (rev 197901)
+++ trunk/Source/WebCore/platform/spi/mac/DataDetectorsSPI.h	2016-03-10 00:56:31 UTC (rev 197902)
@@ -99,9 +99,9 @@
 
 SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(DataDetectors)
 
-SOFT_LINK_CLASS(DataDetectors, DDAction)
-SOFT_LINK_CLASS(DataDetectors, DDActionContext)
-SOFT_LINK_CLASS(DataDetectors, DDActionsManager)
+SOFT_LINK_CLASS_OPTIONAL(DataDetectors, DDAction)
+SOFT_LINK_CLASS_OPTIONAL(DataDetectors, DDActionContext)
+SOFT_LINK_CLASS_OPTIONAL(DataDetectors, DDActionsManager)
 
 SOFT_LINK_CONSTANT(DataDetectors, DDBinderPhoneNumberKey, CFStringRef)
 

Modified: trunk/Source/WebKit/mac/ChangeLog (197901 => 197902)


--- trunk/Source/WebKit/mac/ChangeLog	2016-03-10 00:45:35 UTC (rev 197901)
+++ trunk/Source/WebKit/mac/ChangeLog	2016-03-10 00:56:31 UTC (rev 197902)
@@ -1,3 +1,18 @@
+2016-03-09  David Kilzer  <[email protected]>
+
+        REGRESSION (r197149): Missing availability checks when soft-linking DataDetectors.framework
+        <http://webkit.org/b/155258>
+
+        Reviewed by Andy Estes.
+
+        * WebView/WebImmediateActionController.mm:
+        (-[WebImmediateActionController _clearImmediateActionState]):
+        (-[WebImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
+        (-[WebImmediateActionController _animationControllerForDataDetectedText]):
+        (-[WebImmediateActionController _animationControllerForDataDetectedLink]):
+        - Add check that returns early if DataDetectors.framework is not
+          available.
+
 2016-03-08  Oliver Hunt  <[email protected]>
 
         Start moving to separated writable and executable mappings in the JIT

Modified: trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm (197901 => 197902)


--- trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm	2016-03-10 00:45:35 UTC (rev 197901)
+++ trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm	2016-03-10 00:56:31 UTC (rev 197902)
@@ -124,6 +124,9 @@
 
 - (void)_clearImmediateActionState
 {
+    if (!DataDetectorsLibrary())
+        return;
+
     DDActionsManager *actionsManager = [getDDActionsManagerClass() sharedManager];
     if ([actionsManager respondsToSelector:@selector(requestBubbleClosureUnanchorOnFailure:)])
         [actionsManager requestBubbleClosureUnanchorOnFailure:YES];
@@ -183,6 +186,9 @@
 
 - (void)immediateActionRecognizerWillBeginAnimation:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer
 {
+    if (!DataDetectorsLibrary())
+        return;
+
     if (immediateActionRecognizer != _immediateActionRecognizer)
         return;
 
@@ -409,6 +415,9 @@
 
 - (id <NSImmediateActionAnimationController>)_animationControllerForDataDetectedText
 {
+    if (!DataDetectorsLibrary())
+        return nil;
+
     RefPtr<Range> detectedDataRange;
     FloatRect detectedDataBoundingBox;
     RetainPtr<DDActionContext> actionContext;
@@ -458,6 +467,9 @@
 
 - (id <NSImmediateActionAnimationController>)_animationControllerForDataDetectedLink
 {
+    if (!DataDetectorsLibrary())
+        return nil;
+
     RetainPtr<DDActionContext> actionContext = adoptNS([allocDDActionContextInstance() init]);
 
     if (!actionContext)

Modified: trunk/Source/WebKit2/ChangeLog (197901 => 197902)


--- trunk/Source/WebKit2/ChangeLog	2016-03-10 00:45:35 UTC (rev 197901)
+++ trunk/Source/WebKit2/ChangeLog	2016-03-10 00:56:31 UTC (rev 197902)
@@ -1,3 +1,34 @@
+2016-03-09  David Kilzer  <[email protected]>
+
+        REGRESSION (r197149): Missing availability checks when soft-linking DataDetectors.framework
+        <http://webkit.org/b/155258>
+
+        Reviewed by Andy Estes.
+
+        * Platform/mac/MenuUtilities.mm:
+        (WebKit::menuItemForTelephoneNumber):
+        (WebKit::menuForTelephoneNumber):
+        - Add check that returns early if DataDetectors.framework is not
+          available.
+
+        * Shared/mac/WebHitTestResultData.mm:
+        (WebKit::WebHitTestResultData::platformDecode):
+        - Add Debug assertion.  The soft-linked code should never be
+          called if there was no actionContext passed in.
+
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::dismissContentRelativeChildWindowsFromViewOnly):
+        - Protect calls to DDActionsManager with availability check.
+
+        * UIProcess/mac/WKImmediateActionController.mm:
+        (-[WKImmediateActionController _clearImmediateActionState]):
+        (-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
+        - Protect calls to DDActionsManager with availability check.
+        (-[WKImmediateActionController _animationControllerForDataDetectedText]):
+        (-[WKImmediateActionController _animationControllerForDataDetectedLink]):
+        - Add check that returns early if DataDetectors.framework is not
+          available.
+
 2016-03-09  Keith Rollin  <[email protected]>
 
         Add state dumping facility

Modified: trunk/Source/WebKit2/Platform/mac/MenuUtilities.mm (197901 => 197902)


--- trunk/Source/WebKit2/Platform/mac/MenuUtilities.mm	2016-03-10 00:45:35 UTC (rev 197901)
+++ trunk/Source/WebKit2/Platform/mac/MenuUtilities.mm	2016-03-10 00:56:31 UTC (rev 197902)
@@ -50,6 +50,9 @@
 
 NSMenuItem *menuItemForTelephoneNumber(const String& telephoneNumber)
 {
+    if (!DataDetectorsLibrary())
+        return nil;
+
     RetainPtr<DDActionContext> actionContext = [[getDDActionContextClass() alloc] init];
     [actionContext setAllowedActionUTIs:@[ @"com.apple.dial" ]];
 
@@ -74,6 +77,9 @@
 
 RetainPtr<NSMenu> menuForTelephoneNumber(const String& telephoneNumber)
 {
+    if (!DataDetectorsLibrary())
+        return nil;
+
     RetainPtr<NSMenu> menu = adoptNS([[NSMenu alloc] init]);
     NSMutableArray *faceTimeItems = [NSMutableArray array];
     NSMenuItem *dialItem = nil;

Modified: trunk/Source/WebKit2/Shared/mac/WebHitTestResultData.mm (197901 => 197902)


--- trunk/Source/WebKit2/Shared/mac/WebHitTestResultData.mm	2016-03-10 00:45:35 UTC (rev 197901)
+++ trunk/Source/WebKit2/Shared/mac/WebHitTestResultData.mm	2016-03-10 00:56:31 UTC (rev 197902)
@@ -69,6 +69,7 @@
 
     if (!hasActionContext)
         return true;
+    ASSERT(DataDetectorsLibrary());
 
     RetainPtr<CFDataRef> data;
     if (!IPC::decode(decoder, data))

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm (197901 => 197902)


--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm	2016-03-10 00:45:35 UTC (rev 197901)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm	2016-03-10 00:56:31 UTC (rev 197902)
@@ -2297,9 +2297,11 @@
     if (m_view.window.isKeyWindow || hasActiveImmediateAction) {
         WebCore::DictionaryLookup::hidePopup();
 
-        DDActionsManager *actionsManager = [getDDActionsManagerClass() sharedManager];
-        if ([actionsManager respondsToSelector:@selector(requestBubbleClosureUnanchorOnFailure:)])
-            [actionsManager requestBubbleClosureUnanchorOnFailure:YES];
+        if (DataDetectorsLibrary()) {
+            DDActionsManager *actionsManager = [getDDActionsManagerClass() sharedManager];
+            if ([actionsManager respondsToSelector:@selector(requestBubbleClosureUnanchorOnFailure:)])
+                [actionsManager requestBubbleClosureUnanchorOnFailure:YES];
+        }
     }
 
     clearTextIndicatorWithAnimation(WebCore::TextIndicatorWindowDismissalAnimation::FadeOut);

Modified: trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm (197901 => 197902)


--- trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm	2016-03-10 00:45:35 UTC (rev 197901)
+++ trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm	2016-03-10 00:56:31 UTC (rev 197902)
@@ -122,7 +122,8 @@
 
     if (_currentActionContext && _hasActivatedActionContext) {
         _hasActivatedActionContext = NO;
-        [getDDActionsManagerClass() didUseActions];
+        if (DataDetectorsLibrary())
+            [getDDActionsManagerClass() didUseActions];
     }
 
     _state = ImmediateActionState::None;
@@ -209,8 +210,10 @@
 
     if (_currentActionContext) {
         _hasActivatedActionContext = YES;
-        if (![getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()])
-            [self _cancelImmediateAction];
+        if (DataDetectorsLibrary()) {
+            if (![getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()])
+                [self _cancelImmediateAction];
+        }
     }
 }
 
@@ -392,6 +395,9 @@
 
 - (id<NSImmediateActionAnimationController>)_animationControllerForDataDetectedText
 {
+    if (!DataDetectorsLibrary())
+        return nil;
+
     DDActionContext *actionContext = _hitTestResultData.detectedDataActionContext.get();
     if (!actionContext)
         return nil;
@@ -428,6 +434,9 @@
 
 - (id<NSImmediateActionAnimationController>)_animationControllerForDataDetectedLink
 {
+    if (!DataDetectorsLibrary())
+        return nil;
+
     RetainPtr<DDActionContext> actionContext = adoptNS([allocDDActionContextInstance() init]);
 
     if (!actionContext)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to