Ignore:
Timestamp:
May 11, 2012, 3:17:00 PM (13 years ago)
Author:
[email protected]
Message:

Clarified JSGlobalData (JavaScript VM) lifetime
https://bugs.webkit.org/show_bug.cgi?id=85142

Reviewed by Alexey Proskuryakov.

(Follow-up fix.)

  • API/JSContextRef.cpp:

(JSGlobalContextCreate): Restored some code I removed because I misread an #ifdef.
(We don't need to test BUILDING_ON_LEOPARD, but we still need the linked-on
test, because apps might have been linked on older OS's.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSContextRef.cpp

    r115579 r116809  
    3939#include <wtf/text/StringHash.h>
    4040
     41#if OS(DARWIN)
     42#include <mach-o/dyld.h>
     43
     44static const int32_t webkitFirstVersionWithConcurrentGlobalContexts = 0x2100500; // 528.5.0
     45#endif
     46
    4147using namespace JSC;
    4248
     
    6874{
    6975    initializeThreading();
     76
     77#if OS(DARWIN)
     78    // If the application was linked before JSGlobalContextCreate was changed to use a unique JSGlobalData,
     79    // we use a shared one for backwards compatibility.
     80    if (NSVersionOfLinkTimeLibrary("JavaScriptCore") <= webkitFirstVersionWithConcurrentGlobalContexts) {
     81        JSLock lock(LockForReal);
     82        return JSGlobalContextCreateInGroup(toRef(&JSGlobalData::sharedInstance()), globalObjectClass);
     83    }
     84#endif // OS(DARWIN)
     85
    7086    return JSGlobalContextCreateInGroup(0, globalObjectClass);
    7187}
Note: See TracChangeset for help on using the changeset viewer.