Bug 573672 - Use getDefaultFileName in an e10s-safe way [r=vingtetun]
authorMark Finkle <mfinkle@mozilla.com>
Tue, 22 Jun 2010 09:15:15 -0400
changeset 66305 a154abe24d1c9c7a16538cdb259c045ef323be15
parent 66304 1054c77dfee85f277af735f9c7e547defe53856b
child 66306 5aa7b90dee04525396a1c48ec3ba151949153298
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvingtetun
bugs573672
Bug 573672 - Use getDefaultFileName in an e10s-safe way [r=vingtetun]
mobile/chrome/content/browser-ui.js
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/chrome/content/browser-ui.js
@@ -1135,19 +1135,20 @@ var PageActions = {
   _savePageAsPDF: function saveAsPDF() {
     let strings = Elements.browserBundle;
     let picker = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
     picker.init(window, strings.getString("pageactions.saveas.pdf"), Ci.nsIFilePicker.modeSave);
     picker.appendFilter("PDF", "*.pdf");
     picker.defaultExtension = "pdf";
 
     let browser = Browser.selectedBrowser;
-    let fileName = getDefaultFileName(null, browser.documentURI, browser.contentDocument, null);
+    let fileName = getDefaultFileName(browser.contentTitle, browser.documentURI, null, null);
+    fileName = fileName.replace(/^\s+|\s+$/g, "");  // remove leading and trailing whitespace
 #ifdef MOZ_PLATFORM_MAEMO
-    fileName = fileName.replace(/[\*\:\?]+/g, " ");
+    fileName = fileName.replace(/[\*\:\?]+/g, " "); // remove illegal filename characters for Maemo
 #endif
     picker.defaultString = fileName + ".pdf";
 
     let dm = Cc["@mozilla.org/download-manager;1"].getService(Ci.nsIDownloadManager);
     picker.displayDirectory = dm.defaultDownloadsDirectory;
     let rv = picker.show();
     if (rv == Ci.nsIFilePicker.returnCancel)
       return;