Title: [241309] trunk/Source
Revision
241309
Author
[email protected]
Date
2019-02-12 11:58:19 -0800 (Tue, 12 Feb 2019)

Log Message

REGRESSION (r238955, r240494): Soft-linking optional Lookup.framework triggers release assertion when missing
<https://webkit.org/b/194529>
<rdar://problem/47924449>

Reviewed by Eric Carlson.

Source/WebCore:

* SourcesCocoa.txt:
- Do not include DataDetectorsCoreSoftLink.mm in unified
  sources.
* WebCore.xcodeproj/project.pbxproj:
- Add DataDetectorsCoreSoftLink.mm to the WebCore target now
  that it isn't part of the unifed sources.
* platform/cocoa/DataDetectorsCoreSoftLink.mm:
- Switch from using SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL() to
  SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE() when linking
  DataDetectorsCore.framework. None of the other macros assume
  this framework is optional, and it was likely made optional
  originally because the framework was new to iOS and thus
  didn't exist on older versions.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
- Change use of SOFT_LINK_CLASS_FOR_SOURCE() macros to
  SOFT_LINK_CLASS() since the latter can only be used with
  SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation).  This broke after
  the fix for <wtf/SoftLinking.h> was applied.

Source/WTF:

* wtf/cocoa/SoftLinking.h:
(SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_IS_OPTIONAL): Rename
SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_ASSERTION() to this
and change `assertion` argument to `isOptional`.  Pass
`isOptional` to framework##Library() method to control assertion
behavior.  Only check RELEASE_ASSERT() if `!isOptional`, else
that code should be optimized out by the compiler.  This fixes
the crash.
(NO_ASSERT): Remove macro since it's no longer used.
(SOFT_LINK_IS_OPTIONAL): Add macro to use for soft-linking
optional classes.
(SOFT_LINK_IS_NOT_OPTIONAL): Add macro to use for soft-linking
non-optional classes.
(SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT): Update to use new
SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_IS_OPTIONAL() macro.
(SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL_WITH_EXPORT): Ditto.
(SOFT_LINK_CLASS_FOR_SOURCE): Ditto.
(SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (241308 => 241309)


--- trunk/Source/WTF/ChangeLog	2019-02-12 19:53:24 UTC (rev 241308)
+++ trunk/Source/WTF/ChangeLog	2019-02-12 19:58:19 UTC (rev 241309)
@@ -1,3 +1,30 @@
+2019-02-12  David Kilzer  <[email protected]>
+
+        REGRESSION (r238955, r240494): Soft-linking optional Lookup.framework triggers release assertion when missing
+        <https://webkit.org/b/194529>
+        <rdar://problem/47924449>
+
+        Reviewed by Eric Carlson.
+
+        * wtf/cocoa/SoftLinking.h:
+        (SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_IS_OPTIONAL): Rename
+        SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_ASSERTION() to this
+        and change `assertion` argument to `isOptional`.  Pass
+        `isOptional` to framework##Library() method to control assertion
+        behavior.  Only check RELEASE_ASSERT() if `!isOptional`, else
+        that code should be optimized out by the compiler.  This fixes
+        the crash.
+        (NO_ASSERT): Remove macro since it's no longer used.
+        (SOFT_LINK_IS_OPTIONAL): Add macro to use for soft-linking
+        optional classes.
+        (SOFT_LINK_IS_NOT_OPTIONAL): Add macro to use for soft-linking
+        non-optional classes.
+        (SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT): Update to use new
+        SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_IS_OPTIONAL() macro.
+        (SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL_WITH_EXPORT): Ditto.
+        (SOFT_LINK_CLASS_FOR_SOURCE): Ditto.
+        (SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL): Ditto.
+
 2019-02-12  Andy Estes  <[email protected]>
 
         [iOSMac] Enable Parental Controls Content Filtering

Modified: trunk/Source/WTF/wtf/cocoa/SoftLinking.h (241308 => 241309)


--- trunk/Source/WTF/wtf/cocoa/SoftLinking.h	2019-02-12 19:53:24 UTC (rev 241308)
+++ trunk/Source/WTF/wtf/cocoa/SoftLinking.h	2019-02-12 19:58:19 UTC (rev 241309)
@@ -389,7 +389,7 @@
     } \
     }
 
-#define SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_ASSERTION(functionNamespace, framework, className, export, assertion) \
+#define SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_IS_OPTIONAL(functionNamespace, framework, className, export, isOptional) \
     @class className; \
     namespace functionNamespace { \
     static Class init##className(); \
@@ -405,9 +405,10 @@
     { \
         static dispatch_once_t once; \
         dispatch_once(&once, ^{ \
-            framework##Library(); \
+            framework##Library(isOptional); \
             class##className = objc_getClass(#className); \
-            assertion(class##className); \
+            if (!isOptional) \
+                RELEASE_ASSERT(class##className); \
             get##className##Class = className##Function; \
         }); \
         return class##className; \
@@ -414,19 +415,20 @@
     } \
     }
 
-#define NO_ASSERT(assertion) (void(0))
+#define SOFT_LINK_IS_OPTIONAL true
+#define SOFT_LINK_IS_NOT_OPTIONAL false
 
 #define SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(functionNamespace, framework, className, export) \
-    SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_ASSERTION(functionNamespace, framework, className, export, RELEASE_ASSERT)
+    SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_IS_OPTIONAL(functionNamespace, framework, className, export, SOFT_LINK_IS_NOT_OPTIONAL)
 
 #define SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL_WITH_EXPORT(functionNamespace, framework, className, export) \
-    SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_ASSERTION(functionNamespace, framework, className, export, NO_ASSERT)
+    SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_IS_OPTIONAL(functionNamespace, framework, className, export, SOFT_LINK_IS_OPTIONAL)
 
 #define SOFT_LINK_CLASS_FOR_SOURCE(functionNamespace, framework, className) \
-    SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_ASSERTION(functionNamespace, framework, className, , RELEASE_ASSERT)
+    SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_IS_OPTIONAL(functionNamespace, framework, className, , SOFT_LINK_IS_NOT_OPTIONAL)
 
 #define SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL(functionNamespace, framework, className) \
-    SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_ASSERTION(functionNamespace, framework, className, , NO_ASSERT)
+    SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_IS_OPTIONAL(functionNamespace, framework, className, , SOFT_LINK_IS_OPTIONAL)
 
 #define SOFT_LINK_CONSTANT_FOR_HEADER(functionNamespace, framework, variableName, variableType) \
     namespace functionNamespace { \

Modified: trunk/Source/WebCore/ChangeLog (241308 => 241309)


--- trunk/Source/WebCore/ChangeLog	2019-02-12 19:53:24 UTC (rev 241308)
+++ trunk/Source/WebCore/ChangeLog	2019-02-12 19:58:19 UTC (rev 241309)
@@ -1,3 +1,30 @@
+2019-02-12  David Kilzer  <[email protected]>
+
+        REGRESSION (r238955, r240494): Soft-linking optional Lookup.framework triggers release assertion when missing
+        <https://webkit.org/b/194529>
+        <rdar://problem/47924449>
+
+        Reviewed by Eric Carlson.
+
+        * SourcesCocoa.txt:
+        - Do not include DataDetectorsCoreSoftLink.mm in unified
+          sources.
+        * WebCore.xcodeproj/project.pbxproj:
+        - Add DataDetectorsCoreSoftLink.mm to the WebCore target now
+          that it isn't part of the unifed sources.
+        * platform/cocoa/DataDetectorsCoreSoftLink.mm:
+        - Switch from using SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL() to
+          SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE() when linking
+          DataDetectorsCore.framework. None of the other macros assume
+          this framework is optional, and it was likely made optional
+          originally because the framework was new to iOS and thus
+          didn't exist on older versions.
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        - Change use of SOFT_LINK_CLASS_FOR_SOURCE() macros to
+          SOFT_LINK_CLASS() since the latter can only be used with
+          SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation).  This broke after
+          the fix for <wtf/SoftLinking.h> was applied.
+
 2019-02-12  Youenn Fablet  <[email protected]>
 
         Make use of is<SubresourceLoader>

Modified: trunk/Source/WebCore/SourcesCocoa.txt (241308 => 241309)


--- trunk/Source/WebCore/SourcesCocoa.txt	2019-02-12 19:53:24 UTC (rev 241308)
+++ trunk/Source/WebCore/SourcesCocoa.txt	2019-02-12 19:58:19 UTC (rev 241309)
@@ -189,7 +189,7 @@
 
 platform/cocoa/ContentFilterUnblockHandlerCocoa.mm @no-unify
 platform/cocoa/CoreVideoSoftLink.cpp
-platform/cocoa/DataDetectorsCoreSoftLink.mm
+platform/cocoa/DataDetectorsCoreSoftLink.mm @no-unify
 platform/cocoa/FileMonitorCocoa.mm
 platform/cocoa/KeyEventCocoa.mm
 platform/cocoa/LocalizedStringsCocoa.mm

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (241308 => 241309)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-02-12 19:53:24 UTC (rev 241308)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-02-12 19:58:19 UTC (rev 241309)
@@ -1233,6 +1233,7 @@
 		43EDD67F1B485DBF00640E75 /* CombinedFiltersAlphabet.h in Headers */ = {isa = PBXBuildFile; fileRef = 43EDD67D1B485DBF00640E75 /* CombinedFiltersAlphabet.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		4415292E0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4415292C0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		445775E520472F73008DCE5D /* LocalDefaultSystemAppearance.h in Headers */ = {isa = PBXBuildFile; fileRef = 445775E420472F73008DCE5D /* LocalDefaultSystemAppearance.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		4463CF682212FA68001A8577 /* DataDetectorsCoreSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C7941E21C56C29300A4C58E /* DataDetectorsCoreSoftLink.mm */; };
 		4471710E205AF945000A116E /* MediaQueryParserContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 4471710C205AF945000A116E /* MediaQueryParserContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		447958041643B49A001E0A7F /* ParsedContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 447958031643B47B001E0A7F /* ParsedContentType.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		448A29BF0A46D9CB0030759F /* JSHTMLOptionsCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 448A29BD0A46D9CB0030759F /* JSHTMLOptionsCollection.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -32921,6 +32922,7 @@
 				46C696CC1E7205FC00597937 /* CPUMonitor.cpp in Sources */,
 				1ABA76CA11D20E50004C201C /* CSSPropertyNames.cpp in Sources */,
 				BE23480C18A9870B00E4B6E8 /* DataCue.cpp in Sources */,
+				4463CF682212FA68001A8577 /* DataDetectorsCoreSoftLink.mm in Sources */,
 				E58B45BB20AD07DD00991025 /* DataListButtonElement.cpp in Sources */,
 				515BE18F1D54F5FB00DD7C68 /* EmptyGamepadProvider.cpp in Sources */,
 				724ED32C1A3A7E5400F5F13C /* EXTBlendMinMax.cpp in Sources */,

Modified: trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.mm (241308 => 241309)


--- trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.mm	2019-02-12 19:53:24 UTC (rev 241308)
+++ trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.mm	2019-02-12 19:58:19 UTC (rev 241309)
@@ -28,7 +28,7 @@
 
 #if PLATFORM(IOS_FAMILY) && ENABLE(DATA_DETECTION)
 
-SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(DataDetectorsCore)
+SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE(WebCore, DataDetectorsCore)
 
 SOFT_LINK_CLASS_FOR_SOURCE(WebCore, DataDetectorsCore, DDScannerResult)
 SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDScannerCreate, DDScannerRef, (DDScannerType type, DDScannerOptions options, CFErrorRef * errorRef), (type, options, errorRef))

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (241308 => 241309)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2019-02-12 19:53:24 UTC (rev 241308)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2019-02-12 19:58:19 UTC (rev 241309)
@@ -154,14 +154,14 @@
 
 SOFT_LINK_FRAMEWORK_OPTIONAL(CoreImage)
 
-SOFT_LINK_CLASS_FOR_SOURCE(WebCore, AVFoundation, AVPlayer)
-SOFT_LINK_CLASS_FOR_SOURCE(WebCore, AVFoundation, AVPlayerItem)
-SOFT_LINK_CLASS_FOR_SOURCE(WebCore, AVFoundation, AVPlayerItemVideoOutput)
-SOFT_LINK_CLASS_FOR_SOURCE(WebCore, AVFoundation, AVPlayerLayer)
-SOFT_LINK_CLASS_FOR_SOURCE(WebCore, AVFoundation, AVURLAsset)
-SOFT_LINK_CLASS_FOR_SOURCE(WebCore, AVFoundation, AVAssetImageGenerator)
-SOFT_LINK_CLASS_FOR_SOURCE(WebCore, AVFoundation, AVMetadataItem)
-SOFT_LINK_CLASS_FOR_SOURCE(WebCore, AVFoundation, AVAssetCache)
+SOFT_LINK_CLASS(AVFoundation, AVPlayer)
+SOFT_LINK_CLASS(AVFoundation, AVPlayerItem)
+SOFT_LINK_CLASS(AVFoundation, AVPlayerItemVideoOutput)
+SOFT_LINK_CLASS(AVFoundation, AVPlayerLayer)
+SOFT_LINK_CLASS(AVFoundation, AVURLAsset)
+SOFT_LINK_CLASS(AVFoundation, AVAssetImageGenerator)
+SOFT_LINK_CLASS(AVFoundation, AVMetadataItem)
+SOFT_LINK_CLASS(AVFoundation, AVAssetCache)
 
 SOFT_LINK_CLASS(CoreImage, CIContext)
 SOFT_LINK_CLASS(CoreImage, CIImage)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to