Bug 145269

Summary: Add a _WKWebKitContentExtensionStore initializer that takes a path
Product: WebKit Reporter: Brian Weinstein <bweinstein>
Component: WebKit APIAssignee: Brian Weinstein <bweinstein>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, beidson, benjamin, commit-queue, sam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
[PATCH] Fix
achristensen: review-
[PATCH] Fix v2 none

Description Brian Weinstein 2015-05-21 09:47:19 PDT
We need a _WKWebKitContentExtensionStore initializer that takes a path
Comment 1 Brian Weinstein 2015-05-21 10:07:20 PDT
Created attachment 253529 [details]
[PATCH] Fix

I’m not sure if UserContentExtensionStore::storeWithPath is correct in terms of memory management, but the rest should be good.
Comment 2 WebKit Commit Bot 2015-05-21 10:09:27 PDT
Attachment 253529 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp:57:  Declaration has space between type name and * in UserContentExtensionStore *store  [whitespace/declaration] [3]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Alex Christensen 2015-05-21 10:18:52 PDT
Comment on attachment 253529 [details]
[PATCH] Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=253529&action=review

> Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp:57
> +    UserContentExtensionStore *store = new UserContentExtensionStore(storePath);

This is definitely a memory leak.
Comment 4 Alex Christensen 2015-05-21 10:21:56 PDT
You'll probably need to use UserContentExtensionStore.wrapper directly and maybe an adoptNS somewhere to make refcounting work right.  I probably shouldn't be the final reviewer on this patch.
Comment 5 Anders Carlsson 2015-05-21 10:24:43 PDT
Comment on attachment 253529 [details]
[PATCH] Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=253529&action=review

>> Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp:57
>> +    UserContentExtensionStore *store = new UserContentExtensionStore(storePath);
> 
> This is definitely a memory leak.

This should return a RefPtr<UserContentExtensionStore>.

> Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.h:36
> ++ (instancetype)storeWithPath:(NSURL *)path;

This should be storeWithURL: Alternatively just make an initializer. Can this fail? If so, maybe it should take an NSError out parameter as well?
Comment 6 Brian Weinstein 2015-05-21 10:37:08 PDT
(In reply to comment #5)
> Comment on attachment 253529 [details]
> [PATCH] Fix
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=253529&action=review
> 
> >> Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp:57
> >> +    UserContentExtensionStore *store = new UserContentExtensionStore(storePath);
> > 
> > This is definitely a memory leak.
> 
> This should return a RefPtr<UserContentExtensionStore>.

Will fix.

> 
> > Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.h:36
> > ++ (instancetype)storeWithPath:(NSURL *)path;
> 
> This should be storeWithURL: Alternatively just make an initializer. Can
> this fail? If so, maybe it should take an NSError out parameter as well?

(In reply to comment #5)
> Comment on attachment 253529 [details]
> [PATCH] Fix
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=253529&action=review
> 
> >> Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp:57
> >> +    UserContentExtensionStore *store = new UserContentExtensionStore(storePath);
> > 
> > This is definitely a memory leak.
> 
> This should return a RefPtr<UserContentExtensionStore>.
> 
> > Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentExtensionStore.h:36
> > ++ (instancetype)storeWithPath:(NSURL *)path;
> 
> This should be storeWithURL: Alternatively just make an initializer. Can
> this fail? If so, maybe it should take an NSError out parameter as well?

This should not fail. I’ll rename it to storeWithURL.
Comment 7 Brian Weinstein 2015-05-21 10:59:24 PDT
Created attachment 253533 [details]
[PATCH] Fix v2
Comment 8 WebKit Commit Bot 2015-05-21 11:54:24 PDT
Comment on attachment 253533 [details]
[PATCH] Fix v2

Clearing flags on attachment: 253533

Committed r184726: <http://trac.webkit.org/changeset/184726>
Comment 9 WebKit Commit Bot 2015-05-21 11:54:28 PDT
All reviewed patches have been landed.  Closing bug.