Commit 05a7cf0b authored by Yutaka Hirano's avatar Yutaka Hirano Committed by Commit Bot

Use context document's ResourceFetcher in InspectorResourceContentLoader (contd.)

This is a follow up change for
https://crrev.com/8ee3f7e6d3a79b15824b6e286eb71c0a96c4d879. See its CL
description for details.

I forgot to migrate a callsite in https://crrev.com/c/1830252, so
I'm doing that here.

Bug: 961614, 1006292
Change-Id: I74f2817d9958fb2cb7e265c0069590fea2f2844c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1844516
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Auto-Submit: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703214}
parent d94b0bb9
......@@ -93,6 +93,18 @@ void InspectorResourceContentLoader::Start() {
resource_request.SetCacheMode(mojom::FetchCacheMode::kDefault);
}
ResourceFetcher* fetcher = document->Fetcher();
if (base::FeatureList::IsEnabled(
features::kHtmlImportsRequestInitiatorLock)) {
// For @imports from HTML imported Documents, we use the
// context document for getting origin and ResourceFetcher to use the
// main Document's origin, while using the element document for
// CompleteURL() to use imported Documents' base URLs.
if (!document->ContextDocument()) {
continue;
}
fetcher = document->ContextDocument()->Fetcher();
}
if (!resource_request.Url().GetString().IsEmpty()) {
urls_to_fetch.insert(resource_request.Url().GetString());
ResourceLoaderOptions options;
......@@ -102,7 +114,7 @@ void InspectorResourceContentLoader::Start() {
MakeGarbageCollected<ResourceClient>(this);
// Prevent garbage collection by holding a reference to this resource.
resources_.push_back(
RawResource::Fetch(params, document->Fetcher(), resource_client));
RawResource::Fetch(params, fetcher, resource_client));
pending_resource_clients_.insert(resource_client);
}
......@@ -122,18 +134,6 @@ void InspectorResourceContentLoader::Start() {
FetchParameters params(resource_request, options);
ResourceClient* resource_client =
MakeGarbageCollected<ResourceClient>(this);
ResourceFetcher* fetcher = document->Fetcher();
if (base::FeatureList::IsEnabled(
features::kHtmlImportsRequestInitiatorLock)) {
// For @imports from HTML imported Documents, we use the
// context document for getting origin and ResourceFetcher to use the
// main Document's origin, while using the element document for
// CompleteURL() to use imported Documents' base URLs.
if (!document->ContextDocument()) {
continue;
}
fetcher = document->ContextDocument()->Fetcher();
}
// Prevent garbage collection by holding a reference to this resource.
resources_.push_back(
CSSStyleSheetResource::Fetch(params, fetcher, resource_client));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment