Bug 573798 - urlbar loses focus when touched a second time [r=mfinkle]
authorMatt Brubeck <mbrubeck@mozilla.com>
Tue, 22 Jun 2010 16:20:56 -0400
changeset 66308 c53748d253a4b4cf26017e14a81209b9944d4773
parent 66307 d7f75adbb26dd5ad06e77cac9b405bf7ea131a63
child 66309 d7c90dcdb16b22f09e2f9c494e66f749d678a896
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)
reviewersmfinkle
bugs573798
Bug 573798 - urlbar loses focus when touched a second time [r=mfinkle]
mobile/chrome/content/browser-ui.js
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/chrome/content/browser-ui.js
@@ -637,16 +637,18 @@ var BrowserUI = {
     Elements.panelUI.hidden = false;
     Elements.contentShowing.setAttribute("disabled", "true");
 
     if (aPage != undefined)
       this.switchPane(aPage);
   },
 
   hidePanel: function hidePanel() {
+    if (!this.isPanelVisible())
+      return;
     Elements.panelUI.hidden = true;
     Elements.contentShowing.removeAttribute("disabled");
     this.blurFocusedElement();
   },
 
   isPanelVisible: function isPanelVisible() {
     return (!Elements.panelUI.hidden && Elements.panelUI.left == 0);
   },
@@ -1136,19 +1138,19 @@ var PageActions = {
     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(browser.contentTitle, browser.documentURI, null, null);
-    fileName = fileName.replace(/^\s+|\s+$/g, "");  // remove leading and trailing whitespace
+    fileName = fileName.trim();
 #ifdef MOZ_PLATFORM_MAEMO
-    fileName = fileName.replace(/[\*\:\?]+/g, " "); // remove illegal filename characters for Maemo
+    fileName = fileName.replace(/[\*\:\?]+/g, " ");
 #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;