Bug 175524 - Drop non-const getter for CachedResource::resourceRequest()
Summary: Drop non-const getter for CachedResource::resourceRequest()
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
Keywords: InRadar
Depends on:
Reported: 2017-08-13 10:22 PDT by Chris Dumez
Modified: 2017-08-13 14:08 PDT (History)
7 users (show)

See Also:

Patch (11.20 KB, patch)
2017-08-13 10:23 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (11.43 KB, patch)
2017-08-13 13:26 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2017-08-13 10:22:04 PDT
Drop non-const getter for CachedResource::resourceRequest(). It would be unsafe to modify the request of a CachedResource after it has been cached. Exposing such a getter is therefore a footgun.
Comment 1 Chris Dumez 2017-08-13 10:23:48 PDT
Created attachment 318011 [details]
Comment 2 youenn fablet 2017-08-13 12:49:28 PDT
Comment on attachment 318011 [details]

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

> Source/WebCore/loader/LinkLoader.cpp:227
>      CachedResourceRequest linkRequest(WTFMove(resourceRequest), CachedResourceLoader::defaultCachedResourceOptions(), CachedResource::defaultPriorityForResourceType(type.value()));

Could probably be rewritten to CachedResourceRequest linkRequest(document.completeURL(href),...) or CachedResourceRequest linkRequest(ResourceRequest(document.completeURL(href),...) if we do not like creating implicitly requests from urls.
Comment 3 Chris Dumez 2017-08-13 13:26:16 PDT
Created attachment 318015 [details]
Comment 4 WebKit Commit Bot 2017-08-13 14:07:59 PDT
Comment on attachment 318015 [details]

Clearing flags on attachment: 318015

Committed r220632: <http://trac.webkit.org/changeset/220632>
Comment 5 WebKit Commit Bot 2017-08-13 14:08:01 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Radar WebKit Bug Importer 2017-08-13 14:08:34 PDT