Title: [116809] trunk/Source/_javascript_Core
- Revision
- 116809
- Author
- [email protected]
- Date
- 2012-05-11 15:17:00 -0700 (Fri, 11 May 2012)
Log 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.)
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/API/JSContextRef.cpp (116808 => 116809)
--- trunk/Source/_javascript_Core/API/JSContextRef.cpp 2012-05-11 21:53:20 UTC (rev 116808)
+++ trunk/Source/_javascript_Core/API/JSContextRef.cpp 2012-05-11 22:17:00 UTC (rev 116809)
@@ -38,6 +38,12 @@
#include "UStringBuilder.h"
#include <wtf/text/StringHash.h>
+#if OS(DARWIN)
+#include <mach-o/dyld.h>
+
+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 @@
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("_javascript_Core") <= webkitFirstVersionWithConcurrentGlobalContexts) {
+ JSLock lock(LockForReal);
+ return JSGlobalContextCreateInGroup(toRef(&JSGlobalData::sharedInstance()), globalObjectClass);
+ }
+#endif // OS(DARWIN)
+
return JSGlobalContextCreateInGroup(0, globalObjectClass);
}
Modified: trunk/Source/_javascript_Core/ChangeLog (116808 => 116809)
--- trunk/Source/_javascript_Core/ChangeLog 2012-05-11 21:53:20 UTC (rev 116808)
+++ trunk/Source/_javascript_Core/ChangeLog 2012-05-11 22:17:00 UTC (rev 116809)
@@ -1,3 +1,17 @@
+2012-05-11 Geoffrey Garen <[email protected]>
+
+ 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.)
+
2012-05-11 Sam Weinig <[email protected]>
Fix crash seen when running with libgmalloc
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes