Bug 655584 - Close popup when switching to tab that previously had urlbar focused. r=gavin
authorBrian R. Bondy <netzen@gmail.com>
Wed, 25 May 2011 10:44:28 +0200
changeset 70152 2667493a7c9152bb13a06a1b4e9a6a89aa182451
parent 70151 d0071580fb555a36e87095ed314a00caa19ec183
child 70153 ce19ede6e34e2f5b434adbb85dcfc71936bd80f4
push idunknown
push userunknown
push dateunknown
reviewersgavin
bugs655584
milestone7.0a1
first release with
nightly win64
2667493a7c91 / 7.0a1 / 20110525030221 / files
nightly linux32
nightly linux64
nightly mac
nightly win32
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly win64
Bug 655584 - Close popup when switching to tab that previously had urlbar focused. r=gavin
browser/base/content/tabbrowser.xml
browser/base/content/test/Makefile.in
browser/base/content/test/browser_bug655584.js
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -958,16 +958,20 @@
                   break;
                 }
 
                 // Focus the location bar if it was previously focused for that tab.
                 // In full screen mode, only bother making the location bar visible
                 // if the tab is a blank one.
                 oldBrowser._urlbarFocused = (gURLBar && gURLBar.focused);
                 if (newBrowser._urlbarFocused && gURLBar) {
+
+                  // Explicitly close the popup if the URL bar retains focus
+                  gURLBar.closePopup();
+
                   if (!window.fullScreen) {
                     gURLBar.focus();
                     break;
                   } else if (isTabEmpty(this.mCurrentTab)) {
                     focusAndSelectUrlBar();
                     break;
                   }
                 }
--- a/browser/base/content/test/Makefile.in
+++ b/browser/base/content/test/Makefile.in
@@ -166,16 +166,17 @@ endif
                  browser_bug597218.js \
                  browser_bug598923.js \
                  browser_bug599325.js \
                  browser_bug609700.js \
                  browser_bug616836.js \
                  browser_bug623893.js \
                  browser_bug624734.js \
                  browser_bug647886.js \
+                 browser_bug655584.js \
                  browser_findbarClose.js \
                  browser_contextSearchTabPosition.js \
                  browser_ctrlTab.js \
                  browser_customize_popupNotification.js \
                  browser_disablechrome.js \
                  browser_discovery.js \
                  browser_duplicateIDs.js \
                  browser_gestureSupport.js \
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/browser_bug655584.js
@@ -0,0 +1,23 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+// Bug 655584 - awesomebar suggestions don't update after tab is closed
+
+function test() {
+  var tab1 = gBrowser.addTab();
+  var tab2 = gBrowser.addTab();
+
+  // When urlbar in a new tab is focused, and a tab switch occurs,
+  // the urlbar popup should be closed
+  gBrowser.selectedTab = tab2;
+  gURLBar.focus(); // focus the urlbar in the tab we will switch to
+  gBrowser.selectedTab = tab1;
+  gURLBar.openPopup();
+  gBrowser.selectedTab = tab2;
+  ok(!gURLBar.popupOpen, "urlbar focused in tab to switch to, close popup");
+  
+  // cleanup
+  gBrowser.removeCurrentTab();
+  gBrowser.removeCurrentTab();
+}