Title: [202670] trunk/Source/_javascript_Core
Revision
202670
Author
[email protected]
Date
2016-06-29 21:46:51 -0700 (Wed, 29 Jun 2016)

Log Message

REGRESSION(200114): Netflix app does not see ChromeCast
https://bugs.webkit.org/show_bug.cgi?id=159287

Reviewed by Benjamin Poulain.

Change set 200114 changed the behavior of how we check for whether or not we
wrap Objective C init methods in _javascript_ constructors.  The prior method
checked the version of _javascript_Core that was linked with the application.
If the application was not directly linked with _javascript_Core the prior
method indicated that we shouldn't create constructors.  The new method uses
the SDK the application was compiled with.  Using the new method, an
application compiled with iOS SDK 8.0 or greater would create constructors
and not export init methods to _javascript_.  The problem is that an existing
application that hasn't been recompiled will get a different answer using
the new method.  We need to come up with a method that works in a compatible
way with existing programs, but provides a newly compiled program with the
"is built with SDK N or greater" check.
        
Added back the prior check of the version of _javascript_Core the program was
directly linked against.  However we only use this check if we directly linked
with _javascript_Core.  Otherwise we fall through to check against the SDK the
program was built with.  Changed the iOS SDK version we check
against to be the new version of iOS, iOS 10.

This provides compatible behavior for existing programs.  It may be the case
that some of those programs may require changes when they are rebuilt with the
iOS 10 SDK or later.

* API/JSWrapperMap.mm:
(supportsInitMethodConstructors):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSWrapperMap.mm (202669 => 202670)


--- trunk/Source/_javascript_Core/API/JSWrapperMap.mm	2016-06-30 04:46:45 UTC (rev 202669)
+++ trunk/Source/_javascript_Core/API/JSWrapperMap.mm	2016-06-30 04:46:51 UTC (rev 202670)
@@ -27,7 +27,6 @@
 #import "_javascript_Core.h"
 
 #if JSC_OBJC_API_ENABLED
-
 #import "APICast.h"
 #import "JSAPIWrapperObject.h"
 #import "JSCInlines.h"
@@ -46,11 +45,14 @@
 #include <mach-o/dyld.h>
 
 #if PLATFORM(APPLETV)
-#elif PLATFORM(IOS)
-static const uint32_t firstSDKVersionWithInitConstructorSupport = 0x80000; // iOS 8.0.0
+#else
+static const int32_t firstJavaScriptCoreVersionWithInitConstructorSupport = 0x21A0400; // 538.4.0
+#if PLATFORM(IOS)
+static const uint32_t firstSDKVersionWithInitConstructorSupport = DYLD_IOS_VERSION_10_0;
 #elif PLATFORM(MAC)
 static const uint32_t firstSDKVersionWithInitConstructorSupport = 0xA0A00; // OSX 10.10.0
 #endif
+#endif
 
 @class JSObjCClassInfo;
 
@@ -657,9 +659,20 @@
     // There are no old clients on Apple TV, so there's no need for backwards compatibility.
     return true;
 #else
+    // First check to see the version of _javascript_Core we directly linked against.
+    static int32_t versionOfLinkTimeJavaScriptCore = 0;
+    if (!versionOfLinkTimeJavaScriptCore)
+        versionOfLinkTimeJavaScriptCore = NSVersionOfLinkTimeLibrary("_javascript_Core");
+    // Only do the link time version comparison if we linked directly with _javascript_Core
+    if (versionOfLinkTimeJavaScriptCore != -1)
+        return versionOfLinkTimeJavaScriptCore >= firstJavaScriptCoreVersionWithInitConstructorSupport;
+
+    // If we didn't link directly with _javascript_Core,
+    // base our check on what SDK was used to build the application.
     static uint32_t programSDKVersion = 0;
     if (!programSDKVersion)
         programSDKVersion = dyld_get_program_sdk_version();
+
     return programSDKVersion >= firstSDKVersionWithInitConstructorSupport;
 #endif
 }

Modified: trunk/Source/_javascript_Core/ChangeLog (202669 => 202670)


--- trunk/Source/_javascript_Core/ChangeLog	2016-06-30 04:46:45 UTC (rev 202669)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-06-30 04:46:51 UTC (rev 202670)
@@ -1,3 +1,36 @@
+2016-06-29  Michael Saboff  <[email protected]>
+
+        REGRESSION(200114): Netflix app does not see ChromeCast
+        https://bugs.webkit.org/show_bug.cgi?id=159287
+
+        Reviewed by Benjamin Poulain.
+
+        Change set 200114 changed the behavior of how we check for whether or not we
+        wrap Objective C init methods in _javascript_ constructors.  The prior method
+        checked the version of _javascript_Core that was linked with the application.
+        If the application was not directly linked with _javascript_Core the prior
+        method indicated that we shouldn't create constructors.  The new method uses
+        the SDK the application was compiled with.  Using the new method, an
+        application compiled with iOS SDK 8.0 or greater would create constructors
+        and not export init methods to _javascript_.  The problem is that an existing
+        application that hasn't been recompiled will get a different answer using
+        the new method.  We need to come up with a method that works in a compatible
+        way with existing programs, but provides a newly compiled program with the
+        "is built with SDK N or greater" check.
+        
+        Added back the prior check of the version of _javascript_Core the program was
+        directly linked against.  However we only use this check if we directly linked
+        with _javascript_Core.  Otherwise we fall through to check against the SDK the
+        program was built with.  Changed the iOS SDK version we check
+        against to be the new version of iOS, iOS 10.
+
+        This provides compatible behavior for existing programs.  It may be the case
+        that some of those programs may require changes when they are rebuilt with the
+        iOS 10 SDK or later.
+
+        * API/JSWrapperMap.mm:
+        (supportsInitMethodConstructors):
+
 2016-06-29  Benjamin Poulain  <[email protected]>
 
         [JSC] Minor TypedArray fixes
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to