summaryrefslogtreecommitdiffstats
path: root/dom/base/test/test_bug895239.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/base/test/test_bug895239.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/base/test/test_bug895239.html')
-rw-r--r--dom/base/test/test_bug895239.html123
1 files changed, 123 insertions, 0 deletions
diff --git a/dom/base/test/test_bug895239.html b/dom/base/test/test_bug895239.html
new file mode 100644
index 000000000..32c0717e5
--- /dev/null
+++ b/dom/base/test/test_bug895239.html
@@ -0,0 +1,123 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=895239
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 895239</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+ function testPaintextSerializerWithPlaceHolder() {
+
+ const de = SpecialPowers.Ci.nsIDocumentEncoder;
+ const Cc = SpecialPowers.Cc;
+
+ // Create a plaintext encoder with the flag OutputNonTextContentAsPlaceholder.
+ var encoder = Cc["@mozilla.org/layout/documentEncoder;1?type=text/plain"]
+ .createInstance(de);
+ var flags = de.OutputRaw |
+ de.OutputNonTextContentAsPlaceholder;
+ encoder.init(document, "text/plain", flags);
+
+ function toPlaintext(id) {
+ var element = document.getElementById(id);
+ var range = document.createRange();
+ range.selectNodeContents(element);
+ encoder.setRange(range);
+ return encoder.encodeToString();
+ }
+
+ // Test cases to serialize all nodes including invisible nodes.
+ is(toPlaintext("case1"), "This is an audio \uFFFC! ", "test with <audio>");
+ is(toPlaintext("case2"), "This is a canvas \uFFFC! ", "test with <canvas>");
+ is(toPlaintext("case3"), "This is an iframe \uFFFC! ", "test with one <iframe>");
+ is(toPlaintext("case4"), "One iframe \uFFFC with another iframe \uFFFC. ", "test with two <iframes>");
+ is(toPlaintext("case5"), "This is a meter \uFFFC! ", "test with <meter>");
+ is(toPlaintext("case6"), "This is a progress \uFFFC! ", "test with <progress>");
+ is(toPlaintext("case7"), "This is an object \uFFFC! ", "test with <object>");
+ is(toPlaintext("case8"), "This is a svg \uFFFC! ", "test with <svg>");
+ is(toPlaintext("case9"), "This is a video \uFFFC! ", "test with <video>");
+ is(toPlaintext("case10"), "This is a video \uFFFC! ", "test with nested tags");
+
+ // Test cases to serialize visible nodes only.
+ encoder.init(document, "text/plain", flags | de.SkipInvisibleContent);
+ is(toPlaintext("case1"), "This is an audio \uFFFC! ", "test with <audio> for visible nodes");
+ is(toPlaintext("case2"), "This is a canvas \uFFFC! ", "test with <canvas> for visible nodes");
+ is(toPlaintext("case3"), "This is an iframe \uFFFC! ", "test with one <iframe> for visible nodes");
+ is(toPlaintext("case4"), "One iframe \uFFFC with another iframe . ", "test with two <iframes> for visible nodes");
+ is(toPlaintext("case5"), "This is a meter \uFFFC! ", "test with <meter> for visible nodes");
+ is(toPlaintext("case6"), "This is a progress \uFFFC! ", "test with <progress> for visible nodes");
+ is(toPlaintext("case7"), "This is an object \uFFFC! ", "test with <object> for visible nodes");
+ is(toPlaintext("case8"), "This is a svg \uFFFC! ", "test with <svg> for visible nodes");
+ is(toPlaintext("case9"), "This is a video \uFFFC! ", "test with <video> for visible nodes");
+ is(toPlaintext("case10"), "This is a video \uFFFC! ", "test with nested tags for visible nodes");
+ SimpleTest.finish();
+ }
+
+ addLoadEvent(testPaintextSerializerWithPlaceHolder);
+ SimpleTest.waitForExplicitFinish();
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=895239">Mozilla Bug 895239</a>
+<p id="display"></p>
+<div id="content">
+ <span id="case1">This is an audio
+ <audio controls="controls">
+ Your browser does not support <code>audio</code> element.
+ </audio>!
+ </span>
+ <span id="case2">This is a canvas
+ <canvas height="100" width="100">
+ Your browser does not support canvas element.
+ </canvas>!
+ </span>
+ <span id="case3">This is an iframe
+ <iframe src="about:blank">
+ Your browser does not support iframes.
+ </iframe>!
+ </span>
+ <span id="case4">One iframe
+ <iframe src="about:blank">
+ Your browser does not support iframes.
+ </iframe> with another iframe
+ <iframe src="about:blank" style="display: none"></iframe>.
+ </span>
+ <span id="case5">This is a meter
+ <meter min="0" max="100" value="50">
+ 50%
+ </meter>!
+ </span>
+ <span id="case6">This is a progress
+ <progress max="100" value="70">
+ 70%
+ </progress>!
+ </span>
+ <span id="case7">This is an object
+ <object type="application/x-shockware-flash">
+ <a href="#">Download the plugin.</a>
+ </object>!
+ </span>
+ <span id="case8">This is a svg
+ <svg height="100" width="100">
+ Your browser does not support svg.
+ <circle cx="100" cy="100" r="80" fill="green"></circle>
+ </svg>!
+ </span>
+ <span id="case9">This is a video
+ <video>
+ Your browser does not support videos.
+ </video>!
+ </span>
+ <span id="case10">This is a video
+ <video>
+ Your browser does not support videos.<iframe src="about:blank"></iframe>
+ </video>!
+ </span>
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>