From 58a53db2e7aca131ae1986588cdf989fc158e6d6 Mon Sep 17 00:00:00 2001 From: Felipe Gomes Date: Tue, 15 Jan 2013 14:11:39 -0200 Subject: [PATCH] Bug 779754. Fix intermittent test_destinationURI_annotation.xul by cleaning up possible leftover files before starting the test. r=mconley --- .../tests/chrome/test_destinationURI_annotation.xul | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/toolkit/mozapps/downloads/tests/chrome/test_destinationURI_annotation.xul b/toolkit/mozapps/downloads/tests/chrome/test_destinationURI_annotation.xul index e16355629e67..2ea90ed9f4c1 100644 --- a/toolkit/mozapps/downloads/tests/chrome/test_destinationURI_annotation.xul +++ b/toolkit/mozapps/downloads/tests/chrome/test_destinationURI_annotation.xul @@ -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);