summaryrefslogtreecommitdiffstats
path: root/dom/url/tests/browser_download_after_revoke.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/url/tests/browser_download_after_revoke.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/url/tests/browser_download_after_revoke.js')
-rw-r--r--dom/url/tests/browser_download_after_revoke.js53
1 files changed, 53 insertions, 0 deletions
diff --git a/dom/url/tests/browser_download_after_revoke.js b/dom/url/tests/browser_download_after_revoke.js
new file mode 100644
index 000000000..3e521eafe
--- /dev/null
+++ b/dom/url/tests/browser_download_after_revoke.js
@@ -0,0 +1,53 @@
+function test () {
+ waitForExplicitFinish();
+ gBrowser.selectedTab = gBrowser.addTab();
+
+ function onLoad() {
+ info("Page loaded.");
+ gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
+
+ var listener = {
+ onOpenWindow: function(aXULWindow) {
+ info("Download window shown...");
+ Services.wm.removeListener(listener);
+
+ function downloadOnLoad() {
+ domwindow.removeEventListener("load", downloadOnLoad, true);
+
+ is(domwindow.document.location.href, "chrome://mozapps/content/downloads/unknownContentType.xul", "Download page appeared");
+
+ domwindow.close();
+ gBrowser.removeTab(gBrowser.selectedTab);
+ finish();
+ }
+
+ var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindow);
+ domwindow.addEventListener("load", downloadOnLoad, true);
+ },
+ onCloseWindow: function(aXULWindow) {},
+ onWindowTitleChange: function(aXULWindow, aNewTitle) {}
+ }
+
+ Services.wm.addListener(listener);
+
+ info("Creating BlobURL and clicking on a HTMLAnchorElement...");
+ ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
+ let blob = new content.Blob(['test'], { type: 'text/plain' });
+ let url = content.URL.createObjectURL(blob);
+
+ let link = content.document.createElement('a');
+ link.href = url;
+ link.download = 'example.txt';
+ content.document.body.appendChild(link);
+ link.click();
+
+ content.URL.revokeObjectURL(url);
+ });
+ }
+
+ gBrowser.selectedBrowser.addEventListener("load", onLoad, true);
+
+ info("Loading download page...");
+ content.location = "http://example.com/browser/dom/url/tests/empty.html";
+}