Bug 1274533 - change legacy behaviour in observer rather than overwriting key status in data, r=jaws
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Fri, 20 May 2016 11:51:20 +0100
changeset 298545 c2a4ec679a400b9304a6977d1add5fc012a0e9f1
parent 298544 3f3ccec9b45d4a0dd7062f0fd9199b1ec337f7ff
child 298546 c2954f2b8ab739bae801e5a78b33f848426646cf
push id30281
push usercbook@mozilla.com
push dateTue, 24 May 2016 12:54:02 +0000
treeherdermozilla-central@829d3be6ba64 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1274533
milestone49.0a1
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 1274533 - change legacy behaviour in observer rather than overwriting key status in data, r=jaws MozReview-Commit-ID: UZWRYj2Mno
browser/components/nsBrowserGlue.js
toolkit/content/widgets/text.xml
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -375,16 +375,21 @@ BrowserGlue.prototype = {
         break;
       case "handle-xul-text-link":
         let linkHandled = subject.QueryInterface(Ci.nsISupportsPRBool);
         if (!linkHandled.data) {
           let win = RecentWindow.getMostRecentBrowserWindow();
           if (win) {
             data = JSON.parse(data);
             let where = win.whereToOpenLink(data);
+            // Preserve legacy behavior of non-modifier left-clicks
+            // opening in a new selected tab.
+            if (where == "current") {
+              where = "tab";
+            }
             win.openUILinkIn(data.href, where);
             linkHandled.data = true;
           }
         }
         break;
       case "profile-before-change":
          // Any component depending on Places should be finalized in
          // _onPlacesShutdown.  Any component that doesn't need to act after
--- a/toolkit/content/widgets/text.xml
+++ b/toolkit/content/widgets/text.xml
@@ -352,27 +352,16 @@
           href = uri ? uri.spec : href;
 
           // Try handing off the link to the host application, e.g. for
           // opening it in a tabbed browser.
           var linkHandled = Components.classes["@mozilla.org/supports-PRBool;1"]
                                       .createInstance(Components.interfaces.nsISupportsPRBool);
           linkHandled.data = false;
           let {shiftKey, ctrlKey, metaKey, altKey, button} = aEvent;
-          if (!shiftKey && !altKey) {
-            // Preserve legacy behavior of non-modifier left-clicks
-            // opening in a new selected tab.
-            let {AppConstants} =
-              Components.utils.import("resource://gre/modules/AppConstants.jsm", {});
-            if (AppConstants.platform == "macosx") {
-              metaKey = true;
-            } else {
-              ctrlKey = true;
-            }
-          }
           let data = {shiftKey, ctrlKey, metaKey, altKey, button, href};
           Components.classes["@mozilla.org/observer-service;1"]
                     .getService(Components.interfaces.nsIObserverService)
                     .notifyObservers(linkHandled, "handle-xul-text-link", JSON.stringify(data));
           if (linkHandled.data)
             return;
 
           // otherwise, fall back to opening the anchor directly