Revision 86fb98f2c3ec4e05bc529f19e41465da62052c3a authored by Lukasz Anforowicz on 02 April 2018, 23:48:36 UTC, committed by Chromium WPT Sync on 02 April 2018, 23:48:36 UTC
https://tools.ietf.org/html/rfc7303 says that if "new media type is introduced for an XML-based format, the name of the media type SHOULD end with '+xml'". https://tools.ietf.org/html/rfc6839 covers '+xml' and '+json' suffixes. https://mimesniff.spec.whatwg.org/#xml-mime-type says "An XML MIME type is any MIME type whose subtype ends in '+xml' or whose essence is 'text/xml' or 'application/xml'. [RFC7303]". https://mimesniff.spec.whatwg.org/#json-mime-type says "A JSON MIME type is any MIME type whose subtype ends in '+json' or whose essence is 'application/json' or 'text/json'." There are no occurences of "application/xml+", "text/xml+", "application/json+", "text/json+" or "text/x-json" in the specs above and on various lists of MIME types like: - https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types - https://en.wikipedia.org/wiki/Media_type - https://www.freeformatter.com/mime-types-list.html - https://www.sitepoint.com/mime-types-complete-list/ Bug: 826756 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo Change-Id: Ied30f9728bd4f082bb620fea150f342457ea4833 Reviewed-on: https://chromium-review.googlesource.com/985211 Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org> Reviewed-by: Nick Carter <nick@chromium.org> Cr-Commit-Position: refs/heads/master@{#547565}
1 parent 94b7255
insert_adjacent_html.html
<!DOCTYPE HTML>
<html>
<head>
<title>insertAdjacentHTML in HTML</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="insert_adjacent_html.js"></script>
</head>
<body>
<p id="display"></p><div id="content" style="display: none"></div><div id="content2" style="display: none"></div>
<script>
var script_ran = false;
function testPositions(node, testDesc) {
test(function() {
script_ran = false;
node.insertAdjacentHTML("beforeBegin", "\u003Cscript>script_ran = true;\u003C/script><i></i>");
assert_equals(node.previousSibling.localName, "i", "Should have had <i> as previous sibling");
assert_equals(node.previousSibling.previousSibling.localName, "script", "Should have had <script> as second previous child");
assert_false(script_ran, "script should not have run");
}, "beforeBegin " + node.id + " " + testDesc)
test(function() {
script_ran = false;
node.insertAdjacentHTML("Afterbegin", "<b></b>\u003Cscript>script_ran = true;\u003C/script>");
assert_equals(node.firstChild.localName, "b", "Should have had <b> as first child");
assert_equals(node.firstChild.nextSibling.localName, "script", "Should have had <script> as second child");
assert_false(script_ran, "script should not have run");
}, "Afterbegin " + node.id + " " + testDesc);
test(function() {
script_ran = false;
node.insertAdjacentHTML("BeforeEnd", "\u003Cscript>script_ran = true;\u003C/script><u></u>");
assert_equals(node.lastChild.localName, "u", "Should have had <u> as last child");
assert_equals(node.lastChild.previousSibling.localName, "script", "Should have had <script> as penultimate child");
assert_false(script_ran, "script should not have run");
}, "BeforeEnd " + node.id + " " + testDesc)
test(function() {
script_ran = false;
node.insertAdjacentHTML("afterend", "<a></a>\u003Cscript>script_ran = true;\u003C/script>");
assert_equals(node.nextSibling.localName, "a", "Should have had <a> as next sibling");
assert_equals(node.nextSibling.nextSibling.localName, "script", "Should have had <script> as second next sibling");
assert_false(script_ran, "script should not have run");
}, "afterend " + node.id + " " + testDesc)
}
var content = document.getElementById("content");
testPositions(content, "without next sibling");
testPositions(content, "again, with next sibling");
test(function() {
assert_throws("SYNTAX_ERR", function() {content.insertAdjacentHTML("bar", "foo")});
assert_throws("SYNTAX_ERR", function() {content.insertAdjacentHTML("beforebegİn", "foo")});
assert_throws("SYNTAX_ERR", function() {content.insertAdjacentHTML("beforebegın", "foo")});
}, "Should throw when inserting with invalid position string");
var parentElement = document.createElement("div");
var child = document.createElement("div");
child.id = "child";
testThrowingNoParent(child, "null");
testThrowingNoParent(document.documentElement, "a document");
test(function() {
child.insertAdjacentHTML("afterBegin", "foo");
child.insertAdjacentHTML("beforeend", "bar");
assert_equals(child.textContent, "foobar");
parentElement.appendChild(child);
}, "Inserting after being and before end should order things correctly");
testPositions(child, "node not in tree but has parent");
test(function() {
script_ran = false;
content.appendChild(parentElement); // must not run scripts
assert_false(script_ran, "script should not have run");
}, "Should not run script when appending things which have descendant <script> inserted via insertAdjacentHTML");
var content2 = document.getElementById("content2");
testPositions(content2, "without next sibling");
testPositions(content2, "test again, now that there's a next sibling");
// HTML only
test(function() {
document.body.insertAdjacentHTML("afterend", "<p>");
document.head.insertAdjacentHTML("beforebegin", "<p>");
assert_equals(document.getElementsByTagName("head").length, 1, "Should still have one head");
assert_equals(document.getElementsByTagName("body").length, 1, "Should still have one body");
}, "Inserting kids of the <html> element should not do weird things with implied <body>/<head> tags")
</script>
<div id="log"></div>
</body>
</html>
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...