Bug 513180 Comment 25 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

I'm sorry for the big delay. Let's just make this as simple as possible, without breaking tests and possibly unintentionally people's habits, and do this:

if (aEvent && aEvent.originalTarget.classList.contains("search-go-button")) {
  if (aEvent.button == 2)
    return;
  // this `if` branch is copied from below
  let newTabPref = Services.prefs.getBoolPref("browser.search.openintab");
  if (((aEvent instanceof KeyboardEvent && aEvent.altKey) ^ newTabPref) &&
    !gBrowser.selectedTab.isEmpty) {
    where = "tab";
  // this `else` branch is new
  } else {
    // move the `where` assignment down here
    where = whereToOpenLink(aEvent, false, true);
  }
// everything else below is the same as now
} else ...

I've tested this and it works, and I pushed it to tryserver to make sure it doesn't break our automated tests: https://treeherder.mozilla.org/#/jobs?repo=try&revision=0038bc4c86c25a108f8004d375c6bfc800a669ee

Please manually test your patch to make sure it works before you post it. You can use `mach build faster` to rebuild Firefox with your changes. The build docs linked above have more info. You should see the expected results in comment 0. Note though that if the current tab is "empty" (meaning, the home tab), it's expected that a new tab *won't* be opened.
I'm sorry for the big delay. Let's just make this as simple as possible, without breaking tests and possibly unintentionally people's habits, and do this:

```js
if (aEvent && aEvent.originalTarget.classList.contains("search-go-button")) {
  if (aEvent.button == 2)
    return;
  // this `if` branch is copied from below
  let newTabPref = Services.prefs.getBoolPref("browser.search.openintab");
  if (((aEvent instanceof KeyboardEvent && aEvent.altKey) ^ newTabPref) &&
    !gBrowser.selectedTab.isEmpty) {
    where = "tab";
  // this `else` branch is new
  } else {
    // move the `where` assignment down here
    where = whereToOpenLink(aEvent, false, true);
  }
// everything else below is the same as now
} else ...
```

I've tested this and it works, and I pushed it to tryserver to make sure it doesn't break our automated tests: https://treeherder.mozilla.org/#/jobs?repo=try&revision=0038bc4c86c25a108f8004d375c6bfc800a669ee

Please manually test your patch to make sure it works before you post it. You can use `mach build faster` to rebuild Firefox with your changes. The build docs linked above have more info. You should see the expected results in comment 0. Note though that if the current tab is "empty" (meaning, the home tab), it's expected that a new tab *won't* be opened.

Back to Bug 513180 Comment 25