summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/xml
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-08-30 10:22:43 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-08-30 12:36:28 +0000
commit271a6c3487a14599023a9106329505597638d793 (patch)
treee040d58ffc86c1480b79ca8528020ca9ec919bf8 /chromium/third_party/blink/renderer/core/xml
parent7b2ffa587235a47d4094787d72f38102089f402a (diff)
downloadqtwebengine-chromium-271a6c3487a14599023a9106329505597638d793.tar.gz
BASELINE: Update Chromium to 77.0.3865.59
Change-Id: I1e89a5f3b009a9519a6705102ad65c92fe736f21 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/xml')
-rw-r--r--chromium/third_party/blink/renderer/core/xml/document_xslt.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/xml/dom_parser.cc6
-rw-r--r--chromium/third_party/blink/renderer/core/xml/parser/shared_buffer_reader.h2
-rw-r--r--chromium/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc24
-rw-r--r--chromium/third_party/blink/renderer/core/xml/parser/xml_document_parser.h11
-rw-r--r--chromium/third_party/blink/renderer/core/xml/parser/xml_document_parser_test.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/xml/parser/xml_parser_input.h2
-rw-r--r--chromium/third_party/blink/renderer/core/xml/xml_serializer.cc3
-rw-r--r--chromium/third_party/blink/renderer/core/xml/xpath_functions.cc11
-rw-r--r--chromium/third_party/blink/renderer/core/xml/xpath_functions_test.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/xml/xpath_node_set.cc4
-rw-r--r--chromium/third_party/blink/renderer/core/xml/xpath_parser.h2
-rw-r--r--chromium/third_party/blink/renderer/core/xml/xpath_step.cc29
-rw-r--r--chromium/third_party/blink/renderer/core/xml/xsl_style_sheet_libxslt.cc13
-rw-r--r--chromium/third_party/blink/renderer/core/xml/xslt_processor.cc18
-rw-r--r--chromium/third_party/blink/renderer/core/xml/xslt_processor_libxslt.cc9
16 files changed, 74 insertions, 66 deletions
diff --git a/chromium/third_party/blink/renderer/core/xml/document_xslt.cc b/chromium/third_party/blink/renderer/core/xml/document_xslt.cc
index 19f80650f34..0a787490830 100644
--- a/chromium/third_party/blink/renderer/core/xml/document_xslt.cc
+++ b/chromium/third_party/blink/renderer/core/xml/document_xslt.cc
@@ -11,12 +11,12 @@
#include "third_party/blink/renderer/core/dom/node.h"
#include "third_party/blink/renderer/core/dom/processing_instruction.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
-#include "third_party/blink/renderer/core/frame/use_counter.h"
#include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/core/xml/xsl_style_sheet.h"
#include "third_party/blink/renderer/core/xml/xslt_processor.h"
#include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
+#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
namespace blink {
diff --git a/chromium/third_party/blink/renderer/core/xml/dom_parser.cc b/chromium/third_party/blink/renderer/core/xml/dom_parser.cc
index c7973483043..996234e7538 100644
--- a/chromium/third_party/blink/renderer/core/xml/dom_parser.cc
+++ b/chromium/third_party/blink/renderer/core/xml/dom_parser.cc
@@ -43,13 +43,15 @@ Document* DOMParser::parseFromString(const StringOrTrustedHTML& stringOrHTML,
Document* DOMParser::parseFromStringInternal(const String& str,
const String& type) {
Document* doc = DOMImplementation::createDocument(
- type, DocumentInit::Create().WithContextDocument(context_document_),
+ type,
+ DocumentInit::Create()
+ .WithContextDocument(context_document_)
+ .WithOwnerDocument(context_document_),
false);
doc->SetContent(str);
doc->SetMimeType(AtomicString(type));
if (context_document_) {
doc->SetURL(context_document_->Url());
- doc->SetSecurityOrigin(context_document_->GetMutableSecurityOrigin());
}
return doc;
}
diff --git a/chromium/third_party/blink/renderer/core/xml/parser/shared_buffer_reader.h b/chromium/third_party/blink/renderer/core/xml/parser/shared_buffer_reader.h
index f517788882e..02218b20e9c 100644
--- a/chromium/third_party/blink/renderer/core/xml/parser/shared_buffer_reader.h
+++ b/chromium/third_party/blink/renderer/core/xml/parser/shared_buffer_reader.h
@@ -33,7 +33,7 @@
#include "base/memory/scoped_refptr.h"
#include "third_party/blink/renderer/core/core_export.h"
-#include "third_party/blink/renderer/platform/wtf/allocator.h"
+#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/forward.h"
namespace blink {
diff --git a/chromium/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc b/chromium/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc
index 990c1988e75..bff4f12dba9 100644
--- a/chromium/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc
+++ b/chromium/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc
@@ -48,7 +48,6 @@
#include "third_party/blink/renderer/core/dom/processing_instruction.h"
#include "third_party/blink/renderer/core/dom/transform_source.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
-#include "third_party/blink/renderer/core/frame/use_counter.h"
#include "third_party/blink/renderer/core/html/html_html_element.h"
#include "third_party/blink/renderer/core/html/html_template_element.h"
#include "third_party/blink/renderer/core/html/parser/html_entity_parser.h"
@@ -66,6 +65,7 @@
#include "third_party/blink/renderer/core/xmlns_names.h"
#include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
+#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/loader/fetch/fetch_initiator_type_names.h"
#include "third_party/blink/renderer/platform/loader/fetch/raw_resource.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_error.h"
@@ -606,8 +606,8 @@ static void* OpenFunc(const char* uri) {
ResourceLoaderOptions options;
options.initiator_info.name = fetch_initiator_type_names::kXml;
FetchParameters params(ResourceRequest(url), options);
- params.MutableResourceRequest().SetFetchRequestMode(
- network::mojom::FetchRequestMode::kSameOrigin);
+ params.MutableResourceRequest().SetMode(
+ network::mojom::RequestMode::kSameOrigin);
Resource* resource =
RawResource::FetchSynchronously(params, document->Fetcher());
if (!resource->ErrorOccurred()) {
@@ -684,12 +684,12 @@ scoped_refptr<XMLParserContext> XMLParserContext::CreateStringParser(
scoped_refptr<XMLParserContext> XMLParserContext::CreateMemoryParser(
xmlSAXHandlerPtr handlers,
void* user_data,
- const CString& chunk) {
+ const std::string& chunk) {
InitializeLibXMLIfNecessary();
// appendFragmentSource() checks that the length doesn't overflow an int.
xmlParserCtxtPtr parser =
- xmlCreateMemoryParserCtxt(chunk.data(), chunk.length());
+ xmlCreateMemoryParserCtxt(chunk.c_str(), chunk.length());
if (!parser)
return nullptr;
@@ -1050,16 +1050,13 @@ void XMLDocumentParser::EndElementNs() {
return;
ContainerNode* n = current_node_;
- if (current_node_->IsElementNode())
- ToElement(n)->FinishParsingChildren();
-
- if (!n->IsElementNode()) {
+ auto* element = DynamicTo<Element>(n);
+ if (!element) {
PopCurrentNode();
return;
}
- Element* element = ToElement(n);
-
+ element->FinishParsingChildren();
if (element->IsScriptElement() &&
!ScriptingContentIsAllowed(GetParserContentPolicy())) {
PopCurrentNode();
@@ -1491,7 +1488,7 @@ static void IgnorableWhitespaceHandler(void*, const xmlChar*, int) {
// http://bugs.webkit.org/show_bug.cgi?id=5792
}
-void XMLDocumentParser::InitializeParserContext(const CString& chunk) {
+void XMLDocumentParser::InitializeParserContext(const std::string& chunk) {
xmlSAXHandler sax;
memset(&sax, 0, sizeof(sax));
@@ -1525,7 +1522,6 @@ void XMLDocumentParser::InitializeParserContext(const CString& chunk) {
if (parsing_fragment_) {
context_ = XMLParserContext::CreateMemoryParser(&sax, this, chunk);
} else {
- DCHECK(!chunk.data());
context_ = XMLParserContext::CreateStringParser(&sax, this);
}
}
@@ -1633,7 +1629,7 @@ bool XMLDocumentParser::AppendFragmentSource(const String& chunk) {
DCHECK(!context_);
DCHECK(parsing_fragment_);
- CString chunk_as_utf8 = chunk.Utf8();
+ std::string chunk_as_utf8 = chunk.Utf8();
// libxml2 takes an int for a length, and therefore can't handle XML chunks
// larger than 2 GiB.
diff --git a/chromium/third_party/blink/renderer/core/xml/parser/xml_document_parser.h b/chromium/third_party/blink/renderer/core/xml/parser/xml_document_parser.h
index aaf355cbc40..823977256d3 100644
--- a/chromium/third_party/blink/renderer/core/xml/parser/xml_document_parser.h
+++ b/chromium/third_party/blink/renderer/core/xml/parser/xml_document_parser.h
@@ -36,10 +36,9 @@
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_client.h"
#include "third_party/blink/renderer/platform/text/segmented_string.h"
-#include "third_party/blink/renderer/platform/wtf/allocator.h"
+#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/hash_map.h"
#include "third_party/blink/renderer/platform/wtf/ref_counted.h"
-#include "third_party/blink/renderer/platform/wtf/text/cstring.h"
#include "third_party/blink/renderer/platform/wtf/text/string_hash.h"
namespace blink {
@@ -55,8 +54,10 @@ class XMLParserContext : public RefCounted<XMLParserContext> {
USING_FAST_MALLOC(XMLParserContext);
public:
- static scoped_refptr<XMLParserContext>
- CreateMemoryParser(xmlSAXHandlerPtr, void* user_data, const CString& chunk);
+ static scoped_refptr<XMLParserContext> CreateMemoryParser(
+ xmlSAXHandlerPtr,
+ void* user_data,
+ const std::string& chunk);
static scoped_refptr<XMLParserContext> CreateStringParser(xmlSAXHandlerPtr,
void* user_data);
~XMLParserContext();
@@ -158,7 +159,7 @@ class XMLDocumentParser final : public ScriptableDocumentParser,
void EndDocument();
private:
- void InitializeParserContext(const CString& chunk = CString());
+ void InitializeParserContext(const std::string& chunk = std::string());
void PushCurrentNode(ContainerNode*);
void PopCurrentNode();
diff --git a/chromium/third_party/blink/renderer/core/xml/parser/xml_document_parser_test.cc b/chromium/third_party/blink/renderer/core/xml/parser/xml_document_parser_test.cc
index 1fb07784637..d23e1f8c451 100644
--- a/chromium/third_party/blink/renderer/core/xml/parser/xml_document_parser_test.cc
+++ b/chromium/third_party/blink/renderer/core/xml/parser/xml_document_parser_test.cc
@@ -19,7 +19,7 @@ TEST(XMLDocumentParserTest, NodeNamespaceWithParseError) {
"<body><d:foo/></body></html>");
// The first child of <html> is <parseerror>, not <body>.
- Element* foo = ToElement(doc.documentElement()->lastChild()->firstChild());
+ auto* foo = To<Element>(doc.documentElement()->lastChild()->firstChild());
EXPECT_TRUE(foo->namespaceURI().IsNull()) << foo->namespaceURI();
EXPECT_TRUE(foo->prefix().IsNull()) << foo->prefix();
EXPECT_EQ(foo->localName(), "d:foo");
diff --git a/chromium/third_party/blink/renderer/core/xml/parser/xml_parser_input.h b/chromium/third_party/blink/renderer/core/xml/parser/xml_parser_input.h
index 5e9064062e8..0006ea5c486 100644
--- a/chromium/third_party/blink/renderer/core/xml/parser/xml_parser_input.h
+++ b/chromium/third_party/blink/renderer/core/xml/parser/xml_parser_input.h
@@ -31,7 +31,7 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_XML_PARSER_XML_PARSER_INPUT_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_XML_PARSER_XML_PARSER_INPUT_H_
-#include "third_party/blink/renderer/platform/wtf/allocator.h"
+#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink {
diff --git a/chromium/third_party/blink/renderer/core/xml/xml_serializer.cc b/chromium/third_party/blink/renderer/core/xml/xml_serializer.cc
index a866fc0bbee..3cd00f2d678 100644
--- a/chromium/third_party/blink/renderer/core/xml/xml_serializer.cc
+++ b/chromium/third_party/blink/renderer/core/xml/xml_serializer.cc
@@ -28,8 +28,7 @@ namespace blink {
String XMLSerializer::serializeToString(Node* root) {
DCHECK(root);
- MarkupAccumulator accumulator(kDoNotResolveURLs,
- SerializationType::kForcedXML);
+ MarkupAccumulator accumulator(kDoNotResolveURLs, SerializationType::kXML);
return accumulator.SerializeNodes<EditingStrategy>(*root, kIncludeNode);
}
diff --git a/chromium/third_party/blink/renderer/core/xml/xpath_functions.cc b/chromium/third_party/blink/renderer/core/xml/xpath_functions.cc
index f34df6c908d..c16650bffe2 100644
--- a/chromium/third_party/blink/renderer/core/xml/xpath_functions.cc
+++ b/chromium/third_party/blink/renderer/core/xml/xpath_functions.cc
@@ -382,7 +382,7 @@ static inline String ExpandedNameLocalPart(Node* node) {
// But note that Blink does not support namespace nodes.
switch (node->getNodeType()) {
case Node::kElementNode:
- return ToElement(node)->localName();
+ return To<Element>(node)->localName();
case Node::kAttributeNode:
return To<Attr>(node)->localName();
case Node::kProcessingInstructionNode:
@@ -395,7 +395,7 @@ static inline String ExpandedNameLocalPart(Node* node) {
static inline String ExpandedNamespaceURI(Node* node) {
switch (node->getNodeType()) {
case Node::kElementNode:
- return ToElement(node)->namespaceURI();
+ return To<Element>(node)->namespaceURI();
case Node::kAttributeNode:
return To<Attr>(node)->namespaceURI();
default:
@@ -408,7 +408,7 @@ static inline String ExpandedName(Node* node) {
switch (node->getNodeType()) {
case Node::kElementNode:
- prefix = ToElement(node)->prefix();
+ prefix = To<Element>(node)->prefix();
break;
case Node::kAttributeNode:
prefix = To<Attr>(node)->prefix();
@@ -629,10 +629,9 @@ Value FunLang::Evaluate(EvaluationContext& context) const {
const Attribute* language_attribute = nullptr;
Node* node = context.node.Get();
while (node) {
- if (node->IsElementNode()) {
- Element* element = ToElement(node);
+ if (auto* element = DynamicTo<Element>(node))
language_attribute = element->Attributes().Find(xml_names::kLangAttr);
- }
+
if (language_attribute)
break;
node = node->parentNode();
diff --git a/chromium/third_party/blink/renderer/core/xml/xpath_functions_test.cc b/chromium/third_party/blink/renderer/core/xml/xpath_functions_test.cc
index aec2da165b5..575ff415c52 100644
--- a/chromium/third_party/blink/renderer/core/xml/xpath_functions_test.cc
+++ b/chromium/third_party/blink/renderer/core/xml/xpath_functions_test.cc
@@ -11,7 +11,7 @@
#include "third_party/blink/renderer/core/xml/xpath_value.h"
#include "third_party/blink/renderer/platform/heap/handle.h" // HeapVector, Member, etc.
#include "third_party/blink/renderer/platform/heap/heap.h"
-#include "third_party/blink/renderer/platform/wtf/allocator.h"
+#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include <cmath>
#include <limits>
diff --git a/chromium/third_party/blink/renderer/core/xml/xpath_node_set.cc b/chromium/third_party/blink/renderer/core/xml/xpath_node_set.cc
index dfe3a488e53..3b945f1e71e 100644
--- a/chromium/third_party/blink/renderer/core/xml/xpath_node_set.cc
+++ b/chromium/third_party/blink/renderer/core/xml/xpath_node_set.cc
@@ -232,10 +232,10 @@ void NodeSet::TraversalSort() const {
if (nodes.Contains(&n))
sorted_nodes.push_back(&n);
- if (!contains_attribute_nodes || !n.IsElementNode())
+ auto* element = DynamicTo<Element>(&n);
+ if (!element || !contains_attribute_nodes)
continue;
- Element* element = ToElement(&n);
AttributeCollection attributes = element->Attributes();
for (auto& attribute : attributes) {
Attr* attr = element->AttrIfExists(attribute.GetName());
diff --git a/chromium/third_party/blink/renderer/core/xml/xpath_parser.h b/chromium/third_party/blink/renderer/core/xml/xpath_parser.h
index 46e69a16f40..5c05b54579f 100644
--- a/chromium/third_party/blink/renderer/core/xml/xpath_parser.h
+++ b/chromium/third_party/blink/renderer/core/xml/xpath_parser.h
@@ -31,7 +31,7 @@
#include "base/macros.h"
#include "third_party/blink/renderer/core/xml/xpath_predicate.h"
#include "third_party/blink/renderer/core/xml/xpath_step.h"
-#include "third_party/blink/renderer/platform/wtf/allocator.h"
+#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
namespace blink {
diff --git a/chromium/third_party/blink/renderer/core/xml/xpath_step.cc b/chromium/third_party/blink/renderer/core/xml/xpath_step.cc
index e933e00aa25..9cd60e7d3c4 100644
--- a/chromium/third_party/blink/renderer/core/xml/xpath_step.cc
+++ b/chromium/third_party/blink/renderer/core/xml/xpath_step.cc
@@ -204,31 +204,32 @@ static inline bool NodeMatchesBasicTest(Node* node,
#if DCHECK_IS_ON()
DCHECK_EQ(Node::kElementNode, PrimaryNodeType(axis));
#endif
- if (!node->IsElementNode())
+ auto* element = DynamicTo<Element>(node);
+ if (!element)
return false;
- Element& element = ToElement(*node);
- if (name == g_star_atom)
+ if (name == g_star_atom) {
return namespace_uri.IsEmpty() ||
- namespace_uri == element.namespaceURI();
+ namespace_uri == element->namespaceURI();
+ }
- if (element.GetDocument().IsHTMLDocument()) {
- if (element.IsHTMLElement()) {
+ if (element->GetDocument().IsHTMLDocument()) {
+ if (element->IsHTMLElement()) {
// Paths without namespaces should match HTML elements in HTML
// documents despite those having an XHTML namespace. Names are
// compared case-insensitively.
- return EqualIgnoringASCIICase(element.localName(), name) &&
+ return EqualIgnoringASCIICase(element->localName(), name) &&
(namespace_uri.IsNull() ||
- namespace_uri == element.namespaceURI());
+ namespace_uri == element->namespaceURI());
}
// An expression without any prefix shouldn't match no-namespace
// nodes (because HTML5 says so).
- return element.HasLocalName(name) &&
- namespace_uri == element.namespaceURI() &&
+ return element->HasLocalName(name) &&
+ namespace_uri == element->namespaceURI() &&
!namespace_uri.IsNull();
}
- return element.HasLocalName(name) &&
- namespace_uri == element.namespaceURI();
+ return element->HasLocalName(name) &&
+ namespace_uri == element->namespaceURI();
}
}
NOTREACHED();
@@ -376,10 +377,10 @@ void Step::NodesInAxis(EvaluationContext& evaluation_context,
}
case kAttributeAxis: {
- if (!context->IsElementNode())
+ auto* context_element = DynamicTo<Element>(context);
+ if (!context_element)
return;
- Element* context_element = ToElement(context);
// Avoid lazily creating attribute nodes for attributes that we do not
// need anyway.
if (GetNodeTest().GetKind() == NodeTest::kNameTest &&
diff --git a/chromium/third_party/blink/renderer/core/xml/xsl_style_sheet_libxslt.cc b/chromium/third_party/blink/renderer/core/xml/xsl_style_sheet_libxslt.cc
index b97d69c71ac..f92ccdd36d2 100644
--- a/chromium/third_party/blink/renderer/core/xml/xsl_style_sheet_libxslt.cc
+++ b/chromium/third_party/blink/renderer/core/xml/xsl_style_sheet_libxslt.cc
@@ -33,7 +33,6 @@
#include "third_party/blink/renderer/core/xml/xslt_processor.h"
#include "third_party/blink/renderer/platform/loader/fetch/fetch_initiator_type_names.h"
#include "third_party/blink/renderer/platform/loader/fetch/fetch_parameters.h"
-#include "third_party/blink/renderer/platform/wtf/text/cstring.h"
namespace blink {
@@ -143,7 +142,7 @@ bool XSLStyleSheet::ParseString(const String& source) {
stylesheet_doc_ =
xmlCtxtReadMemory(ctxt, input.Data(), input.size(),
- final_url_.GetString().Utf8().data(), input.Encoding(),
+ final_url_.GetString().Utf8().c_str(), input.Encoding(),
XML_PARSE_NOENT | XML_PARSE_DTDATTR |
XML_PARSE_NOWARNING | XML_PARSE_NOCDATA);
@@ -167,7 +166,7 @@ void XSLStyleSheet::LoadChildSheets() {
// We have to locate (by ID) the appropriate embedded stylesheet
// element, so that we can walk the import/include list.
xmlAttrPtr id_node = xmlGetID(
- GetDocument(), (const xmlChar*)(final_url_.GetString().Utf8().data()));
+ GetDocument(), (const xmlChar*)(final_url_.GetString().Utf8().c_str()));
if (!id_node)
return;
stylesheet_root = id_node->parent;
@@ -227,8 +226,8 @@ void XSLStyleSheet::LoadChildSheet(const String& href) {
fetch_options.initiator_info.name = fetch_initiator_type_names::kXml;
FetchParameters params(
ResourceRequest(OwnerDocument()->CompleteURL(url_string)), fetch_options);
- params.MutableResourceRequest().SetFetchRequestMode(
- network::mojom::FetchRequestMode::kSameOrigin);
+ params.MutableResourceRequest().SetMode(
+ network::mojom::RequestMode::kSameOrigin);
XSLStyleSheetResource* resource = XSLStyleSheetResource::FetchSynchronously(
params, OwnerDocument()->Fetcher());
if (!resource->Sheet())
@@ -287,10 +286,10 @@ xmlDocPtr XSLStyleSheet::LocateStylesheetSubResource(xmlDocPtr parent_doc,
// In order to ensure that libxml canonicalized both URLs, we get
// the original href string from the import rule and canonicalize it
// using libxml before comparing it with the URI argument.
- CString import_href = child->href().Utf8();
+ std::string import_href = child->href().Utf8();
xmlChar* base = xmlNodeGetBase(parent_doc, (xmlNodePtr)parent_doc);
xmlChar* child_uri =
- xmlBuildURI((const xmlChar*)import_href.data(), base);
+ xmlBuildURI((const xmlChar*)import_href.c_str(), base);
bool equal_ur_is = xmlStrEqual(uri, child_uri);
xmlFree(base);
xmlFree(child_uri);
diff --git a/chromium/third_party/blink/renderer/core/xml/xslt_processor.cc b/chromium/third_party/blink/renderer/core/xml/xslt_processor.cc
index dd4d2526cf7..1a2ebe4eee7 100644
--- a/chromium/third_party/blink/renderer/core/xml/xslt_processor.cc
+++ b/chromium/third_party/blink/renderer/core/xml/xslt_processor.cc
@@ -26,12 +26,14 @@
#include "third_party/blink/renderer/core/dom/document_fragment.h"
#include "third_party/blink/renderer/core/dom/document_init.h"
#include "third_party/blink/renderer/core/dom/dom_implementation.h"
+#include "third_party/blink/renderer/core/dom/ignore_opens_during_unload_count_incrementer.h"
#include "third_party/blink/renderer/core/editing/serializers/serialization.h"
#include "third_party/blink/renderer/core/frame/csp/content_security_policy.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_client.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
+#include "third_party/blink/renderer/core/html/html_frame_owner_element.h"
#include "third_party/blink/renderer/core/xml/document_xslt.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/wtf/assertions.h"
@@ -85,11 +87,23 @@ Document* XSLTProcessor::CreateDocumentFromSource(
if (frame) {
Document* old_document = frame->GetDocument();
+ init = init.WithOwnerDocument(old_document)
+ .WithSandboxFlags(old_document->GetSandboxFlags());
+
// Before parsing, we need to save & detach the old document and get the new
// document in place. Document::Shutdown() tears down the LocalFrameView, so
// remember whether or not there was one.
bool has_view = frame->View();
- old_document->Shutdown();
+ {
+ SubframeLoadingDisabler disabler(old_document);
+ IgnoreOpensDuringUnloadCountIncrementer ignore_opens_during_unload(
+ old_document);
+ frame->DetachChildren();
+ if (!frame->Client())
+ return nullptr;
+
+ old_document->Shutdown();
+ }
// Re-create the LocalFrameView if needed.
if (has_view)
frame->Client()->TransitionToCommittedForNewPage();
@@ -98,9 +112,7 @@ Document* XSLTProcessor::CreateDocumentFromSource(
if (old_document) {
DocumentXSLT::From(*result).SetTransformSourceDocument(old_document);
- result->UpdateSecurityOrigin(old_document->GetMutableSecurityOrigin());
result->SetCookieURL(old_document->CookieURL());
- result->EnforceSandboxFlags(old_document->GetSandboxFlags());
auto* csp = MakeGarbageCollected<ContentSecurityPolicy>();
csp->CopyStateFrom(old_document->GetContentSecurityPolicy());
diff --git a/chromium/third_party/blink/renderer/core/xml/xslt_processor_libxslt.cc b/chromium/third_party/blink/renderer/core/xml/xslt_processor_libxslt.cc
index eb1bdd36dd5..357492ef4dc 100644
--- a/chromium/third_party/blink/renderer/core/xml/xslt_processor_libxslt.cc
+++ b/chromium/third_party/blink/renderer/core/xml/xslt_processor_libxslt.cc
@@ -50,7 +50,6 @@
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/wtf/allocator/partitions.h"
#include "third_party/blink/renderer/platform/wtf/assertions.h"
-#include "third_party/blink/renderer/platform/wtf/text/cstring.h"
#include "third_party/blink/renderer/platform/wtf/text/string_buffer.h"
#include "third_party/blink/renderer/platform/wtf/text/utf8.h"
@@ -109,8 +108,8 @@ static xmlDocPtr DocLoaderFunc(const xmlChar* uri,
ResourceLoaderOptions fetch_options;
fetch_options.initiator_info.name = fetch_initiator_type_names::kXml;
FetchParameters params(ResourceRequest(url), fetch_options);
- params.MutableResourceRequest().SetFetchRequestMode(
- network::mojom::FetchRequestMode::kSameOrigin);
+ params.MutableResourceRequest().SetMode(
+ network::mojom::RequestMode::kSameOrigin);
Resource* resource =
RawResource::FetchSynchronously(params, g_global_resource_fetcher);
if (!g_global_processor)
@@ -247,9 +246,9 @@ static const char** XsltParamArrayFromParameterMap(
unsigned index = 0;
for (auto& parameter : parameters) {
parameter_array[index++] =
- AllocateParameterArray(parameter.key.Utf8().data());
+ AllocateParameterArray(parameter.key.Utf8().c_str());
parameter_array[index++] =
- AllocateParameterArray(parameter.value.Utf8().data());
+ AllocateParameterArray(parameter.value.Utf8().c_str());
}
parameter_array[index] = nullptr;