Bug 1470163: Move test_disabled to an iframe. r=heycam

MozReview-Commit-ID: Ks4bEVNxs82
This commit is contained in:
Emilio Cobos Álvarez 2018-06-24 06:11:38 +02:00
parent 8138ef471d
commit 88831b3bc5
6 changed files with 103 additions and 92 deletions

View file

@ -0,0 +1,33 @@
<!doctype html>
<script>
window.is = window.parent.is;
window.SimpleTest = window.parent.SimpleTest;
</script>
<div id="testnodes"><span>hi</span> there <!-- mon ami --></div>
<pre id="test">
<script>
let t = document.getElementById('testnodes');
t.innerHTML = null;
t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math:math"));
t.firstChild.textContent = "<foo>";
is(t.innerHTML, "<math:math>&lt;foo&gt;</math:math>");
t.innerHTML = null;
t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math"));
is(t.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML");
t.firstChild.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "script"));
is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML");
t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
is(t.innerHTML, '<math><script>1&amp;2&lt;3&gt;4&nbsp;\u003C/script></math>');
t.innerHTML = null;
t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math"));
is(t.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML");
t.firstChild.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "style"));
is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML");
t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
is(t.innerHTML, '<math><style>1&amp;2&lt;3&gt;4&nbsp;\u003C/style></math>');
SimpleTest.finish();
</script>
</pre>

View file

@ -1,4 +1,6 @@
[DEFAULT]
support-files =
file_disabled_iframe.html
[test_bug330964.html]
[test_bug553917.html]

View file

@ -1,45 +1,21 @@
<!DOCTYPE HTML>
<html>
<!--
Copied from
https://bugzilla.mozilla.org/show_bug.cgi?id=744830
Copied from https://bugzilla.mozilla.org/show_bug.cgi?id=744830
-->
<head>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=166235">Mozilla Bug 166235</a>
<div id="testnodes"><span>hi</span> there <!-- mon ami --></div>
<iframe></iframe>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["mathml.disabled", true]]}, doTest);
function doTest() {
let t = document.getElementById('testnodes');
t.innerHTML = null;
t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math:math"));
t.firstChild.textContent = "<foo>";
is(t.innerHTML, "<math:math>&lt;foo&gt;</math:math>");
t.innerHTML = null;
t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math"));
is(t.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML");
t.firstChild.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "script"));
is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML");
t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
is(t.innerHTML, '<math><script>1&amp;2&lt;3&gt;4&nbsp;\u003C/script></math>');
t.innerHTML = null;
t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math"));
is(t.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML");
t.firstChild.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "style"));
is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML");
t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
is(t.innerHTML, '<math><style>1&amp;2&lt;3&gt;4&nbsp;\u003C/style></math>');
SimpleTest.finish();
}
SpecialPowers.pushPrefEnv({"set": [["mathml.disabled", true]]}, function() {
document.querySelector('iframe').src = "file_disabled_iframe.html";
});
</script>
</pre>
</body>

View file

@ -0,0 +1,52 @@
<!doctype html>
<script>
window.is = window.parent.is;
window.SimpleTest = window.parent.SimpleTest;
</script>
<div id="testnodes"><span>hi</span> there <!-- mon ami --></div>
<script>
let t = document.getElementById('testnodes');
t.innerHTML = null;
t.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg:svg"));
t.firstChild.textContent = "<foo>";
is(t.innerHTML, "<svg:svg>&lt;foo&gt;</svg:svg>");
// This test crashes if the style tags are not handled correctly
t.innerHTML = `<svg version="1.1">
<style>
circle {
fill: currentColor;
}
</style>
<g><circle cx="25.8" cy="9.3" r="1.5"/></g>
</svg>
`;
is(t.firstChild.tagName.toLowerCase(), 'svg');
// This test crashes if the script tags are not handled correctly
t.innerHTML = `<svg version="1.1">
<scri` + `pt>
throw "badment, should never fire.";
</scri` + `pt>
<g><circle cx="25.8" cy="9.3" r="1.5"/></g>
</svg>`;
is(t.firstChild.tagName.toLowerCase(), 'svg');
t.innerHTML = null;
t.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg"));
is(t.firstChild.namespaceURI, "http://www.w3.org/2000/svg");
t.firstChild.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "script"));
is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/2000/svg");
t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
is(t.innerHTML, '<svg><script>1&amp;2&lt;3&gt;4&nbsp;\u003C/script></svg>');
t.innerHTML = null;
t.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg"));
is(t.firstChild.namespaceURI, "http://www.w3.org/2000/svg");
t.firstChild.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "style"));
is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/2000/svg");
t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
is(t.innerHTML, '<svg><style>1&amp;2&lt;3&gt;4&nbsp;\u003C/style></svg>');
SimpleTest.finish();
</script>

View file

@ -1,3 +1,5 @@
[DEFAULT]
support-files =
file_disabled_iframe.html
[test_disabled.html]

View file

@ -1,68 +1,14 @@
<!DOCTYPE HTML>
<html>
<!--
Copied from
https://bugzilla.mozilla.org/show_bug.cgi?id=744830
Copied from https://bugzilla.mozilla.org/show_bug.cgi?id=744830
-->
<head>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=166235">Mozilla Bug 166235</a>
<div id="testnodes"><span>hi</span> there <!-- mon ami --></div>
<pre id="test">
<iframe></iframe>
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["svg.disabled", true]]}, doTest);
function doTest() {
let t = document.getElementById('testnodes');
t.innerHTML = null;
t.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg:svg"));
t.firstChild.textContent = "<foo>";
is(t.innerHTML, "<svg:svg>&lt;foo&gt;</svg:svg>");
// This test crashes if the style tags are not handled correctly
t.innerHTML = `<svg version="1.1">
<style>
circle {
fill: currentColor;
}
</style>
<g><circle cx="25.8" cy="9.3" r="1.5"/></g>
</svg>
`;
is(t.firstChild.tagName.toLowerCase(), 'svg');
// This test crashes if the script tags are not handled correctly
t.innerHTML = `<svg version="1.1">
<scri` + `pt>
throw "badment, should never fire.";
</scri` + `pt>
<g><circle cx="25.8" cy="9.3" r="1.5"/></g>
</svg>`;
is(t.firstChild.tagName.toLowerCase(), 'svg');
t.innerHTML = null;
t.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg"));
is(t.firstChild.namespaceURI, "http://www.w3.org/2000/svg");
t.firstChild.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "script"));
is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/2000/svg");
t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
is(t.innerHTML, '<svg><script>1&amp;2&lt;3&gt;4&nbsp;\u003C/script></svg>');
t.innerHTML = null;
t.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg"));
is(t.firstChild.namespaceURI, "http://www.w3.org/2000/svg");
t.firstChild.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "style"));
is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/2000/svg");
t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
is(t.innerHTML, '<svg><style>1&amp;2&lt;3&gt;4&nbsp;\u003C/style></svg>');
SimpleTest.finish();
}
SpecialPowers.pushPrefEnv({"set": [["svg.disabled", true]]}, function() {
document.querySelector('iframe').src = "file_disabled_iframe.html";
});
</script>
</pre>
</body>
</html>