Summary: | REGRESSION (r218419): 7 leaks in PluginLoadClientPolicies.mm | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | David Kilzer (:ddkilzer) <ddkilzer> | ||||||
Component: | Tools / Tests | Assignee: | David Kilzer (:ddkilzer) <ddkilzer> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | cdumez, darin, joepeck, lforschler, mitz | ||||||
Priority: | P2 | ||||||||
Version: | WebKit Nightly Build | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
See Also: | https://bugs.webkit.org/show_bug.cgi?id=173689 | ||||||||
Bug Depends on: | 173472 | ||||||||
Bug Blocks: | |||||||||
Attachments: |
|
Description
David Kilzer (:ddkilzer)
2017-06-22 09:41:02 PDT
Created attachment 313638 [details]
Patch v1
Created attachment 313646 [details]
Patch v2
Comment on attachment 313646 [details] Patch v2 View in context: https://bugs.webkit.org/attachment.cgi?id=313646&action=review > Tools/TestWebKitAPI/Tests/WebKit2Cocoa/PluginLoadClientPolicies.mm:71 > + RetainPtr<NSMutableDictionary> newPolicies = adoptNS([policies mutableCopy]); r=me, but I find this way harder to read. How about switching to ObjC literal syntax? You'd end up with something like: RetainPtr<NSMutableDictionary> newPolicies = adoptNS([policies mutableCopy]); [newPolicies removeObjectForKey:@"apple.com"]; newPolicies.get()[@"google.com"] = @{ @"com.macromedia.Flash Player.plugin": @{ @"26.0.0.126": @(kWKPluginLoadClientPolicyAllowAlways), }, @"com.apple.QuickTime.plugin": @{ @"1.0": @(kWKPluginLoadClientPolicyBlock), @"1.1": @(kWKPluginLoadClientPolicyAllow), }, }; Comment on attachment 313646 [details] Patch v2 View in context: https://bugs.webkit.org/attachment.cgi?id=313646&action=review >> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/PluginLoadClientPolicies.mm:71 >> + RetainPtr<NSMutableDictionary> newPolicies = adoptNS([policies mutableCopy]); > > r=me, but I find this way harder to read. > > How about switching to ObjC literal syntax? You'd end up with something like: > > RetainPtr<NSMutableDictionary> newPolicies = adoptNS([policies mutableCopy]); > [newPolicies removeObjectForKey:@"apple.com"]; > newPolicies.get()[@"google.com"] = @{ > @"com.macromedia.Flash Player.plugin": @{ > @"26.0.0.126": @(kWKPluginLoadClientPolicyAllowAlways), > }, > @"com.apple.QuickTime.plugin": @{ > @"1.0": @(kWKPluginLoadClientPolicyBlock), > @"1.1": @(kWKPluginLoadClientPolicyAllow), > }, > }; I like this better, but it has the (slight) disadvantage of putting all the objects in an autoreleasepool. I'll switch to adoptNS().get() instead, as we talked about in person. Committed r218719: <http://trac.webkit.org/changeset/218719> Comment on attachment 313646 [details] Patch v2 View in context: https://bugs.webkit.org/attachment.cgi?id=313646&action=review >>> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/PluginLoadClientPolicies.mm:71 >>> + RetainPtr<NSMutableDictionary> newPolicies = adoptNS([policies mutableCopy]); >> >> r=me, but I find this way harder to read. >> >> How about switching to ObjC literal syntax? You'd end up with something like: >> >> RetainPtr<NSMutableDictionary> newPolicies = adoptNS([policies mutableCopy]); >> [newPolicies removeObjectForKey:@"apple.com"]; >> newPolicies.get()[@"google.com"] = @{ >> @"com.macromedia.Flash Player.plugin": @{ >> @"26.0.0.126": @(kWKPluginLoadClientPolicyAllowAlways), >> }, >> @"com.apple.QuickTime.plugin": @{ >> @"1.0": @(kWKPluginLoadClientPolicyBlock), >> @"1.1": @(kWKPluginLoadClientPolicyAllow), >> }, >> }; > > I like this better, but it has the (slight) disadvantage of putting all the objects in an autoreleasepool. > > I'll switch to adoptNS().get() instead, as we talked about in person. Readability seems *so* much more important than putting a few objects into the autorelease pool. |