Changeset 202670 in webkit


Ignore:
Timestamp:
Jun 29, 2016 9:46:51 PM (8 years ago)
Author:
msaboff@apple.com
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 JavaScriptCore that was linked with the application.
If the application was not directly linked with JavaScriptCore 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 JavaScriptCore the program was
directly linked against. However we only use this check if we directly linked
with JavaScriptCore. 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):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSWrapperMap.mm

    r200866 r202670  
    2828
    2929#if JSC_OBJC_API_ENABLED
    30 
    3130#import "APICast.h"
    3231#import "JSAPIWrapperObject.h"
     
    4746
    4847#if PLATFORM(APPLETV)
    49 #elif PLATFORM(IOS)
    50 static const uint32_t firstSDKVersionWithInitConstructorSupport = 0x80000; // iOS 8.0.0
     48#else
     49static const int32_t firstJavaScriptCoreVersionWithInitConstructorSupport = 0x21A0400; // 538.4.0
     50#if PLATFORM(IOS)
     51static const uint32_t firstSDKVersionWithInitConstructorSupport = DYLD_IOS_VERSION_10_0;
    5152#elif PLATFORM(MAC)
    5253static const uint32_t firstSDKVersionWithInitConstructorSupport = 0xA0A00; // OSX 10.10.0
     54#endif
    5355#endif
    5456
     
    658660    return true;
    659661#else
     662    // First check to see the version of JavaScriptCore we directly linked against.
     663    static int32_t versionOfLinkTimeJavaScriptCore = 0;
     664    if (!versionOfLinkTimeJavaScriptCore)
     665        versionOfLinkTimeJavaScriptCore = NSVersionOfLinkTimeLibrary("JavaScriptCore");
     666    // Only do the link time version comparison if we linked directly with JavaScriptCore
     667    if (versionOfLinkTimeJavaScriptCore != -1)
     668        return versionOfLinkTimeJavaScriptCore >= firstJavaScriptCoreVersionWithInitConstructorSupport;
     669
     670    // If we didn't link directly with JavaScriptCore,
     671    // base our check on what SDK was used to build the application.
    660672    static uint32_t programSDKVersion = 0;
    661673    if (!programSDKVersion)
    662674        programSDKVersion = dyld_get_program_sdk_version();
     675
    663676    return programSDKVersion >= firstSDKVersionWithInitConstructorSupport;
    664677#endif
  • trunk/Source/JavaScriptCore/ChangeLog

    r202667 r202670  
     12016-06-29  Michael Saboff  <msaboff@apple.com>
     2
     3        REGRESSION(200114): Netflix app does not see ChromeCast
     4        https://bugs.webkit.org/show_bug.cgi?id=159287
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        Change set 200114 changed the behavior of how we check for whether or not we
     9        wrap Objective C init methods in JavaScript constructors.  The prior method
     10        checked the version of JavaScriptCore that was linked with the application.
     11        If the application was not directly linked with JavaScriptCore the prior
     12        method indicated that we shouldn't create constructors.  The new method uses
     13        the SDK the application was compiled with.  Using the new method, an
     14        application compiled with iOS SDK 8.0 or greater would create constructors
     15        and not export init methods to JavaScript.  The problem is that an existing
     16        application that hasn't been recompiled will get a different answer using
     17        the new method.  We need to come up with a method that works in a compatible
     18        way with existing programs, but provides a newly compiled program with the
     19        "is built with SDK N or greater" check.
     20       
     21        Added back the prior check of the version of JavaScriptCore the program was
     22        directly linked against.  However we only use this check if we directly linked
     23        with JavaScriptCore.  Otherwise we fall through to check against the SDK the
     24        program was built with.  Changed the iOS SDK version we check
     25        against to be the new version of iOS, iOS 10.
     26
     27        This provides compatible behavior for existing programs.  It may be the case
     28        that some of those programs may require changes when they are rebuilt with the
     29        iOS 10 SDK or later.
     30
     31        * API/JSWrapperMap.mm:
     32        (supportsInitMethodConstructors):
     33
    1342016-06-29  Benjamin Poulain  <bpoulain@apple.com>
    235
Note: See TracChangeset for help on using the changeset viewer.