summaryrefslogtreecommitdiffstats
path: root/dom/plugins/test/mochitest/pluginstream.js
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/plugins/test/mochitest/pluginstream.js
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/plugins/test/mochitest/pluginstream.js')
-rw-r--r--dom/plugins/test/mochitest/pluginstream.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/dom/plugins/test/mochitest/pluginstream.js b/dom/plugins/test/mochitest/pluginstream.js
new file mode 100644
index 000000000..9c47cd5f8
--- /dev/null
+++ b/dom/plugins/test/mochitest/pluginstream.js
@@ -0,0 +1,39 @@
+ SimpleTest.waitForExplicitFinish();
+
+ function frameLoaded(finishWhenCalled = true, lastObject = false) {
+ var testframe = document.getElementById('testframe');
+ function getNode(list) {
+ if (list.length === 0)
+ return undefined;
+ return lastObject ? list[list.length - 1] : list[0];
+ }
+ var embed = getNode(document.getElementsByTagName('embed'));
+ if (undefined === embed)
+ embed = getNode(document.getElementsByTagName('object'));
+
+ // In the file:// URI case, this ends up being cross-origin.
+ // Skip these checks in that case.
+ if (testframe.contentDocument) {
+ var content = testframe.contentDocument.body.innerHTML;
+ if (!content.length)
+ return;
+
+ var filename = embed.getAttribute("src") ||
+ embed.getAttribute("geturl") ||
+ embed.getAttribute("geturlnotify") ||
+ embed.getAttribute("data");
+
+ var req = new XMLHttpRequest();
+ req.open('GET', filename, false);
+ req.overrideMimeType('text/plain; charset=x-user-defined');
+ req.send(null);
+ is(req.status, 200, "bad XMLHttpRequest status");
+ is(content, req.responseText.replace(/\r\n/g, "\n"),
+ "content doesn't match");
+ }
+
+ is(embed.getError(), "pass", "plugin reported error");
+ if (finishWhenCalled) {
+ SimpleTest.finish();
+ }
+ }