Bug 571672 - On switch-to-tab results, Alt+Enter should open the page in a new tab, and Ctrl+Enter should switch to tab as expected. r=gavin
authorDrew Willcoxon <adw@mozilla.com>
Thu, 15 Jul 2010 22:05:47 -0700
changeset 47786 574de87782f9eb577678823058c1b208a68113cb
parent 47785 7124132f0506cc07d48376235f65e2ef842a2c24
child 47787 6b22b96b2d6f6a6116f48bf4a7767bba4e3f17c5
push id14419
push userdwillcoxon@mozilla.com
push dateFri, 16 Jul 2010 05:07:23 +0000
treeherderautoland@6b22b96b2d6f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin
bugs571672
milestone2.0b2pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 571672 - On switch-to-tab results, Alt+Enter should open the page in a new tab, and Ctrl+Enter should switch to tab as expected. r=gavin
browser/base/content/urlbarBindings.xml
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -135,25 +135,32 @@
       </method>
 
       <method name="handleCommand">
         <parameter name="aTriggeringEvent"/>
         <body><![CDATA[
           if (aTriggeringEvent instanceof MouseEvent && aTriggeringEvent.button == 2)
             return; // Do nothing for right clicks
 
-          var [url, postData] = this._canonizeURL(aTriggeringEvent);
-          if (!url)
-            return;
+          var url = this.value;
+          var postData = null;
 
           var action = this._parseActionUrl(url);
           if (action) {
-            if (action.type == "switchtab")
-              switchToTabHavingURI(action.param);
-            return;
+            url = action.param;
+            if (!(aTriggeringEvent && aTriggeringEvent.altKey)) {
+              if (action.type == "switchtab")
+                switchToTabHavingURI(url);
+              return;
+            }
+          }
+          else {
+            [url, postData] = this._canonizeURL(aTriggeringEvent);
+            if (!url)
+              return;
           }
 
           this.value = url;
           gBrowser.userTypedValue = url;
           try {
             addToUrlbarHistory(url);
           } catch (ex) {
             // Things may go wrong when adding url to session history,