Title: [165412] trunk/Source
Revision
165412
Author
[email protected]
Date
2014-03-10 16:08:55 -0700 (Mon, 10 Mar 2014)

Log Message

Fix three leaks
https://bugs.webkit.org/show_bug.cgi?id=130048

Reviewed by Anders Carlsson.

Source/WebCore:

The NSDictionary was leaked.

* page/ios/UserAgentIOS.mm:
(WebCore::osMarketingVersion):

Source/WebKit2:

* Shared/API/Cocoa/WKRemoteObjectCoder.mm:
(decodeObject): Code is simpler and less leaky without the RetainPtr.
* UIProcess/API/Cocoa/WKNavigationAction.mm: Fix _originalURL leak
by making it a RetainPtr and implementing the getter and setter.
(-[WKNavigationAction _setOriginalURL:]):
(-[WKNavigationAction _originalURL]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (165411 => 165412)


--- trunk/Source/WebCore/ChangeLog	2014-03-10 23:01:18 UTC (rev 165411)
+++ trunk/Source/WebCore/ChangeLog	2014-03-10 23:08:55 UTC (rev 165412)
@@ -1,3 +1,15 @@
+2014-03-10  Simon Fraser  <[email protected]>
+
+        Fix three leaks
+        https://bugs.webkit.org/show_bug.cgi?id=130048
+
+        Reviewed by Anders Carlsson.
+
+        The NSDictionary was leaked.
+
+        * page/ios/UserAgentIOS.mm:
+        (WebCore::osMarketingVersion):
+
 2014-03-10  Beth Dakin  <[email protected]>
 
         Set background color of WK2's UIScrollView to the pageExtendedBackgroundColor

Modified: trunk/Source/WebCore/page/ios/UserAgentIOS.mm (165411 => 165412)


--- trunk/Source/WebCore/page/ios/UserAgentIOS.mm	2014-03-10 23:01:18 UTC (rev 165411)
+++ trunk/Source/WebCore/page/ios/UserAgentIOS.mm	2014-03-10 23:08:55 UTC (rev 165412)
@@ -44,7 +44,7 @@
 
 static NSString *osMarketingVersion()
 {
-    RetainPtr<NSDictionary> systemInfo = [[NSDictionary alloc] initWithContentsOfFile:[platformSystemRootDirectory() stringByAppendingPathComponent:@"System/Library/CoreServices/SystemVersion.plist"]];
+    RetainPtr<NSDictionary> systemInfo = adoptNS([[NSDictionary alloc] initWithContentsOfFile:[platformSystemRootDirectory() stringByAppendingPathComponent:@"System/Library/CoreServices/SystemVersion.plist"]]);
     NSString *productVersion = [systemInfo objectForKey:@"ProductVersion"];
     return !productVersion ? @"" : [productVersion stringByReplacingOccurrencesOfString:@"." withString:@"_"];
 }

Modified: trunk/Source/WebKit2/ChangeLog (165411 => 165412)


--- trunk/Source/WebKit2/ChangeLog	2014-03-10 23:01:18 UTC (rev 165411)
+++ trunk/Source/WebKit2/ChangeLog	2014-03-10 23:08:55 UTC (rev 165412)
@@ -1,3 +1,17 @@
+2014-03-10  Simon Fraser  <[email protected]>
+
+        Fix three leaks
+        https://bugs.webkit.org/show_bug.cgi?id=130048
+
+        Reviewed by Anders Carlsson.
+
+        * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
+        (decodeObject): Code is simpler and less leaky without the RetainPtr.
+        * UIProcess/API/Cocoa/WKNavigationAction.mm: Fix _originalURL leak
+        by making it a RetainPtr and implementing the getter and setter.
+        (-[WKNavigationAction _setOriginalURL:]):
+        (-[WKNavigationAction _originalURL]):
+
 2014-03-10  Beth Dakin  <[email protected]>
 
         Set background color of WK2's UIScrollView to the pageExtendedBackgroundColor

Modified: trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm (165411 => 165412)


--- trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm	2014-03-10 23:01:18 UTC (rev 165411)
+++ trunk/Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm	2014-03-10 23:08:55 UTC (rev 165412)
@@ -497,7 +497,7 @@
     if (objectClass == [NSInvocation class])
         return decodeInvocation(decoder);
 
-    RetainPtr<id> result = [objectClass allocWithZone:decoder.zone];
+    id result = [objectClass allocWithZone:decoder.zone];
     if (!result)
         [NSException raise:NSInvalidUnarchiveOperationException format:@"Class \"%s\" returned nil from +alloc while being decoded", className.data()];
 
@@ -509,7 +509,7 @@
     if (!result)
         [NSException raise:NSInvalidUnarchiveOperationException format:@"Object of class \"%s\" returned nil from -awakeAfterUsingCoder: while being decoded", className.data()];
 
-    return [result.leakRef() autorelease];
+    return [result autorelease];
 }
 
 static id decodeObject(WKRemoteObjectDecoder *decoder, const ImmutableDictionary* dictionary, NSSet *allowedClasses)

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.mm (165411 => 165412)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.mm	2014-03-10 23:01:18 UTC (rev 165411)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.mm	2014-03-10 23:08:55 UTC (rev 165412)
@@ -34,6 +34,7 @@
     RetainPtr<WKFrameInfo> _sourceFrame;
     RetainPtr<WKFrameInfo> _destinationFrame;
     RetainPtr<NSURLRequest> _request;
+    RetainPtr<NSURL> _originalURL;
 }
 
 - (NSString *)description
@@ -72,6 +73,16 @@
     _request = adoptNS([request copy]);
 }
 
+- (void)_setOriginalURL:(NSURL *)originalURL
+{
+    _originalURL = adoptNS([originalURL copy]);
+}
+
+- (NSURL *)_originalURL
+{
+    return _originalURL.get();
+}
+
 @end
 
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to