Bug 521305. (Av1a) Add a missing nsIWebBrowserPersist object to browser_sanitizer.js, Update related tests. r=jh.
authorSerge Gautherie <sgautherie.bz@free.fr>
Thu, 09 Feb 2012 23:12:38 +0100
changeset 9347 5e653213d94d8ab9acc821bfc49017221f1ef2c7
parent 9346 cd5d8513146616e1813c5843a7f14b91390a0a88
child 9348 c502cef2f52fe0f968a49627d99a2d9f5b47c503
push id7160
push usersgautherie.bz@free.fr
push dateThu, 09 Feb 2012 22:13:06 +0000
treeherdercomm-central@5e653213d94d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjh
bugs521305
Bug 521305. (Av1a) Add a missing nsIWebBrowserPersist object to browser_sanitizer.js, Update related tests. r=jh.
suite/common/downloads/tests/chrome/test_action_keys_respect_focus.xul
suite/common/downloads/tests/chrome/test_delete_key_cancels.xul
suite/common/downloads/tests/chrome/test_enter_dblclick_opens.xul
suite/common/downloads/tests/chrome/test_space_key_pauses_resumes.xul
suite/common/downloads/tests/chrome/test_space_key_retries.xul
suite/modules/test/browser_sanitizer.js
--- a/suite/common/downloads/tests/chrome/test_action_keys_respect_focus.xul
+++ b/suite/common/downloads/tests/chrome/test_action_keys_respect_focus.xul
@@ -180,24 +180,25 @@ function test()
       var ios = Components.classes["@mozilla.org/network/io-service;1"]
                           .getService(Components.interfaces.nsIIOService);
       return (aObj instanceof Components.interfaces.nsIFile) ? ios.newFileURI(aObj) :
                                             ios.newURI(aObj, null, null);
     }
 
     const nsIWBP = Components.interfaces.nsIWebBrowserPersist;
     var persist = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
-                            .createInstance(Components.interfaces.nsIWebBrowserPersist);
+                            .createInstance(nsIWBP);
     persist.persistFlags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES |
                            nsIWBP.PERSIST_FLAGS_BYPASS_CACHE |
                            nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
 
     var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
                            .getService(Components.interfaces.nsIProperties);
     var destFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
+    // The "paused" part of this filename will be searched for later.
     destFile.append("download.paused");
     if (destFile.exists())
       destFile.remove(false);
 
     var dl = dm.addDownload(Components.interfaces.nsIDownloadManager.DOWNLOAD_TYPE_DOWNLOAD,
                             createURI("http://example.com/httpd.js"),
                             createURI(destFile), null, null,
                             Math.round(Date.now() * 1000), null, persist);
--- a/suite/common/downloads/tests/chrome/test_delete_key_cancels.xul
+++ b/suite/common/downloads/tests/chrome/test_delete_key_cancels.xul
@@ -127,17 +127,17 @@ function test()
       var ios = Components.classes["@mozilla.org/network/io-service;1"]
                           .getService(Components.interfaces.nsIIOService);
       return (aObj instanceof Components.interfaces.nsIFile) ? ios.newFileURI(aObj) :
                                             ios.newURI(aObj, null, null);
     }
 
     const nsIWBP = Components.interfaces.nsIWebBrowserPersist;
     var persist = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
-                            .createInstance(Components.interfaces.nsIWebBrowserPersist);
+                            .createInstance(nsIWBP);
     persist.persistFlags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES |
                            nsIWBP.PERSIST_FLAGS_BYPASS_CACHE |
                            nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
 
     var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
                            .getService(Components.interfaces.nsIProperties);
     var destFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
     destFile.append("download.result");
--- a/suite/common/downloads/tests/chrome/test_enter_dblclick_opens.xul
+++ b/suite/common/downloads/tests/chrome/test_enter_dblclick_opens.xul
@@ -149,17 +149,17 @@ function test()
       var ios = Components.classes["@mozilla.org/network/io-service;1"]
                           .getService(Components.interfaces.nsIIOService);
       return (aObj instanceof Components.interfaces.nsIFile) ? ios.newFileURI(aObj) :
                                             ios.newURI(aObj, null, null);
     }
 
     const nsIWBP = Components.interfaces.nsIWebBrowserPersist;
     var persist = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
-                            .createInstance(Components.interfaces.nsIWebBrowserPersist);
+                            .createInstance(nsIWBP);
     persist.persistFlags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES |
                            nsIWBP.PERSIST_FLAGS_BYPASS_CACHE |
                            nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
 
     var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
                            .getService(Components.interfaces.nsIProperties);
     var destFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
     destFile.append("download.result");
--- a/suite/common/downloads/tests/chrome/test_space_key_pauses_resumes.xul
+++ b/suite/common/downloads/tests/chrome/test_space_key_pauses_resumes.xul
@@ -147,28 +147,29 @@ function test()
       var ios = Components.classes["@mozilla.org/network/io-service;1"]
                           .getService(Components.interfaces.nsIIOService);
       return (aObj instanceof Components.interfaces.nsIFile) ? ios.newFileURI(aObj) :
                                             ios.newURI(aObj, null, null);
     }
 
     const nsIWBP = Components.interfaces.nsIWebBrowserPersist;
     var persist = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
-                            .createInstance(Components.interfaces.nsIWebBrowserPersist);
+                            .createInstance(nsIWBP);
     persist.persistFlags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES |
                            nsIWBP.PERSIST_FLAGS_BYPASS_CACHE |
                            nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
 
     var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
                            .getService(Components.interfaces.nsIProperties);
     var destFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
     destFile.append("download.result");
     if (destFile.exists())
       destFile.remove(false);
 
+    // SeaMonkey: Use a bigger file than "http://example.com/httpd.js". (Bug 595685)
     var dl = dm.addDownload(Components.interfaces.nsIDownloadManager.DOWNLOAD_TYPE_DOWNLOAD,
                             createURI("http://example.com/tests/fonts/mplus/mplus-1p-regular.ttf"),
                             createURI(destFile), null, null,
                             Math.round(Date.now() * 1000), null, persist);
 
     persist.progressListener = dl.QueryInterface(Components.interfaces.nsIWebProgressListener);
     persist.saveURI(dl.source, null, null, null, null, dl.targetFile);
 
--- a/suite/common/downloads/tests/chrome/test_space_key_retries.xul
+++ b/suite/common/downloads/tests/chrome/test_space_key_retries.xul
@@ -125,17 +125,17 @@ function test()
       var ios = Components.classes["@mozilla.org/network/io-service;1"]
                           .getService(Components.interfaces.nsIIOService);
       return (aObj instanceof Components.interfaces.nsIFile) ? ios.newFileURI(aObj) :
                                             ios.newURI(aObj, null, null);
     }
 
     const nsIWBP = Components.interfaces.nsIWebBrowserPersist;
     var persist = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
-                            .createInstance(Components.interfaces.nsIWebBrowserPersist);
+                            .createInstance(nsIWBP);
     persist.persistFlags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES |
                            nsIWBP.PERSIST_FLAGS_BYPASS_CACHE |
                            nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
 
     var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
                            .getService(Components.interfaces.nsIProperties);
     var destFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
     destFile.append("download.result");
--- a/suite/modules/test/browser_sanitizer.js
+++ b/suite/modules/test/browser_sanitizer.js
@@ -217,19 +217,28 @@ var sanTests = {
       var file = Components.classes["@mozilla.org/file/directory_service;1"]
                            .getService(Components.interfaces.nsIProperties)
                            .get("TmpD", Components.interfaces.nsIFile);
       file.append("sanitizer.file");
       file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
       var dest = ios.newFileURI(file);
 
       this.dm = Components.classes["@mozilla.org/download-manager;1"]
-                          .createInstance(Components.interfaces.nsIDownloadManager);
+                          .getService(Components.interfaces.nsIDownloadManager);
+
+      const nsIWBP = Components.interfaces.nsIWebBrowserPersist;
+      var persist = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
+                              .createInstance(nsIWBP);
+      persist.persistFlags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES |
+                             nsIWBP.PERSIST_FLAGS_BYPASS_CACHE |
+                             nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
+
       this.dl = this.dm.addDownload(Components.interfaces.nsIDownloadManager.DOWNLOAD_CANCELED, uri,
-                                    dest, "Sanitizer!", null, Math.round(Date.now() * 1000), null, {});
+                                    dest, "Sanitizer!", null, Math.round(Date.now() * 1000), null, persist);
+
       // Stupid DM...
       this.dm.cancelDownload(this.dl.id);
       return this.check();
     },
 
     check: function() {
       var dl = null;
       try {