Source code

Revision control

Other Tools

Test Info: Warnings

  • This test gets skipped with pattern: !is_fennec
  • This test was skipped 314 times in the preceding 7 days.
<meta charset="utf-8">
<title>Downloads Test</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
<script type="text/javascript" src="head.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript">
"use strict";
// saveAs is not implemented on Fennec but this tests that a call to download() that supplies that option passes anyway.
add_task(async function testDownload() {
const extension = ExtensionTestUtils.loadExtension({
manifest: {permissions: ["downloads"]},
background: async function() {
const url = URL.createObjectURL(new Blob(["file content"]));
const id = await{
saveAs: true,
browser.downloads.onChanged.addListener(delta => {
if ( == id && delta.state.current === "complete") {
await extension.startup();
await extension.awaitFinish("downloadPass");
await extension.unload();