Comment 71 for bug 572074

Revision history for this message
In , Dao+bmo (dao+bmo) wrote :

Comment on attachment 8642998
middlemouse on new tab button creates a new tab related to current

>+ // Make new tab related to current except for key commands
>+ if (((where == "tab") || (where == "tabshifted")) &&
>+ (!event.sourceEvent || event.sourceEvent.target.localName != "key")) {
>+ openUILinkIn(BROWSER_NEW_TAB_URL, "tab", {relatedToCurrent: true,
>+ inBackground: where == "tabshifted"});
>+ } else if (where == "window") {
> OpenBrowserWindow();
> } else {
> BrowserOpenTab();
> }
> }

Could this be simplified by also calling openUILinkIn in the default case instead of BrowserOpenTab? E.g.:

> if (where == "window") {
> OpenBrowserWindow();
> } else {
> let relatedToCurrent = (where == "tab" || where == "tabshifted") &&
> (!event.sourceEvent || event.sourceEvent.target.localName != "key");
> let inBackground = relatedToCurrent && where == "tabshifted";
> openUILinkIn(BROWSER_NEW_TAB_URL, "tab", {relatedToCurrent: relatedToCurrent,
> inBackground: inBackground});
> }

I'm also not sure I understand the "except for key commands" logic. Is there no way to explicitly filter for mouse events here?