New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 695808 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Leaves the project on 2018/03/02
Closed: Jun 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug
Proj-Servicification


Sign in to add a comment

Clean up credentials mode related flags in Blink

Project Member Reported by tyoshino@chromium.org, Feb 24 2017

Issue description

The various different credentials related flags have been confusing developers.

- Remove ResourceLoaderOptions::credentialsRequested in favor of ResourceRequest::m_fetchCredentialsMode
- Have DocumentThreadableLoader stop using ResourceLoaderOptions::securityOrigin and ResourceLoaderOptions::allowCredentials
  - Ideally we should just merge them, but current situation is bad that two different thing (ResourceLoader and DocumentThreadableLoader) are using this in different way. Clean up first.

This was originally worked on by horo@. CC horo@ to see if horo@ has any ongoing work.

 
Blocking: 427429
Blocking: 667641
Cc: hirosh...@chromium.org
Blocking: 727596
Project Member

Comment 5 by bugdroid1@chromium.org, Jun 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d3f566a349e0424c01a546d9929fe5b88be87290

commit d3f566a349e0424c01a546d9929fe5b88be87290
Author: Takeshi Yoshino <tyoshino@chromium.org>
Date: Tue Jun 06 08:34:49 2017

Remove the LinkRequestBuilder class

Given that LinkImport and LinkStyle already have access to owner_,
having additional capsulation doesn't contribute to readability much.

The original motivation was to get rid of copy of FetchParameters which
is just not good and also preventing making some of the FetchParameters
members e.g. unique_ptr.

Bug:  695808 
Change-Id: Ib5c90e359e8145df697837eaad8836d33fd6e23a
Reviewed-on: https://chromium-review.googlesource.com/523705
Commit-Queue: Takeshi Yoshino <tyoshino@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#477235}
[modify] https://crrev.com/d3f566a349e0424c01a546d9929fe5b88be87290/third_party/WebKit/Source/core/html/LinkResource.cpp
[modify] https://crrev.com/d3f566a349e0424c01a546d9929fe5b88be87290/third_party/WebKit/Source/core/html/LinkResource.h
[modify] https://crrev.com/d3f566a349e0424c01a546d9929fe5b88be87290/third_party/WebKit/Source/core/html/LinkStyle.cpp
[modify] https://crrev.com/d3f566a349e0424c01a546d9929fe5b88be87290/third_party/WebKit/Source/core/html/LinkStyle.h
[modify] https://crrev.com/d3f566a349e0424c01a546d9929fe5b88be87290/third_party/WebKit/Source/core/html/imports/LinkImport.cpp

Project Member

Comment 6 by bugdroid1@chromium.org, Jun 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5a5c889a2c718b350d82f666280e8ebff3450550

commit 5a5c889a2c718b350d82f666280e8ebff3450550
Author: Takeshi Yoshino <tyoshino@chromium.org>
Date: Tue Jun 06 15:45:35 2017

Reduce the number of constructors of ResourceLoaderOptions and FetchParameters

- Changed the credentials parameters in the default constructor of
  ResourceLoaderOptions to match what's done by
  ResourceFetcher::DefaultResourceOptions() and remove it
- Removed the FetchParameters constructor taking charset
- Removed the FetchInitiatorInfo related argument from the
  FetchParameters constructors and let the callers set it to the
  ResourceLoaderOptions parameter
- Let all the users explicitly specify the credentials parameters. They
  will be cleaned up https://chromium-review.googlesource.com/c/516925/
- Removed the initiator parameter from the ThreadableLoaderOptions
- The inconsistent combinations of allow_credentials and
  credentials_request are left unchanged. To be cleaned up.

Bug:  727596 ,  695808 
Change-Id: I8242b54e057af540a422d16043a3a74d466e7633
Reviewed-on: https://chromium-review.googlesource.com/519123
Commit-Queue: Takeshi Yoshino <tyoshino@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#477299}
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/css/CSSImageSetValue.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/css/CSSImageValue.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/css/StyleRuleImport.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/dom/ScriptLoader.h
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/exported/WebAssociatedURLLoaderImpl.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/fileapi/FileReaderLoader.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/html/LinkStyle.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/html/imports/LinkImport.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/html/parser/PreloadRequest.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/inspector/InspectorResourceContentLoader.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/loader/BaseFetchContextTest.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/loader/DocumentLoader.h
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/loader/ImageLoader.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/loader/LinkLoader.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/loader/PingLoader.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/loader/PingLoader.h
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/loader/TextTrackLoader.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/loader/ThreadableLoader.h
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/loader/WorkletScriptLoader.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoader.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoader.h
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/loader/resource/CSSStyleSheetResource.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/loader/resource/FontResourceTest.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/loader/resource/ImageResourceTest.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/loader/resource/ScriptResource.h
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/svg/SVGElementProxy.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/svg/SVGFEImageElement.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/svg/SVGUseElement.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/xml/XSLImportRule.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/xml/XSLTProcessorLibxslt.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/modules/eventsource/EventSource.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/modules/fetch/BlobBytesConsumer.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/modules/fetch/FetchManager.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/platform/loader/fetch/FetchParameters.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/platform/loader/fetch/FetchParameters.h
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/platform/loader/fetch/MemoryCacheCorrectnessTest.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/platform/loader/fetch/MemoryCacheTest.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/platform/loader/fetch/RawResource.h
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/platform/loader/fetch/RawResourceTest.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.h
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcherTest.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/platform/loader/fetch/ResourceLoaderOptions.h
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/platform/loader/fetch/ResourceLoaderOptionsTest.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/platform/loader/testing/MockResource.cpp
[modify] https://crrev.com/5a5c889a2c718b350d82f666280e8ebff3450550/third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Project Member

Comment 7 by bugdroid1@chromium.org, Jun 9 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/01f09fba7a7f4510b216ecb16c55ff52d2a2ba33

commit 01f09fba7a7f4510b216ecb16c55ff52d2a2ba33
Author: Takeshi Yoshino <tyoshino@chromium.org>
Date: Fri Jun 09 05:57:54 2017

Fix handling of the unsafe-credentials policy of the Suborigin

Factor out the logic to handle the unsafe-credentials policy of the
Suborigin into a method on the SecurityOrigin class.

Fix FetchParameters::SetCrossOriginAccessControl() not to touch origin
when it's nullptr.

The member variable include_credentials_ of XMLHttpRequest is renamed
to with_credentials_ as it's confusing with the local variable
include_credentials in CreateRequest().

Pass with_credentials_, not include_credentials to probe::willLoadXHR()
since it'll be used to set .withCredentials to replay the XHR.

ResourceRequest::SetFetchCredentialsMode() call and
ResourceLoaderOptions::credentials_requested setting must not be
affected by the result of suborigin policy check since it's equivalent
to the credentials mode. So, it should be set based on:
- XMLHttpRequest: the value set to withCredentials
- FetchManager: Request::Credentials()
- FetchParameters: CrossOriginAttributeValue

Add a note about why |cors_flag| is still used in
FetchManager::PerformHTTPFetch().

Bonus:
- Renamed FetchManager::PerformBasicFetch() to PerformSchemeFetch()
  based on the up-to-date terminology and fixed links to the spec.
- Refactored some related SecurityOrigin methods for readability.

Bug:  730912 ,  695808 
Change-Id: Ifece2a5c6a84cc4695bfdb0d1f3757083f7cac0b
Reviewed-on: https://chromium-review.googlesource.com/526212
Commit-Queue: Takeshi Yoshino <tyoshino@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#478214}
[modify] https://crrev.com/01f09fba7a7f4510b216ecb16c55ff52d2a2ba33/third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-unsafe-credentials.php
[modify] https://crrev.com/01f09fba7a7f4510b216ecb16c55ff52d2a2ba33/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
[modify] https://crrev.com/01f09fba7a7f4510b216ecb16c55ff52d2a2ba33/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.h
[modify] https://crrev.com/01f09fba7a7f4510b216ecb16c55ff52d2a2ba33/third_party/WebKit/Source/modules/fetch/FetchManager.cpp
[modify] https://crrev.com/01f09fba7a7f4510b216ecb16c55ff52d2a2ba33/third_party/WebKit/Source/platform/loader/fetch/FetchParameters.cpp
[modify] https://crrev.com/01f09fba7a7f4510b216ecb16c55ff52d2a2ba33/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp
[modify] https://crrev.com/01f09fba7a7f4510b216ecb16c55ff52d2a2ba33/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.h

Project Member

Comment 8 by bugdroid1@chromium.org, Jun 13 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/43a09226e00add3bc4e007bc2e171cfb3afe2df7

commit 43a09226e00add3bc4e007bc2e171cfb3afe2df7
Author: Takeshi Yoshino <tyoshino@chromium.org>
Date: Tue Jun 13 19:08:22 2017

Remove a redundant if-clause from GetLoadFlagsForWebURLRequest()

This CL also removed an outdated comment from
WebURLRequest::AllowStoredCredentials().

Bug:  695808 
Change-Id: Ib03a91964c704fd3524b34b27c0e6ebd50042ab3
Reviewed-on: https://chromium-review.googlesource.com/533553
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Takeshi Yoshino <tyoshino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#479091}
[modify] https://crrev.com/43a09226e00add3bc4e007bc2e171cfb3afe2df7/content/child/web_url_request_util.cc
[modify] https://crrev.com/43a09226e00add3bc4e007bc2e171cfb3afe2df7/third_party/WebKit/public/platform/WebURLRequest.h

Project Member

Comment 9 by bugdroid1@chromium.org, Jun 16 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/8944638a34f6c6bdb393c0ee5dd05293e6421776

commit 8944638a34f6c6bdb393c0ee5dd05293e6421776
Author: Takeshi Yoshino <tyoshino@chromium.org>
Date: Fri Jun 16 07:00:28 2017

Add Create() methods that take KURL to Resource classes

This is preparation for
https://chromium-review.googlesource.com/c/516925

MockResource is unchanged but the caller sites are modified
so that https://chromium-review.googlesource.com/c/516925 can
easily add SetFetchCredentialsMode().

Bug:  695808 
Change-Id: Ia330d628db1ed4ee82e2cc5292dc0bb0e54fa6b6
Reviewed-on: https://chromium-review.googlesource.com/536220
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Commit-Queue: Takeshi Yoshino <tyoshino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#479976}
[modify] https://crrev.com/8944638a34f6c6bdb393c0ee5dd05293e6421776/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp
[modify] https://crrev.com/8944638a34f6c6bdb393c0ee5dd05293e6421776/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunnerTest.cpp
[modify] https://crrev.com/8944638a34f6c6bdb393c0ee5dd05293e6421776/third_party/WebKit/Source/core/frame/SubresourceIntegrityTest.cpp
[modify] https://crrev.com/8944638a34f6c6bdb393c0ee5dd05293e6421776/third_party/WebKit/Source/core/html/parser/CSSPreloadScannerTest.cpp
[modify] https://crrev.com/8944638a34f6c6bdb393c0ee5dd05293e6421776/third_party/WebKit/Source/core/loader/resource/CSSStyleSheetResource.cpp
[modify] https://crrev.com/8944638a34f6c6bdb393c0ee5dd05293e6421776/third_party/WebKit/Source/core/loader/resource/CSSStyleSheetResource.h
[modify] https://crrev.com/8944638a34f6c6bdb393c0ee5dd05293e6421776/third_party/WebKit/Source/core/loader/resource/CSSStyleSheetResourceTest.cpp
[modify] https://crrev.com/8944638a34f6c6bdb393c0ee5dd05293e6421776/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp
[modify] https://crrev.com/8944638a34f6c6bdb393c0ee5dd05293e6421776/third_party/WebKit/Source/core/loader/resource/ImageResource.h
[modify] https://crrev.com/8944638a34f6c6bdb393c0ee5dd05293e6421776/third_party/WebKit/Source/core/loader/resource/ImageResourceTest.cpp
[modify] https://crrev.com/8944638a34f6c6bdb393c0ee5dd05293e6421776/third_party/WebKit/Source/core/loader/resource/ScriptResource.h
[modify] https://crrev.com/8944638a34f6c6bdb393c0ee5dd05293e6421776/third_party/WebKit/Source/platform/loader/fetch/MemoryCacheCorrectnessTest.cpp
[modify] https://crrev.com/8944638a34f6c6bdb393c0ee5dd05293e6421776/third_party/WebKit/Source/platform/loader/fetch/MemoryCacheTest.cpp
[modify] https://crrev.com/8944638a34f6c6bdb393c0ee5dd05293e6421776/third_party/WebKit/Source/platform/loader/fetch/RawResource.h
[modify] https://crrev.com/8944638a34f6c6bdb393c0ee5dd05293e6421776/third_party/WebKit/Source/platform/loader/fetch/RawResourceTest.cpp
[modify] https://crrev.com/8944638a34f6c6bdb393c0ee5dd05293e6421776/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcherTest.cpp
[modify] https://crrev.com/8944638a34f6c6bdb393c0ee5dd05293e6421776/third_party/WebKit/Source/platform/loader/fetch/ResourceTest.cpp

Project Member

Comment 10 by bugdroid1@chromium.org, Jun 21 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2e231cf052ca5e68e22baf0008ac9e5e29121707

commit 2e231cf052ca5e68e22baf0008ac9e5e29121707
Author: Takeshi Yoshino <tyoshino@chromium.org>
Date: Wed Jun 21 09:00:30 2017

Replace the credentials related parameters in ResourceLoaderOptions with FetchCredentialsMode

This has been causing lots of pain in working on the loading code.

This patch is for:
- code health
- architecture improvement
- to enable ES6 modules to use the omit credentials mode

ResourceLoaderOptions::cors_enabled will be replaced with
- cors_handling_by_resource_fetcher
- ResourceRequest::FetchRequestMode()
as it's been confusing.

DocumentThreadableLoader will be refactored to have cors_flag_ which
better corresponds to the spec term.

Same-origin-ness checking logics are unified from FetchManager,
EventSource, XMLHttpRequest into DocumentThreadableLoader.

One in FetchParameters::SetCrossOriginAccessControl() will be also
unified into ResourceFetcher/ResourceLoader.

The logic to handle the unsafe-credentials policy of the Suborigin will
be also unified similarly.

This patch fixes the issue that Service Workers get incorrect
FetchCredentialsMode. DocumentThreadableLoader has been passing the
credentials mode based on the determined credentials flag
(ResourceRequest::AllowStoredCredentials()). After this patch, the
right credentials mode will be passed. Due to this fix, several tests
are rebaselined.

WebAssociatedURLLoader users are changed to use the credentials mode
while trying to fix them if possible based on the corresponding specs,
and keep the existing behavior as possible as we can where we cannot
fix them.

The UMA kXMLHttpRequestCrossOriginWithCredentials in XMLHttpRequest is
changed not to take into account the Suborigin policy effect, since to
keep it we'll need to keep the complicated useless logic there.

FileReaderLoader is changed to just use the default FetchCredentialsMode
as it does nothing for Blobs.

PingLoader is fixed to use CanRequestNoSuborigin().

WorkerScriptLoader is kept using the same credentials mode while the
wrong same-origin-ness check will be fixed by just depending on the
DocumentThreadableLoader.

NotificationImageLoader is fixed similarly.

CORS RFC 1918 logic in DocumentThreadableLoader forces it to issue
a preflight for external requests. This was causing same-origin
requests to fail due to the unnecessarily performed CORS check. As a
side effect of this patch, the issue will be fixed. This is why
request-from-popup.html layout test is rebaselined.

ModuleScriptLoader now can use the omit credentials mode.

See the design doc at
https://docs.google.com/document/d/1Iso_WSAUY_KKXWr9X3niEf1eu9Z_o5Gesp_P4xmJRDw/edit#

Bug:  717525 ,  427429 ,  727596 ,  695808 
Change-Id: I663e40c8385868b6e64fe71248f85f8aff1ae176
Reviewed-on: https://chromium-review.googlesource.com/516925
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Bill Budge <bbudge@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Commit-Queue: Takeshi Yoshino <tyoshino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#481152}
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/chrome/browser/chrome_service_worker_browsertest.cc
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/components/nacl/renderer/ppb_nacl_private_impl.cc
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/content/renderer/fetchers/manifest_fetcher.cc
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/content/renderer/fetchers/multi_resolution_image_resource_fetcher.cc
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/content/renderer/media/android/media_info_loader.cc
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/content/renderer/pepper/pepper_url_loader_host.cc
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/media/blink/resource_multibuffer_data_provider.cc
[delete] https://crrev.com/acf467f15ce17fcfcd710b663fb86da82fc54140/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-cors-xhr.https-expected.txt
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-request-xhr-iframe.html
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/request-from-popup-expected.txt
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/css/CSSImageSetValue.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/css/CSSImageValue.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/css/StyleRuleImport.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/exported/WebAssociatedURLLoaderImpl.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/exported/WebAssociatedURLLoaderImplTest.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/fileapi/FileReaderLoader.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/html/LinkStyle.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/html/imports/LinkImport.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/html/parser/PreloadRequest.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/inspector/InspectorResourceContentLoader.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/loader/BaseFetchContextTest.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/loader/ImageLoader.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/loader/LinkLoader.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/loader/PingLoader.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/loader/TextTrackLoader.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/loader/WorkletScriptLoader.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoader.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/loader/private/CrossOriginPreflightResultCache.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/loader/private/CrossOriginPreflightResultCache.h
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/loader/resource/CSSStyleSheetResource.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/loader/resource/ImageResourceTest.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/loader/resource/ScriptResource.h
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/svg/SVGElementProxy.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/svg/SVGFEImageElement.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/svg/SVGUseElement.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/workers/InProcessWorkerBase.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/workers/WorkerScriptLoader.h
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/xml/XSLImportRule.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/xml/XSLTProcessorLibxslt.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/modules/eventsource/EventSource.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/modules/fetch/BlobBytesConsumer.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/modules/fetch/FetchManager.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/platform/loader/fetch/CrossOriginAccessControl.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/platform/loader/fetch/CrossOriginAccessControl.h
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/platform/loader/fetch/FetchParameters.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/platform/loader/fetch/FetchParameters.h
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/platform/loader/fetch/FetchUtils.h
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/platform/loader/fetch/MemoryCacheCorrectnessTest.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/platform/loader/fetch/MemoryCacheTest.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/platform/loader/fetch/RawResource.h
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/platform/loader/fetch/Resource.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcherTest.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/platform/loader/fetch/ResourceLoader.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/platform/loader/fetch/ResourceLoaderOptions.h
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/platform/loader/fetch/ResourceLoaderOptionsTest.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/platform/loader/testing/MockResource.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
[modify] https://crrev.com/2e231cf052ca5e68e22baf0008ac9e5e29121707/third_party/WebKit/public/web/WebAssociatedURLLoaderOptions.h

Project Member

Comment 11 by bugdroid1@chromium.org, Jun 23 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4e1b65b8cd5a5f4ddb4e37f68a61432306741107

commit 4e1b65b8cd5a5f4ddb4e37f68a61432306741107
Author: Takeshi Yoshino <tyoshino@chromium.org>
Date: Fri Jun 23 11:10:52 2017

Clean up the CORS preflight part of DocumentThreadableLoader::MakeCrossOriginAccessRequest()

The bunch of if-clauses are hard to read. Reorganize them for better
readability.

Unify the multiple checks on IsExternalRequest.

Early return for IsExternalRequest().

Don't check CORS-safelisted-ness when either of the external request or
forced preflight condition is already met.

Clarify where the ServiceWorkerMode configuration is required and its
reason for each place.

Bug:  695808 ,  604084 
Change-Id: I2a056afeebea4d6472e60c52cc72fd58c6bef703
Reviewed-on: https://chromium-review.googlesource.com/542676
Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
Commit-Queue: Takeshi Yoshino <tyoshino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#481846}
[modify] https://crrev.com/4e1b65b8cd5a5f4ddb4e37f68a61432306741107/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
[modify] https://crrev.com/4e1b65b8cd5a5f4ddb4e37f68a61432306741107/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h

Blocking: 736308
Project Member

Comment 13 by bugdroid1@chromium.org, Jun 23 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0b780180db24e6b76ac8e433e8b02d8c1834667f

commit 0b780180db24e6b76ac8e433e8b02d8c1834667f
Author: Takeshi Yoshino <tyoshino@chromium.org>
Date: Fri Jun 23 15:14:47 2017

Make a condition in ResourceFetcher::IsReusableAlsoForPreloading() a little more readable

Bug:  695808 
Change-Id: Iab3b5da25eb6c920e3ab998fe7a6cbc69d7222af
Reviewed-on: https://chromium-review.googlesource.com/542995
Commit-Queue: Takeshi Yoshino <tyoshino@chromium.org>
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#481890}
[modify] https://crrev.com/0b780180db24e6b76ac8e433e8b02d8c1834667f/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp

Project Member

Comment 14 by bugdroid1@chromium.org, Jun 28 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f

commit 7d5b74f1738443fff936e2d0e5815a26a5aa7b2f
Author: Takeshi Yoshino <tyoshino@chromium.org>
Date: Wed Jun 28 15:27:07 2017

Remove the FetchRequestMode/FetchCredentialsMode parameters from WebAssociatedURLLoaderOptions and ThreadableLoaderOptions

The modes will be set only by directly calling the setters on the
ResourceRequest, not via any option struct.

Since WebAssociatedURLLoaderOptions, ThreadableLoaderOptions, and
ResourceRequest had different default values, there are addition/removal
of the setter calls.

The default values were:

WebAssociatedURLLoaderOptions:
- mode: "same-origin"
- credentials mode: "omit"

ThreadableLoaderOptions:
- mode: "same-origin"
- credentials mode has already been removed from this class

ResourceRequest:
- mode: "no-cors"
- credentials mode: "include"

Bug:  727596 ,  695808 
Change-Id: Ie0d5e30e673dd60065db5446f85e697c503531e6
Reviewed-on: https://chromium-review.googlesource.com/544399
Commit-Queue: Takeshi Yoshino <tyoshino@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Bill Budge <bbudge@chromium.org>
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#482993}
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/components/nacl/renderer/ppb_nacl_private_impl.cc
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/content/public/renderer/associated_resource_fetcher.h
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/content/renderer/fetchers/associated_resource_fetcher_impl.cc
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/content/renderer/fetchers/associated_resource_fetcher_impl.h
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/content/renderer/fetchers/manifest_fetcher.cc
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/content/renderer/fetchers/multi_resolution_image_resource_fetcher.cc
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/content/renderer/pepper/pepper_url_loader_host.cc
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/media/blink/resource_multibuffer_data_provider.cc
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/third_party/WebKit/Source/core/exported/WebAssociatedURLLoaderImpl.cpp
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/third_party/WebKit/Source/core/exported/WebAssociatedURLLoaderImplTest.cpp
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/third_party/WebKit/Source/core/fileapi/FileReaderLoader.cpp
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/third_party/WebKit/Source/core/loader/ThreadableLoader.h
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/third_party/WebKit/Source/modules/eventsource/EventSource.cpp
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/third_party/WebKit/Source/modules/fetch/BlobBytesConsumer.cpp
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/third_party/WebKit/Source/modules/fetch/FetchManager.cpp
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.cpp
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
[modify] https://crrev.com/7d5b74f1738443fff936e2d0e5815a26a5aa7b2f/third_party/WebKit/public/web/WebAssociatedURLLoaderOptions.h

Status: Fixed (was: Started)
Done!!!!!
Components: Internals>Network>Service
Components: -Internals>Network>Service Internals>Services>Network
Apologies, applied the wrong component in bulk.

Sign in to add a comment