summaryrefslogtreecommitdiffstats
path: root/dom/downloads/tests/test_downloads_navigator_object.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/downloads/tests/test_downloads_navigator_object.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/downloads/tests/test_downloads_navigator_object.html')
-rw-r--r--dom/downloads/tests/test_downloads_navigator_object.html75
1 files changed, 75 insertions, 0 deletions
diff --git a/dom/downloads/tests/test_downloads_navigator_object.html b/dom/downloads/tests/test_downloads_navigator_object.html
new file mode 100644
index 000000000..1c38388b7
--- /dev/null
+++ b/dom/downloads/tests/test_downloads_navigator_object.html
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=938023
+-->
+<head>
+ <title>Test for Bug 938023 Downloads API</title>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=938023">Mozilla Bug 938023</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+<iframe></iframe>
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript;version=1.7">
+
+SimpleTest.waitForExplicitFinish();
+
+var index = -1;
+
+function next() {
+ index += 1;
+ if (index >= steps.length) {
+ ok(false, "Shouldn't get here!");
+ return;
+ }
+ try {
+ steps[index]();
+ } catch(ex) {
+ ok(false, "Caught exception", ex);
+ }
+}
+
+var steps = [
+ // Start by setting the pref to true.
+ function() {
+ SpecialPowers.pushPrefEnv({
+ set: [["dom.mozDownloads.enabled", true]]
+ }, next);
+ },
+
+ function() {
+ SpecialPowers.pushPermissions([
+ {type: "downloads", allow: 0, context: document}
+ ], function() {
+ is(frames[0].navigator.mozDownloadManager, null, "navigator.mozDownloadManager is null when the page doesn't have permissions");
+ next();
+ });
+ },
+
+ function() {
+ SpecialPowers.pushPrefEnv({
+ set: [["dom.mozDownloads.enabled", false]]
+ }, function() {
+ is(navigator.mozDownloadManager, undefined, "navigator.mozDownloadManager is undefined");
+ next();
+ });
+ },
+
+ function() {
+ SimpleTest.finish();
+ }
+];
+
+next();
+
+</script>
+</pre>
+</body>
+</html>