Bug 1953720 - In SetHTML create the inert document by inherting from the current document. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D241363
This commit is contained in:
@@ -5378,7 +5378,7 @@ void Element::SetHTML(const nsAString& aInnerHTML,
|
||||
ElementCreationOptionsOrString options;
|
||||
RefPtr<DocumentFragment> fragment;
|
||||
if (doc->IsHTMLDocument()) {
|
||||
inertDoc = nsContentUtils::CreateInertHTMLDocument(nullptr);
|
||||
inertDoc = nsContentUtils::CreateInertHTMLDocument(doc);
|
||||
if (!inertDoc) {
|
||||
aError = NS_ERROR_FAILURE;
|
||||
return;
|
||||
@@ -5392,7 +5392,7 @@ void Element::SetHTML(const nsAString& aInnerHTML,
|
||||
|
||||
} else {
|
||||
MOZ_ASSERT(doc->IsXMLDocument());
|
||||
inertDoc = nsContentUtils::CreateInertXMLDocument(nullptr);
|
||||
inertDoc = nsContentUtils::CreateInertXMLDocument(doc);
|
||||
if (!inertDoc) {
|
||||
aError = NS_ERROR_FAILURE;
|
||||
return;
|
||||
|
||||
@@ -826,9 +826,6 @@ void Sanitizer::SanitizeChildren(nsINode* aNode, bool aSafe) {
|
||||
if (auto* templateEl = HTMLTemplateElement::FromNode(child)) {
|
||||
// Step 2.4.4.1. Then call sanitize core on child’s template contents with
|
||||
// configuration and handleJavascriptNavigationUrls.
|
||||
|
||||
// TODO: The <template>'s content can't be accessed after sanitizing,
|
||||
// because nsINode::WrapObject throws NS_ERROR_UNEXPECTED.
|
||||
RefPtr<DocumentFragment> frag = templateEl->Content();
|
||||
SanitizeChildren<IsDefaultConfig>(frag, aSafe);
|
||||
}
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
[Testcase #20, "<div>test<div>p</div>tt<p>div</p></div>", config: "{ "elements": ["p"\], "replaceWithChildrenElements": ["div"\] }".]
|
||||
expected: FAIL
|
||||
|
||||
[Testcase #34, "<template><script>test</script><div>hello</div></template>", config: "{ "elements": ["template", "div"\] }".]
|
||||
expected: FAIL
|
||||
|
||||
[Testcase #66, "<div>balabala<i>test</i></div><test>t</test><custom-element>custom-element</custom-element>", config: "{ "replaceWithChildrenElements": [123, "test", "i", "custom-element"\],\n "elements": ["div"\]}".]
|
||||
expected: FAIL
|
||||
|
||||
@@ -19,15 +16,6 @@
|
||||
[Testcase #75, "<template><div>Hello</div></template>", config: "{ "elements": ["template"\], "replaceWithChildrenElements": ["div"\]}".]
|
||||
expected: FAIL
|
||||
|
||||
[Testcase #73, "<template><div>Hello</div></template>", config: "{ "elements": ["template"\]}".]
|
||||
expected: FAIL
|
||||
|
||||
[Testcase #71, "<template><div>Hello</div></template>", config: "{}".]
|
||||
expected: FAIL
|
||||
|
||||
[Testcase #74, "<template><div>Hello</div></template>", config: "{ "elements": ["div", "template"\]}".]
|
||||
expected: FAIL
|
||||
|
||||
[Testcase #31, "<div id='div' title='div'>DIV</div>", config: "{\n "elements": [{ "name": "div", "removeAttributes": ["id", "title"\] }\],\n "attributes": ["id", "title"\]\n}".]
|
||||
expected:
|
||||
if (os == "android") and not debug: [FAIL, PASS]
|
||||
@@ -39,9 +27,6 @@
|
||||
[Testcase #28, "<div id='div' title='div'>DIV</div>", config: "{ "elements": [{ "name": "div", "attributes": ["id"\], "removeAttributes": ["id"\] }\]}".]
|
||||
expected: FAIL
|
||||
|
||||
[Testcase #74, "<template><div>Hello</div></template>", config: "{ "elements": ["div", "template"\]}".]
|
||||
expected: FAIL
|
||||
|
||||
[Testcase #61, "<DIV>balabala<DL>test</DL></DIV>", config: "{ "removeElements": ["i", "dl"\] }".]
|
||||
expected:
|
||||
if (os == "android") and not debug: [PASS, FAIL]
|
||||
@@ -126,10 +111,6 @@
|
||||
expected:
|
||||
if (os == "android") and not debug: [PASS, FAIL]
|
||||
|
||||
[Testcase #72, "<template><div>Hello</div></template>", config: "{ "elements": ["div"\]}".]
|
||||
expected:
|
||||
if (os == "android") and not debug: [PASS, FAIL]
|
||||
|
||||
[Testcase #50, "<p>Some text</p></body><!-- 1 --></html><!-- 2 --><p>Some more text</p>", config: "undefined".]
|
||||
expected:
|
||||
if (os == "android") and not debug: [PASS, FAIL]
|
||||
|
||||
Reference in New Issue
Block a user