Bug 170093 - Add API to get available content extension identifiers in a WKContentExtensionStore
Summary: Add API to get available content extension identifiers in a WKContentExtensio...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-24 19:16 PDT by Alex Christensen
Modified: 2017-04-10 17:11 PDT (History)
2 users (show)

See Also:


Attachments
patch (14.42 KB, patch)
2017-03-24 19:19 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (14.86 KB, patch)
2017-04-10 17:09 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2017-03-24 19:16:46 PDT
Based on API review feedback, this would make sense to have.
Comment 1 Alex Christensen 2017-03-24 19:19:41 PDT
Created attachment 305352 [details]
patch
Comment 2 Geoffrey Garen 2017-04-10 11:00:41 PDT
Comment on attachment 305352 [details]
patch

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

r=me

> Source/WebKit2/UIProcess/API/APIContentExtensionStore.cpp:404
> +            completionHandler(identifiers);

I think you need to WTFMove(identifiers) again in this argument expression or you will copy the vector. (The capture expression creates an rvalue reference by WTFMove, but immediately assigns that reference to an lvalue named "identifiers".)

> Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStore.mm:115
> +        NSMutableArray<NSString *> *nsIdentifiers = [NSMutableArray arrayWithCapacity:100];

Why not use the capacity in identifiers?
Comment 3 Alex Christensen 2017-04-10 11:03:03 PDT
Comment on attachment 305352 [details]
patch

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

>> Source/WebKit2/UIProcess/API/Cocoa/WKContentExtensionStore.mm:115
>> +        NSMutableArray<NSString *> *nsIdentifiers = [NSMutableArray arrayWithCapacity:100];
> 
> Why not use the capacity in identifiers?

100 ought to be enough for anyone.
JK, this should obviously be the actual capacity.
Comment 4 Alex Christensen 2017-04-10 17:09:28 PDT
Created attachment 306760 [details]
Patch
Comment 5 Alex Christensen 2017-04-10 17:11:47 PDT
http://trac.webkit.org/r215209