Commit 627929d3 authored by Yutaka Hirano's avatar Yutaka Hirano Committed by Commit Bot

Use context document's ResourceFetcher in SVGUseElement

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

Bug: 961614, 1006292
Change-Id: Ie520b78d9b2f305a74a59e089d56c976a9349c52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1829626Reviewed-by: default avatarHiroshige Hayashizaki <hiroshige@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702333}
parent 1eab4d2c
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "third_party/blink/renderer/core/svg/svg_use_element.h" #include "third_party/blink/renderer/core/svg/svg_use_element.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/core/css/style_change_reason.h" #include "third_party/blink/renderer/core/css/style_change_reason.h"
#include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/document.h"
...@@ -203,7 +204,20 @@ void SVGUseElement::UpdateTargetReference() { ...@@ -203,7 +204,20 @@ void SVGUseElement::UpdateTargetReference() {
FetchParameters params(ResourceRequest(element_url_), options); FetchParameters params(ResourceRequest(element_url_), options);
params.MutableResourceRequest().SetMode( params.MutableResourceRequest().SetMode(
network::mojom::RequestMode::kSameOrigin); network::mojom::RequestMode::kSameOrigin);
DocumentResource::FetchSVGDocument(params, GetDocument().Fetcher(), this); ResourceFetcher* fetcher = GetDocument().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 (!GetDocument().ContextDocument()) {
ClearResource();
return;
}
fetcher = GetDocument().ContextDocument()->Fetcher();
}
DocumentResource::FetchSVGDocument(params, fetcher, this);
} }
void SVGUseElement::SvgAttributeChanged(const QualifiedName& attr_name) { void SVGUseElement::SvgAttributeChanged(const QualifiedName& attr_name) {
......
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