Closed Bug 1661643 Opened 3 months ago Closed 3 months ago

Remove browser.link.open_newwindow=1

Categories

(Core :: DOM: Core & HTML, task, P5)

task

Tracking

()

RESOLVED FIXED
82 Branch
Tracking Status
firefox82 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(1 file)

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

Attachment #9172640 - Attachment description: Bug 1661643 - Remove browser.link.open_newwindow=1. r?smaug! → Bug 1661643 - Remove browser.link.open_newwindow=1. r?Gijs!
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/12d62b074178
Remove browser.link.open_newwindow=1. r=preferences-reviewers,Gijs
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
Regressions: 1663500
You need to log in before you can comment on or make changes to this bug.