Bug 779754. Fix intermittent test_destinationURI_annotation.xul by cleaning up possible leftover files before starting the test. r=mconley

This commit is contained in:
Felipe Gomes 2013-01-15 14:11:39 -02:00
parent 04d4c426d1
commit 46f72e2365

View File

@ -119,6 +119,15 @@ function init() {
// of the panel in the browser's window.
Services.prefs.setBoolPref("browser.download.useToolkitUI", true);
// Check if the file we're trying to download already exists in the destination
// folder, and if so, remove it first to ensure that the test works properly.
let fileToDownload = dm.userDownloadsDirectory.clone();
fileToDownload.append(FILE_NAME);
if (fileToDownload.exists()) {
fileToDownload.remove(false);
info("File to download had to be removed as it already existed.");
}
ww.registerNotification(windowObserver);
PlacesUtils.annotations.addObserver(annoObserver, false);
dm.addListener(downloadListener);