Commit 547e2fcf authored by Yutaka Hirano's avatar Yutaka Hirano Committed by Commit Bot

Use context document's ResourceFetcher in InspectorResourceContentLoader

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

Bug: 961614, 1006292
Change-Id: I260fe04bef3cba60f9045b498d2fb9bd0eed6e1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1830252Reviewed-by: default avatarŁukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: default avatarHiroshige Hayashizaki <hiroshige@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702314}
parent 63526b1d
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "third_party/blink/renderer/core/inspector/inspector_resource_content_loader.h" #include "third_party/blink/renderer/core/inspector/inspector_resource_content_loader.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h" #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h"
#include "third_party/blink/public/platform/web_url_request.h" #include "third_party/blink/public/platform/web_url_request.h"
#include "third_party/blink/renderer/core/css/css_style_sheet.h" #include "third_party/blink/renderer/core/css/css_style_sheet.h"
...@@ -121,9 +122,21 @@ void InspectorResourceContentLoader::Start() { ...@@ -121,9 +122,21 @@ void InspectorResourceContentLoader::Start() {
FetchParameters params(resource_request, options); FetchParameters params(resource_request, options);
ResourceClient* resource_client = ResourceClient* resource_client =
MakeGarbageCollected<ResourceClient>(this); 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. // Prevent garbage collection by holding a reference to this resource.
resources_.push_back(CSSStyleSheetResource::Fetch( resources_.push_back(
params, document->Fetcher(), resource_client)); CSSStyleSheetResource::Fetch(params, fetcher, resource_client));
// A cache hit for a css stylesheet will complete synchronously. Don't // A cache hit for a css stylesheet will complete synchronously. Don't
// mark the client as pending if it already finished. // mark the client as pending if it already finished.
if (resource_client->GetResource()) if (resource_client->GetResource())
......
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