From 8d473cf9743f1d30a16a27114e93bd5af5648d23 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 18 May 2012 14:03:11 +0200 Subject: Imported WebKit commit 1350e72f7345ced9da2bd9980deeeb5a8d62fab4 (http://svn.webkit.org/repository/webkit/trunk@117578) Weekly snapshot --- Source/JavaScriptCore/API/JSContextRef.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'Source/JavaScriptCore/API/JSContextRef.cpp') diff --git a/Source/JavaScriptCore/API/JSContextRef.cpp b/Source/JavaScriptCore/API/JSContextRef.cpp index 746febfbb..92e03a671 100644 --- a/Source/JavaScriptCore/API/JSContextRef.cpp +++ b/Source/JavaScriptCore/API/JSContextRef.cpp @@ -38,6 +38,12 @@ #include "UStringBuilder.h" #include +#if OS(DARWIN) +#include + +static const int32_t webkitFirstVersionWithConcurrentGlobalContexts = 0x2100500; // 528.5.0 +#endif + using namespace JSC; // From the API's perspective, a context group remains alive iff @@ -67,6 +73,16 @@ void JSContextGroupRelease(JSContextGroupRef group) JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass) { initializeThreading(); + +#if OS(DARWIN) + // If the application was linked before JSGlobalContextCreate was changed to use a unique JSGlobalData, + // we use a shared one for backwards compatibility. + if (NSVersionOfLinkTimeLibrary("JavaScriptCore") <= webkitFirstVersionWithConcurrentGlobalContexts) { + JSLock lock(LockForReal); + return JSGlobalContextCreateInGroup(toRef(&JSGlobalData::sharedInstance()), globalObjectClass); + } +#endif // OS(DARWIN) + return JSGlobalContextCreateInGroup(0, globalObjectClass); } -- cgit v1.2.1