Title: [217952] trunk/Source/_javascript_Core
Revision
217952
Author
[email protected]
Date
2017-06-08 15:24:11 -0700 (Thu, 08 Jun 2017)

Log Message

[Cocoa] JSWrapperMap leaks for all JSContexts
https://bugs.webkit.org/show_bug.cgi?id=173110
<rdar://problem/32602198>

Patch by Joseph Pecoraro <[email protected]> on 2017-06-08
Reviewed by Geoffrey Garen.

* API/JSContext.mm:
(-[JSContext ensureWrapperMap]):
Ensure this allocation gets released.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSContext.mm (217951 => 217952)


--- trunk/Source/_javascript_Core/API/JSContext.mm	2017-06-08 22:17:20 UTC (rev 217951)
+++ trunk/Source/_javascript_Core/API/JSContext.mm	2017-06-08 22:24:11 UTC (rev 217952)
@@ -53,8 +53,10 @@
 
 - (void)ensureWrapperMap
 {
-    if (!toJS([self JSGlobalContextRef])->lexicalGlobalObject()->wrapperMap())
-        [[JSWrapperMap alloc] initWithGlobalContextRef:[self JSGlobalContextRef]];
+    if (!toJS([self JSGlobalContextRef])->lexicalGlobalObject()->wrapperMap()) {
+        // The map will be retained by the GlobalObject in initialization.
+        [[[JSWrapperMap alloc] initWithGlobalContextRef:[self JSGlobalContextRef]] release];
+    }
 }
 
 - (instancetype)init

Modified: trunk/Source/_javascript_Core/ChangeLog (217951 => 217952)


--- trunk/Source/_javascript_Core/ChangeLog	2017-06-08 22:17:20 UTC (rev 217951)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-06-08 22:24:11 UTC (rev 217952)
@@ -1,3 +1,15 @@
+2017-06-08  Joseph Pecoraro  <[email protected]>
+
+        [Cocoa] JSWrapperMap leaks for all JSContexts
+        https://bugs.webkit.org/show_bug.cgi?id=173110
+        <rdar://problem/32602198>
+
+        Reviewed by Geoffrey Garen.
+
+        * API/JSContext.mm:
+        (-[JSContext ensureWrapperMap]):
+        Ensure this allocation gets released.
+
 2017-06-08  Filip Pizlo  <[email protected]>
 
         REGRESSION: js/dom/prototype-chain-caching-with-impure-get-own-property-slot-traps-5.html has a flaky failure
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to