Bug 1274533 - change legacy behaviour in observer rather than overwriting key status in data, r?jaws
MozReview-Commit-ID: UZWRYj2Mno
--- 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