Bug 564285 - Remember password infobar is overlapped by the url bar, while loading [r=mfinkle]
authorVivien Nicolas <21@vingtetun.org>
Thu, 20 May 2010 15:11:10 -0400
changeset 66241 b410eb908c136874336e72c478b54daf4b689664
parent 66240 9e74a89f718ca99138a6b02145651332454c1247
child 66242 48fe829edfe7aa25e55fae9933167bf46e57499c
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
bugs564285
Bug 564285 - Remember password infobar is overlapped by the url bar, while loading [r=mfinkle]
mobile/chrome/content/browser-ui.js
mobile/chrome/content/browser.js
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/chrome/content/browser-ui.js
@@ -446,36 +446,44 @@ var BrowserUI = {
     }, true);
   },
 
   uninit : function() {
     ExtensionsView.uninit();
     ConsoleView.uninit();
   },
 
+  _shouldUnlockToolbar: false, // See bug 564285
   update : function(aState) {
     let icons = document.getElementById("urlbar-icons");
     let browser = Browser.selectedBrowser;
 
     switch (aState) {
       case TOOLBARSTATE_LOADED:
         if (icons.getAttribute("mode") != "edit")
           this._updateToolbar();
 
         this._updateIcon(browser.mIconURL);
-        this.unlockToolbar();
+        if (this._shouldUnlockToolbar) {
+          this._shouldUnlockToolbar = false;
+          this.unlockToolbar();
+        }
         break;
 
       case TOOLBARSTATE_LOADING:
         if (icons.getAttribute("mode") != "edit")
           this._updateToolbar();
 
         browser.mIconURL = "";
         this._updateIcon();
-        this.lockToolbar();
+
+        if (!Browser.hasNotificationsForTab(Browser.selectedTab)) {
+          this._shouldUnlockToolbar = true;
+          this.lockToolbar();
+        }
         break;
     }
   },
 
   _updateIcon : function(aIconSrc) {
     this._favicon.src = aIconSrc || "";
     if (Browser.selectedTab.isLoading()) {
       this._throbber.hidden = false;
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -877,16 +877,27 @@ var Browser = {
 
       if (notification.persistence)
         notification.persistence--;
       else if (Date.now() > notification.timeout)
         notificationBox.removeNotification(notification);
     }
   },
 
+  hasNotificationsForTab: function hasNotificationsForTab(aTab) {
+    let notifications = this.getNotificationBox().allNotifications;
+    for (let n = notifications.length - 1; n >= 0; n--) {
+      let notification = notifications[n];
+      if (notification._chromeTab == aTab.chromeTab)
+        return true;
+    }
+
+    return false;
+  },
+
   /** Returns true iff a tab's browser has been destroyed to free up memory. */
   sacrificeTab: function sacrificeTab() {
     let tabToClear = this._tabs.reduce(function(prevTab, currentTab) {
       if (currentTab == Browser.selectedTab || !currentTab.browser) {
         return prevTab;
       } else {
         return (prevTab && prevTab.lastSelected <= currentTab.lastSelected) ? prevTab : currentTab;
       }