Bug 1661643 Comment 0 Edit History

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

https://searchfox.org/mozilla-central/rev/ce21a13035623c1d349980057d09000e70669802/browser/app/profile/firefox.js#465-467
```
// handle links targeting new windows
// 1=current window/tab, 2=new window, 3=new tab in most recent window
pref("browser.link.open_newwindow", 3);
```

The document for the `browser.link.open_newwindow` pref mentions about value 1, that opens a link to new window into current tab,

but is some case the value is just ignored:

https://searchfox.org/mozilla-central/rev/ce21a13035623c1d349980057d09000e70669802/browser/base/content/browser.js#4423
```
  loadAddEngines: function BrowserSearch_loadAddEngines() {
    var newWindowPref = Services.prefs.getIntPref(
      "browser.link.open_newwindow"
    );
    var where = newWindowPref == 3 ? "tab" : "window";
    openTrustedLinkIn(this.searchEnginesURL, where);
  },
```
https://searchfox.org/mozilla-central/rev/ce21a13035623c1d349980057d09000e70669802/browser/base/content/nsContextMenu.js#1852-1855
```
    var newWindowPref = Services.prefs.getIntPref(
      "browser.link.open_newwindow"
    );
    var where = newWindowPref == 3 ? "tab" : "window";
```

and also the preference page overwrites 1 with 3:

https://searchfox.org/mozilla-central/rev/ce21a13035623c1d349980057d09000e70669802/browser/components/preferences/main.js#1240-1259
```
  /**
   * Determines where a link which opens a new window will open.
   *
   * @returns |true| if such links should be opened in new tabs
   */
  readLinkTarget() {
    var openNewWindow = Preferences.get("browser.link.open_newwindow");
    return openNewWindow.value != 2;
  },

  /**
   * Determines where a link which opens a new window will open.
   *
   * @returns 2 if such links should be opened in new windows,
   *          3 if such links should be opened in new tabs
   */
  writeLinkTarget() {
    var linkTargeting = document.getElementById("linkTargeting");
    return linkTargeting.checked ? 3 : 2;
  },
```

This means value 1 is basically unsupported and cannot be kept even if manually configured in about:config.

We should remove the underlying impl that supports value 1.
https://searchfox.org/mozilla-central/rev/ce21a13035623c1d349980057d09000e70669802/toolkit/components/windowwatcher/nsWindowWatcher.cpp#2450-2472
https://searchfox.org/mozilla-central/rev/ce21a13035623c1d349980057d09000e70669802/browser/app/profile/firefox.js#465-467
```
// handle links targeting new windows
// 1=current window/tab, 2=new window, 3=new tab in most recent window
pref("browser.link.open_newwindow", 3);
```

The document for the `browser.link.open_newwindow` pref mentions about value 1, that opens a link to new window into current tab,

but in some case the value is just ignored:

https://searchfox.org/mozilla-central/rev/ce21a13035623c1d349980057d09000e70669802/browser/base/content/browser.js#4423
```
  loadAddEngines: function BrowserSearch_loadAddEngines() {
    var newWindowPref = Services.prefs.getIntPref(
      "browser.link.open_newwindow"
    );
    var where = newWindowPref == 3 ? "tab" : "window";
    openTrustedLinkIn(this.searchEnginesURL, where);
  },
```
https://searchfox.org/mozilla-central/rev/ce21a13035623c1d349980057d09000e70669802/browser/base/content/nsContextMenu.js#1852-1855
```
    var newWindowPref = Services.prefs.getIntPref(
      "browser.link.open_newwindow"
    );
    var where = newWindowPref == 3 ? "tab" : "window";
```

and also the preference page overwrites 1 with 3:

https://searchfox.org/mozilla-central/rev/ce21a13035623c1d349980057d09000e70669802/browser/components/preferences/main.js#1240-1259
```
  /**
   * Determines where a link which opens a new window will open.
   *
   * @returns |true| if such links should be opened in new tabs
   */
  readLinkTarget() {
    var openNewWindow = Preferences.get("browser.link.open_newwindow");
    return openNewWindow.value != 2;
  },

  /**
   * Determines where a link which opens a new window will open.
   *
   * @returns 2 if such links should be opened in new windows,
   *          3 if such links should be opened in new tabs
   */
  writeLinkTarget() {
    var linkTargeting = document.getElementById("linkTargeting");
    return linkTargeting.checked ? 3 : 2;
  },
```

This means value 1 is basically unsupported and cannot be kept even if manually configured in about:config.

We should remove the underlying impl that supports value 1.
https://searchfox.org/mozilla-central/rev/ce21a13035623c1d349980057d09000e70669802/toolkit/components/windowwatcher/nsWindowWatcher.cpp#2450-2472

Back to Bug 1661643 Comment 0