Title: [237365] trunk/Source
- Revision
- 237365
- Author
- ddkil...@apple.com
- Date
- 2018-10-23 13:36:37 -0700 (Tue, 23 Oct 2018)
Log Message
Fix false positive leaks when using custom -init methods that don't start with -init
<https://webkit.org/b/190818>
<rdar://problem/45476042>
Reviewed by Dan Bernstein.
Source/WebKit:
* UIProcess/Cocoa/WKWebViewContentProvider.h:
(-[WKWebViewContentProvider web_initWithFrame:webView:mimeType:]):
Add attribute to make this behave like an -init method.
Source/WebKitLegacy/mac:
* Misc/WebKitErrors.m: Move `descriptions` static global so that
it is accessible by both categories.
(-[NSError _webkit_initWithDomain:code:URL:]): Declare new
NSError (WebKitInternal) category. Add attribute to make this
behave like an -init method.
(-[NSError _webkit_initWithDomain:code:URL:]): Move into new
NSError (WebKitInternal) category. Modernize method. Replace
constant NSString with `NSURLErrorFailingURLStringErrorKey`.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (237364 => 237365)
--- trunk/Source/WebKit/ChangeLog 2018-10-23 20:02:52 UTC (rev 237364)
+++ trunk/Source/WebKit/ChangeLog 2018-10-23 20:36:37 UTC (rev 237365)
@@ -1,3 +1,15 @@
+2018-10-23 David Kilzer <ddkil...@apple.com>
+
+ Fix false positive leaks when using custom -init methods that don't start with -init
+ <https://webkit.org/b/190818>
+ <rdar://problem/45476042>
+
+ Reviewed by Dan Bernstein.
+
+ * UIProcess/Cocoa/WKWebViewContentProvider.h:
+ (-[WKWebViewContentProvider web_initWithFrame:webView:mimeType:]):
+ Add attribute to make this behave like an -init method.
+
2018-10-23 Chris Dumez <cdu...@apple.com>
[PSON] Add support for cross-site client-side redirects
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WKWebViewContentProvider.h (237364 => 237365)
--- trunk/Source/WebKit/UIProcess/Cocoa/WKWebViewContentProvider.h 2018-10-23 20:02:52 UTC (rev 237364)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKWebViewContentProvider.h 2018-10-23 20:36:37 UTC (rev 237365)
@@ -43,7 +43,7 @@
@protocol WKWebViewContentProvider <NSObject>
-- (instancetype)web_initWithFrame:(CGRect) frame webView:(WKWebView *)webView mimeType:(NSString *)mimeType;
+- (instancetype)web_initWithFrame:(CGRect)frame webView:(WKWebView *)webView mimeType:(NSString *)mimeType __attribute__((objc_method_family(init)));
- (void)web_setContentProviderData:(NSData *)data suggestedFilename:(NSString *)filename;
- (void)web_setMinimumSize:(CGSize)size;
- (void)web_setOverlaidAccessoryViewsInset:(CGSize)inset;
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (237364 => 237365)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2018-10-23 20:02:52 UTC (rev 237364)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2018-10-23 20:36:37 UTC (rev 237365)
@@ -1,3 +1,20 @@
+2018-10-23 David Kilzer <ddkil...@apple.com>
+
+ Fix false positive leaks when using custom -init methods that don't start with -init
+ <https://webkit.org/b/190818>
+ <rdar://problem/45476042>
+
+ Reviewed by Dan Bernstein.
+
+ * Misc/WebKitErrors.m: Move `descriptions` static global so that
+ it is accessible by both categories.
+ (-[NSError _webkit_initWithDomain:code:URL:]): Declare new
+ NSError (WebKitInternal) category. Add attribute to make this
+ behave like an -init method.
+ (-[NSError _webkit_initWithDomain:code:URL:]): Move into new
+ NSError (WebKitInternal) category. Modernize method. Replace
+ constant NSString with `NSURLErrorFailingURLStringErrorKey`.
+
2018-10-18 Alexey Proskuryakov <a...@apple.com>
Switch from PLATFORM(IOS) to PLATFORM(IOS_FAMILY)
Modified: trunk/Source/WebKitLegacy/mac/Misc/WebKitErrors.m (237364 => 237365)
--- trunk/Source/WebKitLegacy/mac/Misc/WebKitErrors.m 2018-10-23 20:02:52 UTC (rev 237364)
+++ trunk/Source/WebKitLegacy/mac/Misc/WebKitErrors.m 2018-10-23 20:36:37 UTC (rev 237365)
@@ -29,6 +29,7 @@
#import <WebKitLegacy/WebKitErrors.h>
#import "WebLocalizableStringsInternal.h"
+#import <Foundation/NSURLError.h>
#import <WebKitLegacy/WebKitErrorsPrivate.h>
#import <WebKitLegacy/WebNSURLExtras.h>
@@ -58,10 +59,31 @@
#define WebKitErrorDescriptionGeolocationLocationUnknown UI_STRING_INTERNAL("The current location cannot be found.", "WebKitErrorGeolocationLocationUnknown description")
+static NSMutableDictionary *descriptions = nil;
+
+@interface NSError (WebKitInternal)
+- (instancetype)_webkit_initWithDomain:(NSString *)domain code:(int)code URL:(NSURL *)URL __attribute__((objc_method_family(init)));
+@end
+
+@implementation NSError (WebKitInternal)
+
+- (instancetype)_webkit_initWithDomain:(NSString *)domain code:(int)code URL:(NSURL *)URL
+{
+ // Insert a localized string here for those folks not savvy to our category methods.
+ NSDictionary *descriptionsDict = [descriptions objectForKey:domain];
+ NSString *localizedDescription = descriptionsDict ? [descriptionsDict objectForKey:[NSNumber numberWithInt:code]] : nil;
+ NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
+ URL, @"NSErrorFailingURLKey",
+ [URL absoluteString], NSURLErrorFailingURLStringErrorKey,
+ localizedDescription, NSLocalizedDescriptionKey,
+ nil];
+ return [self initWithDomain:domain code:code userInfo:dict];
+}
+
+@end
+
@implementation NSError (WebKitExtras)
-static NSMutableDictionary *descriptions = nil;
-
+ (void)_registerWebKitErrors
{
static dispatch_once_t flag;
@@ -91,22 +113,6 @@
});
}
--(id)_webkit_initWithDomain:(NSString *)domain code:(int)code URL:(NSURL *)URL
-{
- NSDictionary *descriptionsDict;
- NSString *localizedDesc;
- NSDictionary *dict;
- // insert a localized string here for those folks not savvy to our category methods
- descriptionsDict = [descriptions objectForKey:domain];
- localizedDesc = descriptionsDict ? [descriptionsDict objectForKey:[NSNumber numberWithInt:code]] : nil;
- dict = [NSDictionary dictionaryWithObjectsAndKeys:
- URL, @"NSErrorFailingURLKey",
- [URL absoluteString], @"NSErrorFailingURLStringKey",
- localizedDesc, NSLocalizedDescriptionKey,
- nil];
- return [self initWithDomain:domain code:code userInfo:dict];
-}
-
+(id)_webkit_errorWithDomain:(NSString *)domain code:(int)code URL:(NSURL *)URL
{
return [[[self alloc] _webkit_initWithDomain:domain code:code URL:URL] autorelease];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes