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

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

Created:
4 years, 4 months ago by engedy
Modified:
4 years, 2 months ago
Reviewers:
Nate Chapin, alexmos
CC:
chromium-reviews, tyoshino+watch_chromium.org, Yoav Weiss, gavinp+loader_chromium.org, blink-reviews, loading-reviews+fetch_chromium.org, Nate Chapin, Mike West, clamy, jkarlin, Charlie Reis, ncarter (slow)
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
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. BUG=616234 Committed: https://crrev.com/fd02740210e0152c94bd4c34a1e355280421730d Cr-Commit-Position: refs/heads/master@{#423358}

Patch Set 1 #

Total comments: 10

Patch Set 2 : Rename. #

Patch Set 3 : Fixed webkit_unit_tests. Fixed most layout tests, rebaselineing rest. #

Total comments: 2

Patch Set 4 : Finish layout tests updates. #

Patch Set 5 : Address comment from japhet@. #

Total comments: 2

Patch Set 6 : Rebase, add comments, PlzNavigate tweak. #

Patch Set 7 : Comment phrasing. #

Total comments: 7

Patch Set 8 : Rebase, resolve comment rewrap conflicts. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+104 lines, -54 lines) Patch
M third_party/WebKit/LayoutTests/fast/dom/resources/frame-loading-via-document-write.js View 1 2 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/misc/image-blocked-src-change.html View 1 2 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 2 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/nonces/style-enforce-blocked.php View 1 2 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 2 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 2 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 2 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic.html View 1 2 3 4 5 7 chunks +29 lines, -17 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-whitelist.html View 1 2 3 4 5 1 chunk +10 lines, -6 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/style-blocked.html View 1 2 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/local-image-from-remote.html View 1 2 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 2 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 2 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 2 3 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 2 1 chunk +3 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/Resource.cpp View 1 2 3 4 5 6 7 2 chunks +5 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/ResourceFetcher.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp View 1 2 3 4 5 6 7 2 chunks +13 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp View 1 2 3 4 5 6 7 1 chunk +5 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/loader/DocumentLoader.cpp View 1 2 3 4 5 6 7 2 chunks +11 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp View 1 2 3 4 5 6 7 1 chunk +6 lines, -1 line 0 comments Download
M third_party/WebKit/Source/web/tests/WebDocumentSubresourceFilterTest.cpp View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/web/tests/WebFrameTest.cpp View 1 2 3 4 5 6 7 1 chunk +4 lines, -1 line 0 comments Download

Messages

Total messages: 79 (53 generated)
engedy
@Nate, could you please take an initial look? What I have done so far is ...
4 years, 4 months ago (2016-08-09 19:23:39 UTC) #6
Nate Chapin
Thanks for working on this! https://codereview.chromium.org/2231523002/diff/1/third_party/WebKit/Source/core/fetch/Resource.cpp File third_party/WebKit/Source/core/fetch/Resource.cpp (right): https://codereview.chromium.org/2231523002/diff/1/third_party/WebKit/Source/core/fetch/Resource.cpp#newcode659 third_party/WebKit/Source/core/fetch/Resource.cpp:659: static bool shouldSendCachedDataOrErrorSynchronouslyForType(Resource::Type type) ...
4 years, 4 months ago (2016-08-09 22:43:24 UTC) #7
engedy
Sorry for the delay. Please see some follow-up questions below. https://codereview.chromium.org/2231523002/diff/1/third_party/WebKit/Source/core/fetch/Resource.cpp File third_party/WebKit/Source/core/fetch/Resource.cpp (right): https://codereview.chromium.org/2231523002/diff/1/third_party/WebKit/Source/core/fetch/Resource.cpp#newcode659 ...
4 years, 4 months ago (2016-08-17 16:41:57 UTC) #8
Nate Chapin
https://codereview.chromium.org/2231523002/diff/1/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp File third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp (right): https://codereview.chromium.org/2231523002/diff/1/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp#newcode385 third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp:385: resource->setNeedsSynchronousCacheHit(needsSynchronousCacheHit); On 2016/08/17 16:41:56, engedy wrote: > On 2016/08/09 ...
4 years, 4 months ago (2016-08-17 20:05:05 UTC) #13
engedy
I have finally had some time to get immersed in the layout test failures, and ...
4 years, 3 months ago (2016-09-21 21:04:01 UTC) #20
Nate Chapin
Code changes seem pretty good, but looks like you still have a couple of failing ...
4 years, 3 months ago (2016-09-21 23:23:41 UTC) #22
engedy
Addressed leftover test failures. Please take a final look. https://codereview.chromium.org/2231523002/diff/60001/third_party/WebKit/Source/core/loader/DocumentLoader.cpp File third_party/WebKit/Source/core/loader/DocumentLoader.cpp (right): https://codereview.chromium.org/2231523002/diff/60001/third_party/WebKit/Source/core/loader/DocumentLoader.cpp#newcode202 third_party/WebKit/Source/core/loader/DocumentLoader.cpp:202: ...
4 years, 2 months ago (2016-09-22 13:30:03 UTC) #27
Nate Chapin
lgtm with one last nitpick... https://codereview.chromium.org/2231523002/diff/100001/third_party/WebKit/Source/core/loader/DocumentLoader.cpp File third_party/WebKit/Source/core/loader/DocumentLoader.cpp (right): https://codereview.chromium.org/2231523002/diff/100001/third_party/WebKit/Source/core/loader/DocumentLoader.cpp#newcode202 third_party/WebKit/Source/core/loader/DocumentLoader.cpp:202: if (resource && !resource->resourceError().isAccessCheck()) ...
4 years, 2 months ago (2016-09-22 18:30:44 UTC) #33
engedy
Nate, could you please take a final look? Camille, could you please sanity check DocumentLoader ...
4 years, 2 months ago (2016-09-30 16:03:15 UTC) #47
Nate Chapin
lgtm
4 years, 2 months ago (2016-09-30 23:10:51 UTC) #51
jkarlin
Ping, any chance this will land soon? I'd like to land a dependent CL. Thanks!
4 years, 2 months ago (2016-10-03 17:14:26 UTC) #53
jkarlin
On 2016/10/03 17:14:26, jkarlin wrote: > Ping, any chance this will land soon? I'd like ...
4 years, 2 months ago (2016-10-03 17:17:16 UTC) #54
engedy
@Camille, friendly ping. Could you please sanity check DocumentLoader changes?
4 years, 2 months ago (2016-10-03 18:16:21 UTC) #55
clamy
Thanks! One comment below. https://codereview.chromium.org/2231523002/diff/140001/third_party/WebKit/Source/core/loader/DocumentLoader.cpp File third_party/WebKit/Source/core/loader/DocumentLoader.cpp (right): https://codereview.chromium.org/2231523002/diff/140001/third_party/WebKit/Source/core/loader/DocumentLoader.cpp#newcode673 third_party/WebKit/Source/core/loader/DocumentLoader.cpp:673: if (!m_mainResource || (m_frame->settings()->browserSideNavigationEnabled() && ...
4 years, 2 months ago (2016-10-04 14:49:53 UTC) #56
engedy
Adding Charlie and Nick for their thoughts. https://codereview.chromium.org/2231523002/diff/140001/third_party/WebKit/Source/core/loader/DocumentLoader.cpp File third_party/WebKit/Source/core/loader/DocumentLoader.cpp (right): https://codereview.chromium.org/2231523002/diff/140001/third_party/WebKit/Source/core/loader/DocumentLoader.cpp#newcode673 third_party/WebKit/Source/core/loader/DocumentLoader.cpp:673: if (!m_mainResource ...
4 years, 2 months ago (2016-10-04 23:11:22 UTC) #58
Bryan McQuade
On 2016/10/04 at 23:11:22, engedy wrote: > Adding Charlie and Nick for their thoughts. > ...
4 years, 2 months ago (2016-10-05 14:52:21 UTC) #59
Charlie Reis
[+alexmos] Sorry for the delayed reply. Alex, can you take a look at the OOPIF ...
4 years, 2 months ago (2016-10-05 19:53:15 UTC) #61
alexmos
On 2016/10/05 19:53:15, Charlie Reis wrote: > [+alexmos] > > Sorry for the delayed reply. ...
4 years, 2 months ago (2016-10-05 20:58:53 UTC) #62
engedy
Thank you both. Alex, please see my responses inline. https://codereview.chromium.org/2231523002/diff/140001/third_party/WebKit/Source/core/loader/DocumentLoader.cpp File third_party/WebKit/Source/core/loader/DocumentLoader.cpp (right): https://codereview.chromium.org/2231523002/diff/140001/third_party/WebKit/Source/core/loader/DocumentLoader.cpp#newcode673 third_party/WebKit/Source/core/loader/DocumentLoader.cpp:673: ...
4 years, 2 months ago (2016-10-05 23:26:25 UTC) #65
alexmos
https://codereview.chromium.org/2231523002/diff/140001/third_party/WebKit/Source/core/loader/DocumentLoader.cpp File third_party/WebKit/Source/core/loader/DocumentLoader.cpp (right): https://codereview.chromium.org/2231523002/diff/140001/third_party/WebKit/Source/core/loader/DocumentLoader.cpp#newcode673 third_party/WebKit/Source/core/loader/DocumentLoader.cpp:673: if (!m_mainResource || (m_frame->settings()->browserSideNavigationEnabled() && m_mainResource->errorOccurred())) { On 2016/10/05 ...
4 years, 2 months ago (2016-10-06 00:24:06 UTC) #68
engedy
https://codereview.chromium.org/2231523002/diff/140001/third_party/WebKit/Source/core/loader/DocumentLoader.cpp File third_party/WebKit/Source/core/loader/DocumentLoader.cpp (right): https://codereview.chromium.org/2231523002/diff/140001/third_party/WebKit/Source/core/loader/DocumentLoader.cpp#newcode673 third_party/WebKit/Source/core/loader/DocumentLoader.cpp:673: if (!m_mainResource || (m_frame->settings()->browserSideNavigationEnabled() && m_mainResource->errorOccurred())) { On 2016/10/06 ...
4 years, 2 months ago (2016-10-06 00:32:14 UTC) #69
engedy
Okay, looks like all specific concerns have been addressed, landing this now to unblock dependent ...
4 years, 2 months ago (2016-10-06 00:37:40 UTC) #71
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/2231523002/160001
4 years, 2 months ago (2016-10-06 00:40:37 UTC) #74
commit-bot: I haz the power
Committed patchset #8 (id:160001)
4 years, 2 months ago (2016-10-06 00:47:57 UTC) #76
commit-bot: I haz the power
Patchset 8 (id:??) landed as https://crrev.com/fd02740210e0152c94bd4c34a1e355280421730d Cr-Commit-Position: refs/heads/master@{#423358}
4 years, 2 months ago (2016-10-06 00:51:00 UTC) #78
nasko
4 years, 2 months ago (2016-10-06 22:16:07 UTC) #79
Message was sent while issue was closed.
A revert of this CL (patchset #8 id:160001) has been created in
https://codereview.chromium.org/2395313002/ by nasko@chromium.org.

The reason for reverting is: Reverting since it is causing flakiness on the
blink bots. Latest flake:

https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Win7%20%28dbg%...

unexpected_failures:
http/tests/security/contentSecurityPolicy/nonces/import-enforce-blocked.php.

Powered by Google App Engine
This is Rietveld 408576698