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

Issue 2408443003: Make ResourceFetcher return Resources with LoadError instead of nullptrs. (Closed)

Created:
4 years, 2 months ago by engedy
Modified:
4 years, 2 months ago
Reviewers:
Nate Chapin
CC:
chromium-reviews, tyoshino+watch_chromium.org, tfarina, Yoav Weiss, loading-reviews_chromium.org, gavinp+loader_chromium.org, blink-reviews, loading-reviews+fetch_chromium.org, kinuko+watch
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Make ResourceFetcher return Resources with LoadError instead of nullptrs. Before this change, when a request was immediately blocked by access checks, ResourceFetcher::requestResource() would return a nullptr, while returning a Resource instance with a LoadError set if the request was blocked only after following one or more redirects. This resulted in various resource types failing in inconsistent ways in the two cases. This CL makes this behavior consistent by making requestResource() always return a Resource instance with a LoadError. This allows for cleaner and more consistent handling of errors in ResourceClients, as wells as more flexibility should the client choose to distinguish the underlying causes of errors. Due to the infrequency of requests failing access checks during normal use, the performance impact should be negligible. This is a reland of https://codereview.chromium.org/2231523002/, which got reverted due to making the following layout test flaky: http/tests/security/contentSecurityPolicy/nonces/import-enforce-blocked.php The test has been updated so there is no longer a race condition. BUG=616234 Committed: https://crrev.com/2f545df32a684b115b8b4c5458778695881b1bc6 Cr-Commit-Position: refs/heads/master@{#423978}

Patch Set 1 : Rebase of https://codereview.chromium.org/2231523002/. #

Patch Set 2 : Fix import-enforce-blocked.php. #

Patch Set 3 : Add comment. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+125 lines, -65 lines) Patch
M third_party/WebKit/LayoutTests/fast/dom/resources/frame-loading-via-document-write.js View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/misc/image-blocked-src-change.html View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/misc/image-blocked-src-no-change.html View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/nonces/import-enforce-blocked.php View 1 2 1 chunk +21 lines, -11 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/nonces/style-enforce-blocked.php View 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/nonces/style-multiple-blocked.php View 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/register-bypassing-scheme-partial.html View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/require-sri-for/require-sri-for-style-blocked.php View 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/strict-dynamic/script-src-strict-dynamic.html View 7 chunks +29 lines, -17 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/strict-dynamic/script-src-strict-dynamic-whitelist.html View 1 chunk +10 lines, -6 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/style-blocked.html View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/local-image-from-remote.html View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/mixedContent/insecure-async-post-xhr-blocked-expected.txt View 1 chunk +0 lines, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/resources/frame-loading-via-document-write.js View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/svg-image-with-cached-remote-image.html View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/svg-image-with-cached-remote-image-expected.html View 1 chunk +3 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/Resource.cpp View 2 chunks +5 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/ResourceFetcher.h View 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp View 2 chunks +13 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp View 1 chunk +5 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/loader/DocumentLoader.cpp View 2 chunks +11 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp View 1 chunk +6 lines, -1 line 0 comments Download
M third_party/WebKit/Source/web/tests/WebDocumentSubresourceFilterTest.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/web/tests/WebFrameTest.cpp View 1 chunk +4 lines, -1 line 0 comments Download

Messages

Total messages: 21 (13 generated)
engedy
Nate, please take a look at the diff between Patch Sets 1 and 2.
4 years, 2 months ago (2016-10-07 19:50:53 UTC) #4
Nate Chapin
lgtm if the bots are happy!
4 years, 2 months ago (2016-10-07 19:53:12 UTC) #5
engedy
Do you think it would be useful to add a comment to describe the motivation, ...
4 years, 2 months ago (2016-10-07 19:53:18 UTC) #6
Nate Chapin
On 2016/10/07 19:53:18, engedy wrote: > Do you think it would be useful to add ...
4 years, 2 months ago (2016-10-07 19:53:56 UTC) #8
engedy
On 2016/10/07 19:53:56, Nate Chapin wrote: > On 2016/10/07 19:53:18, engedy wrote: > > Do ...
4 years, 2 months ago (2016-10-07 20:29:20 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2408443003/80001
4 years, 2 months ago (2016-10-07 20:33:53 UTC) #17
commit-bot: I haz the power
Committed patchset #3 (id:80001)
4 years, 2 months ago (2016-10-07 22:06:09 UTC) #19
commit-bot: I haz the power
4 years, 2 months ago (2016-10-07 22:08:12 UTC) #21
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/2f545df32a684b115b8b4c5458778695881b1bc6
Cr-Commit-Position: refs/heads/master@{#423978}

Powered by Google App Engine
This is Rietveld 408576698