Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Issue 1839473002: Centralize the setting of Accept headers (Closed)

Created:
4 years, 9 months ago by Nate Chapin
Modified:
4 years, 8 months ago
CC:
blink-reviews, blink-reviews-style_chromium.org, chromium-reviews, gavinp+loader_chromium.org, loading-reviews+fetch_chromium.org, tyoshino+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Centralize the setting of Accept headers Set the accept header in MimeTypeResourceHandler based on the request's ResourceType. All network requests flow through this point, so we can observe child process requests, whether or not they are from blink, as well as PlzNavigate requests. MimeTypeResourceHandler still needs to defer to blink in certain situations, mostly because an Accept header can be manually set on an XHR. However, ResourceType also isn't precise enough to handle every case: it doesn't distinguish between CSS and XSL stylesheets. It may be worth adding a separate ResourceType for XSL in the future, but for now, manually set the Accept header in blink's XSLStyleSheetResource. BUG= CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation Committed: https://crrev.com/1f3d63b1d496218b7c90a27dd1699560592a6dcc Cr-Commit-Position: refs/heads/master@{#385827}

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Total comments: 1

Patch Set 6 : Move Accept header setting to MimeTypeResourceHandler #

Patch Set 7 : #

Patch Set 8 : Remove accept header checking from LinkLoaderTest.Preload #

Total comments: 8

Patch Set 9 : Address mmenke's comments #

Total comments: 10

Patch Set 10 : Comment cleanup + unittest #

Total comments: 2

Patch Set 11 : Rebase #

Total comments: 4

Patch Set 12 : Drop unused variables in test #

Total comments: 2

Patch Set 13 : Rebase #

Patch Set 14 : Rebase again #

Unified diffs Side-by-side diffs Delta from patch set Stats (+186 lines, -100 lines) Patch
M content/browser/frame_host/navigation_request.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +0 lines, -2 lines 0 comments Download
M content/browser/loader/mime_type_resource_handler.h View 1 2 3 4 5 6 7 8 9 2 chunks +5 lines, -0 lines 0 comments Download
M content/browser/loader/mime_type_resource_handler.cc View 1 2 3 4 5 6 7 8 9 2 chunks +49 lines, -0 lines 0 comments Download
M content/browser/loader/mime_type_resource_handler_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +87 lines, -1 line 0 comments Download
M content/child/web_url_request_util.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +1 line, -13 lines 0 comments Download
M content/renderer/render_frame_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +0 lines, -14 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +0 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/ImageResource.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +0 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/fetch/ImageResource.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +0 lines, -9 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/Resource.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +0 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/Resource.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +0 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/ScriptResource.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +0 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/XSLStyleSheetResource.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +14 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +30 lines, -32 lines 0 comments Download
M third_party/WebKit/Source/platform/network/ResourceRequest.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 75 (32 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1839473002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1839473002/1
4 years, 9 months ago (2016-03-25 21:49:54 UTC) #2
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: cast_shell_android on tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/cast_shell_android/builds/40834) chromeos_amd64-generic_chromium_compile_only_ng on ...
4 years, 9 months ago (2016-03-25 22:03:38 UTC) #4
Nate Chapin
One more small-ish cleanup :)
4 years, 8 months ago (2016-03-29 23:28:17 UTC) #8
Yoav Weiss
https://codereview.chromium.org/1839473002/diff/80001/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp File third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp (right): https://codereview.chromium.org/1839473002/diff/80001/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp#newcode211 third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp:211: } What about other Resource::Types? Where are they set? ...
4 years, 8 months ago (2016-03-30 06:18:58 UTC) #10
Nate Chapin
On 2016/03/30 06:18:58, Yoav Weiss wrote: > https://codereview.chromium.org/1839473002/diff/80001/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp > File third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp (right): > > https://codereview.chromium.org/1839473002/diff/80001/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp#newcode211 ...
4 years, 8 months ago (2016-03-30 16:51:21 UTC) #11
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1839473002/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1839473002/120001
4 years, 8 months ago (2016-03-31 16:58:28 UTC) #14
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/203151)
4 years, 8 months ago (2016-03-31 17:58:13 UTC) #17
Nate Chapin
mmenke: How does this look for moving Accept header handling to content/browser/loader/?
4 years, 8 months ago (2016-03-31 19:01:25 UTC) #20
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1839473002/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1839473002/140001
4 years, 8 months ago (2016-03-31 19:01:40 UTC) #21
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: ios_dbg_simulator_gn on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios_dbg_simulator_gn/builds/11862) ios_dbg_simulator_ninja on ...
4 years, 8 months ago (2016-03-31 19:05:09 UTC) #23
mmenke
Not a huge fan of having a bunch of magic strings that depend on other ...
4 years, 8 months ago (2016-03-31 19:16:31 UTC) #24
mmenke
On 2016/03/30 16:51:21, Nate Chapin wrote: > On 2016/03/30 06:18:58, Yoav Weiss wrote: > > ...
4 years, 8 months ago (2016-03-31 19:21:08 UTC) #25
mmenke
https://codereview.chromium.org/1839473002/diff/140001/content/browser/loader/mime_type_resource_handler.cc File content/browser/loader/mime_type_resource_handler.cc (right): https://codereview.chromium.org/1839473002/diff/140001/content/browser/loader/mime_type_resource_handler.cc#newcode46 content/browser/loader/mime_type_resource_handler.cc:46: "*;q=0.8"; This seems like a weird place to break ...
4 years, 8 months ago (2016-03-31 19:23:41 UTC) #26
Nate Chapin
On 2016/03/31 19:21:08, mmenke wrote: > On 2016/03/30 16:51:21, Nate Chapin wrote: > > On ...
4 years, 8 months ago (2016-03-31 20:01:52 UTC) #27
Nate Chapin
https://codereview.chromium.org/1839473002/diff/140001/content/browser/loader/mime_type_resource_handler.cc File content/browser/loader/mime_type_resource_handler.cc (right): https://codereview.chromium.org/1839473002/diff/140001/content/browser/loader/mime_type_resource_handler.cc#newcode37 content/browser/loader/mime_type_resource_handler.cc:37: #include "net/http/http_response_headers.h" On 2016/03/31 19:16:31, mmenke wrote: > Probably ...
4 years, 8 months ago (2016-03-31 23:44:48 UTC) #28
mmenke
content/browser/loader/ LGTM. Skimmed over the rest, but don't know any of it well enough to ...
4 years, 8 months ago (2016-04-01 15:29:09 UTC) #29
Nate Chapin
On 2016/04/01 15:29:09, mmenke wrote: > content/browser/loader/ LGTM. Skimmed over the rest, but don't know ...
4 years, 8 months ago (2016-04-01 16:54:33 UTC) #30
Yoav Weiss
Almost :) We're losing some test coverage here that I'd love to see added back ...
4 years, 8 months ago (2016-04-01 17:54:10 UTC) #31
mmenke
https://codereview.chromium.org/1839473002/diff/160001/content/browser/loader/mime_type_resource_handler.cc File content/browser/loader/mime_type_resource_handler.cc (right): https://codereview.chromium.org/1839473002/diff/160001/content/browser/loader/mime_type_resource_handler.cc#newcode163 content/browser/loader/mime_type_resource_handler.cc:163: // which we need because JS can manually set ...
4 years, 8 months ago (2016-04-01 17:57:00 UTC) #32
Nate Chapin
https://codereview.chromium.org/1839473002/diff/160001/content/browser/loader/mime_type_resource_handler.cc File content/browser/loader/mime_type_resource_handler.cc (right): https://codereview.chromium.org/1839473002/diff/160001/content/browser/loader/mime_type_resource_handler.cc#newcode160 content/browser/loader/mime_type_resource_handler.cc:160: } On 2016/04/01 17:54:10, Yoav Weiss wrote: > Could ...
4 years, 8 months ago (2016-04-01 19:01:24 UTC) #33
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1839473002/180001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1839473002/180001
4 years, 8 months ago (2016-04-01 19:02:06 UTC) #35
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: ios_dbg_simulator_gn on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios_dbg_simulator_gn/builds/12626) ios_dbg_simulator_ninja on ...
4 years, 8 months ago (2016-04-01 19:05:31 UTC) #37
Yoav Weiss
core/ LGTM https://codereview.chromium.org/1839473002/diff/160001/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp File third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp (right): https://codereview.chromium.org/1839473002/diff/160001/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp#newcode100 third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp:100: {"http://example.test/cat.jpg", "image", "", "", ResourceLoadPriorityVeryLow, WebURLRequest::RequestContextImage, true, ...
4 years, 8 months ago (2016-04-01 19:20:16 UTC) #38
esprehn
Plz wrap your change descriptions at 80 or 100 cols or something. :) It's very ...
4 years, 8 months ago (2016-04-01 23:35:51 UTC) #40
Nate Chapin
https://codereview.chromium.org/1839473002/diff/180001/third_party/WebKit/Source/platform/network/ResourceRequest.h File third_party/WebKit/Source/platform/network/ResourceRequest.h (right): https://codereview.chromium.org/1839473002/diff/180001/third_party/WebKit/Source/platform/network/ResourceRequest.h#newcode149 third_party/WebKit/Source/platform/network/ResourceRequest.h:149: void setHTTPAccept(const AtomicString& httpAccept) { setHTTPHeaderField(HTTPNames::Accept, httpAccept); } On ...
4 years, 8 months ago (2016-04-01 23:37:15 UTC) #41
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1839473002/200001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1839473002/200001
4 years, 8 months ago (2016-04-01 23:57:19 UTC) #44
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 8 months ago (2016-04-02 01:35:33 UTC) #46
mmenke
Tests LGTM. I'd tend to favor more integration-y tests, to make sure we actually send ...
4 years, 8 months ago (2016-04-04 19:08:58 UTC) #47
nasko
content/ LGTM
4 years, 8 months ago (2016-04-04 21:37:06 UTC) #49
Nate Chapin
https://codereview.chromium.org/1839473002/diff/200001/content/browser/loader/mime_type_resource_handler_unittest.cc File content/browser/loader/mime_type_resource_handler_unittest.cc (right): https://codereview.chromium.org/1839473002/diff/200001/content/browser/loader/mime_type_resource_handler_unittest.cc#newcode283 content/browser/loader/mime_type_resource_handler_unittest.cc:283: GURL url("http://www.google.com"); On 2016/04/04 19:08:58, mmenke wrote: > Not ...
4 years, 8 months ago (2016-04-04 23:21:58 UTC) #50
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1839473002/220001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1839473002/220001
4 years, 8 months ago (2016-04-04 23:22:59 UTC) #53
commit-bot: I haz the power
Try jobs failed on following builders: linux_site_isolation on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_site_isolation/builds/1541)
4 years, 8 months ago (2016-04-05 00:24:11 UTC) #55
hiroshige
lgtm. I confirmed that Accept headers observed by service worker is unchanged (test CL: https://codereview.chromium.org/1853333005/). ...
4 years, 8 months ago (2016-04-05 09:34:31 UTC) #56
Yoav Weiss
On 2016/04/05 09:34:31, hiroshige wrote: > lgtm. > > I confirmed that Accept headers observed ...
4 years, 8 months ago (2016-04-05 09:58:49 UTC) #57
hiroshige
On 2016/04/05 09:58:49, Yoav Weiss wrote: > I think the spec should not be specifying ...
4 years, 8 months ago (2016-04-05 13:33:41 UTC) #58
Nate Chapin
On 2016/04/05 13:33:41, hiroshige wrote: > On 2016/04/05 09:58:49, Yoav Weiss wrote: > > I ...
4 years, 8 months ago (2016-04-05 16:54:34 UTC) #59
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1839473002/220001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1839473002/220001
4 years, 8 months ago (2016-04-05 16:55:06 UTC) #61
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/164717) linux_site_isolation on tryserver.chromium.linux (JOB_FAILED, ...
4 years, 8 months ago (2016-04-05 17:02:25 UTC) #63
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1839473002/240001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1839473002/240001
4 years, 8 months ago (2016-04-06 22:15:53 UTC) #66
commit-bot: I haz the power
Try jobs failed on following builders: ios_dbg_simulator_ninja on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios_dbg_simulator_ninja/builds/155573) ios_rel_device_gn on tryserver.chromium.mac (JOB_FAILED, ...
4 years, 8 months ago (2016-04-06 22:19:14 UTC) #68
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1839473002/260001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1839473002/260001
4 years, 8 months ago (2016-04-07 17:30:00 UTC) #71
commit-bot: I haz the power
Committed patchset #14 (id:260001)
4 years, 8 months ago (2016-04-07 19:11:55 UTC) #73
commit-bot: I haz the power
4 years, 8 months ago (2016-04-07 19:15:06 UTC) #75
Message was sent while issue was closed.
Patchset 14 (id:??) landed as
https://crrev.com/1f3d63b1d496218b7c90a27dd1699560592a6dcc
Cr-Commit-Position: refs/heads/master@{#385827}

Powered by Google App Engine
This is Rietveld 408576698