Bug 1273240 - Add logic for processing middle mouse clicks on text links. r=Ratty a=Ratty
Port
Bug 263433, 1268943 and 1274533.
--- a/suite/common/src/nsSuiteGlue.js
+++ b/suite/common/src/nsSuiteGlue.js
@@ -262,16 +262,33 @@ SuiteGlue.prototype = {
break;
case "timer-callback":
// Load the Login Manager data from disk off the main thread, some time
// after startup. If the data is required before the timeout, for example
// because a restored page contains a password field, it will be loaded on
// the main thread, and this initialization request will be ignored.
Services.logins;
break;
+ case "handle-xul-text-link":
+ let linkHandled = subject.QueryInterface(Components.interfaces.nsISupportsPRBool);
+ if (!linkHandled.data) {
+ let mostRecentBrowserWindow = Services.wm.getMostRecentWindow("navigator:browser");
+ if (mostRecentBrowserWindow) {
+ let dataObj = JSON.parse(data);
+ let where = mostRecentBrowserWindow.whereToOpenLink(dataObj, false, true, true);
+ // Preserve legacy behavior of non-modifier left-clicks
+ // opening in a new selected tab.
+ if (where == "current") {
+ where = "tabfocused";
+ }
+ mostRecentBrowserWindow.openUILinkIn(dataObj.href, where);
+ linkHandled.data = true;
+ }
+ }
+ break;
}
},
// nsIWebProgressListener partial implementation
onLocationChange: function(aWebProgress, aRequest, aLocation, aFlags)
{
if (aWebProgress.isTopLevel &&
aWebProgress instanceof Components.interfaces.nsIDocShell &&
@@ -322,16 +339,17 @@ SuiteGlue.prototype = {
Services.obs.addObserver(this, "session-save", true);
Services.obs.addObserver(this, "dl-done", true);
Services.obs.addObserver(this, "places-init-complete", true);
Services.obs.addObserver(this, "places-database-locked", true);
Services.obs.addObserver(this, "places-shutdown", true);
Services.obs.addObserver(this, "browser-search-engine-modified", true);
Services.obs.addObserver(this, "notifications-open-settings", true);
Services.prefs.addObserver("devtools.debugger.", this, true);
+ Services.obs.addObserver(this, "handle-xul-text-link", true);
Components.classes['@mozilla.org/docloaderservice;1']
.getService(Components.interfaces.nsIWebProgress)
.addProgressListener(this, Components.interfaces.nsIWebProgress.NOTIFY_LOCATION);
},
// profile is available
_onProfileAfterChange: function()
{