Bug 1274533 - change legacy behaviour in observer rather than overwriting key status in data, r?jaws draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Fri, 20 May 2016 11:51:20 +0100
changeset 369130 8f95c3b38aab855826f5e6b4e8e8d14049549369
parent 368861 de1b9de4a3d0d77f05dd09dc767391c84a2c3a63
child 521473 d89c74563b32f72947c764c5415d13760f9c0f64
push id18751
push usergijskruitbosch@gmail.com
push dateFri, 20 May 2016 11:42:39 +0000
reviewersjaws
bugs1274533
milestone49.0a1
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,19 @@ 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);
+            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