зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset ee03992cef6e (bug 1519762) for test_ext_downloads_search.js failures CLOSED TREE
This commit is contained in:
Родитель
d1493d05da
Коммит
49bf435109
|
@ -266,8 +266,8 @@ const downloadQuery = query => {
|
|||
// const endedBefore = normalizeDownloadTime(query.endedBefore, true);
|
||||
// const endedAfter = normalizeDownloadTime(query.endedAfter, false);
|
||||
|
||||
const totalBytesGreater = query.totalBytesGreater !== null ? query.totalBytesGreater : -1;
|
||||
const totalBytesLess = query.totalBytesLess !== null ? query.totalBytesLess : Number.MAX_VALUE;
|
||||
const totalBytesGreater = query.totalBytesGreater;
|
||||
const totalBytesLess = query.totalBytesLess != null ? query.totalBytesLess : Number.MAX_VALUE;
|
||||
|
||||
// Handle options for which we can have a regular expression and/or
|
||||
// an explicit value to match.
|
||||
|
@ -323,7 +323,7 @@ const downloadQuery = query => {
|
|||
// todo endedBefore, endedAfter
|
||||
|
||||
if (item.totalBytes == -1) {
|
||||
if (query.totalBytesGreater !== null || query.totalBytesLess !== null) {
|
||||
if (query.totalBytesGreater != null || query.totalBytesLess != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (item.totalBytes <= totalBytesGreater || item.totalBytes >= totalBytesLess) {
|
||||
|
|
|
@ -257,7 +257,8 @@
|
|||
"totalBytesGreater": {
|
||||
"description": "Limits results to downloads whose totalBytes is greater than the given integer.",
|
||||
"optional": true,
|
||||
"type": "number"
|
||||
"type": "number",
|
||||
"default": -1
|
||||
},
|
||||
"totalBytesLess": {
|
||||
"description": "Limits results to downloads whose totalBytes is less than the given integer.",
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
"use strict";
|
||||
|
||||
PromiseTestUtils.whitelistRejectionsGlobally(/Message manager disconnected/);
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/Downloads.jsm");
|
||||
|
||||
const server = createHttpServer();
|
||||
|
@ -426,49 +424,3 @@ add_task(async function test_search() {
|
|||
|
||||
await extension.unload();
|
||||
});
|
||||
|
||||
// Test that downloads with totalBytes of -1 (ie, that have not yet started)
|
||||
// work properly. See bug 1519762 for details of a past regression in
|
||||
// this area.
|
||||
add_task(async function test_inprogress() {
|
||||
let resume, resumePromise = new Promise(resolve => { resume = resolve; });
|
||||
server.registerPathHandler("/slow", async (request, response) => {
|
||||
response.processAsync();
|
||||
await resumePromise;
|
||||
response.setHeader("Content-type", "text/plain");
|
||||
response.write("");
|
||||
response.finish();
|
||||
});
|
||||
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
permissions: ["downloads"],
|
||||
},
|
||||
background() {
|
||||
browser.test.onMessage.addListener(async (msg, url) => {
|
||||
let id = await browser.downloads.download({url});
|
||||
let full = await browser.downloads.search({id});
|
||||
|
||||
browser.test.assertEq(full.length, 1,
|
||||
"Found new download in search results");
|
||||
browser.test.assertEq(full[0].totalBytes, -1,
|
||||
"New download still has totalBytes == -1");
|
||||
|
||||
browser.downloads.onChanged.addListener(info => {
|
||||
if (info.id == id && info.state.current == "complete") {
|
||||
browser.test.notifyPass("done");
|
||||
}
|
||||
});
|
||||
|
||||
browser.test.sendMessage("started");
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
await extension.startup();
|
||||
extension.sendMessage("go", `${BASE}/slow`);
|
||||
await extension.awaitMessage("started");
|
||||
resume();
|
||||
await extension.awaitFinish("done");
|
||||
await extension.unload();
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче