Commit 190c371d authored by Nate Chapin's avatar Nate Chapin Committed by Commit Bot

Ensure XSLTProcessor.transformToDocument() does not crash when called on a...

Ensure XSLTProcessor.transformToDocument() does not crash when called on a node from an inactive document

Bug: 1092276
Test: xslt/transformToFragment-on-node-from-inactive-document-crash.html
Change-Id: I0e3c42d1580eef0a499810f280bb997ef1e61740
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2236234
Auto-Submit: Nate Chapin <japhet@chromium.org>
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#776269}
parent 7a92e36f
...@@ -68,6 +68,9 @@ Document* XSLTProcessor::CreateDocumentFromSource( ...@@ -68,6 +68,9 @@ Document* XSLTProcessor::CreateDocumentFromSource(
const String& source_mime_type, const String& source_mime_type,
Node* source_node, Node* source_node,
LocalFrame* frame) { LocalFrame* frame) {
if (!source_node->GetExecutionContext())
return nullptr;
KURL url = NullURL(); KURL url = NullURL();
Document* owner_document = &source_node->GetDocument(); Document* owner_document = &source_node->GetDocument();
if (owner_document == source_node) if (owner_document == source_node)
......
<body>
<iframe id=i></iframe>
<script>
var el = i.contentDocument.documentElement;
i.remove()
var x = new XSLTProcessor();
var xsl =new DOMParser().parseFromString('<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"/>','application/xml');
x.importStylesheet(xsl);
x.transformToDocument(el);
</script>
</body>
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