Bug 175974 - CacheQueryOptions::isolatedCopy() copies the cache name twice
Summary: CacheQueryOptions::isolatedCopy() copies the cache name twice
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Local Build
Hardware: All All
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-08-24 19:01 PDT by Daniel Bates
Modified: 2017-08-29 11:09 PDT (History)
3 users (show)

See Also:


Attachments
Patch (2.38 KB, patch)
2017-08-24 19:03 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch (2.55 KB, patch)
2017-08-24 19:50 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2017-08-24 19:01:15 PDT
CacheQueryOptions::isolatedCopy() copies the cache name twice.
Comment 1 Daniel Bates 2017-08-24 19:03:49 PDT
Created attachment 319054 [details]
Patch
Comment 2 Daniel Bates 2017-08-24 19:06:52 PDT
I do not understand how we can came to the decision to have a user-defined constructor for CacheQueryOptions that makes an isolated copy of the passed string. I mean it seems weird that the constructor would charge for an isolated copy when a caller may not pass CacheQueryOptions to another thread. Or is the design that CacheQueryOptions is always passed to another thread?
Comment 3 youenn fablet 2017-08-24 19:21:41 PDT
Comment on attachment 319054 [details]
Patch

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

> Source/WebCore/Modules/cache/CacheQueryOptions.h:-47
> -    , cacheName(cacheName.isolatedCopy())

Wouh, that is a strange constructor!
This constructor might be needed for some platforms since CacheQueryOptions is initializing some variables.
If this patch compiles on win, this patch is fine.
Otherwise, the constructor should be kept and take a String&&.

r=me, waiting for win bot
Comment 4 youenn fablet 2017-08-24 19:22:57 PDT
(In reply to Daniel Bates from comment #2)
> I do not understand how we can came to the decision to have a user-defined
> constructor for CacheQueryOptions that makes an isolated copy of the passed
> string. I mean it seems weird that the constructor would charge for an
> isolated copy when a caller may not pass CacheQueryOptions to another
> thread. Or is the design that CacheQueryOptions is always passed to another
> thread?

It is definitely a mistake.
Comment 5 Daniel Bates 2017-08-24 19:50:09 PDT
Created attachment 319061 [details]
Patch
Comment 6 Daniel Bates 2017-08-29 11:09:14 PDT
Committed r221306: <http://trac.webkit.org/changeset/221306>
Comment 7 Radar WebKit Bug Importer 2017-08-29 11:09:58 PDT
<rdar://problem/34136830>