Objective-C objects that are passed to JavaScript leak (until the JSContext is destroyed)
authormhahnenberg@apple.com <mhahnenberg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Jan 2013 20:56:20 +0000 (20:56 +0000)
committermhahnenberg@apple.com <mhahnenberg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Jan 2013 20:56:20 +0000 (20:56 +0000)
commit30bfb6e977044eb131cb21ca3d3de7789b925fba
tree2bbf10c5ebe52927ec9265eafa53b49e80e28a17
parent9fa957b7653e6c80b17579f43ad876b91d62dbd9
Objective-C objects that are passed to JavaScript leak (until the JSContext is destroyed)
https://bugs.webkit.org/show_bug.cgi?id=106056

Reviewed by Darin Adler.

* API/APIJSValue.h:
* API/JSValue.mm: Make the reference to the JSContext strong.
(-[JSValue context]):
(-[JSValue initWithValue:inContext:]):
(-[JSValue dealloc]):
* API/JSWrapperMap.mm: Make the reference back from wrappers to Obj-C objects weak instead of strong.
Also add an explicit WeakGCMap in the JSWrapperMap rather than using Obj-C associated object API which
was causing memory leaks.
(wrapperClass):
(-[JSObjCClassInfo wrapperForObject:]):
(-[JSWrapperMap initWithContext:]):
(-[JSWrapperMap dealloc]):
(-[JSWrapperMap wrapperForObject:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139486 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/API/APIJSValue.h
Source/JavaScriptCore/API/JSValue.mm
Source/JavaScriptCore/API/JSWrapperMap.mm
Source/JavaScriptCore/ChangeLog