sdk/tabs.open in private mode opens a new window at the first invocation

RESOLVED INCOMPLETE

Status

RESOLVED INCOMPLETE
3 years ago
a year ago

People

(Reporter: markus.heidelberg, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

3 years ago
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0
Build ID: 20151015193503

Steps to reproduce:

1. Invoke "jpm run" or "cfx run" for the attached minimal Add-On.
2. Open "Preferences", go to tab "Privacy" and change "History" from "Remember history" to "Never remember history".
3. Press "OK" then when being asked for Firefox restart.
4. Open the context-menu via mouse right-click and click on "New Tab"

jpm 1.0.3
cfx 1.17
Firefox 41.0.2 on Arch Linux

Files:

packages.json:
{
  "name": "tabs-open-bug",
  "version": "0.0.1",
  "id": "@tabs-open-bug",
  "main": "index.js",
  "permissions": {"private-browsing": true}
}

index.js:
require("sdk/context-menu").Item({
  label: "New Tab",
  contentScript: 'self.on("click", function () {' +
                 '  self.postMessage();' +
                 '});',
  onMessage: function () {
    require("sdk/tabs").open("about:about");
  }
});


Actual results:

A new window instead of a new tab is opened. All subsequent "New Tab" clicks will open a tab as expected.


Expected results:

Open a new tab at the first click as well.

I'm not sure, but think it worked in an older version of Firefox, maybe 37.

In a probably related bug https://bugzilla.mozilla.org/show_bug.cgi?id=874554 I found this patch: https://github.com/mozilla/r2d2b2g/pull/542/files

Following this change and replacing

  require("sdk/tabs").open("about:about");

with

  require("sdk/windows").browserWindows.activeWindow.tabs.open("about:about");

led to a runtime error:

  JPM [error]   Message: TypeError: require(...).browserWindows.activeWindow is undefined

After doing something like minimizing and restoring the browser window, it worked as expected.

But require("sdk/windows").browserWindows.length still is 0 instead of 1 in all cases.
(Reporter)

Comment 1

3 years ago
I tried with Firefox 38.3.0 on Windows 7 today and could not reproduce the problem. Might this be a bug in Firefox instead of the Add-On SDK?

Comment 2

3 years ago
I can confirm this bug on Firefox 43.0 on Ubuntu Linux. A related comment is https://bugzilla.mozilla.org/show_bug.cgi?id=1026614#c4.
https://bugzilla.mozilla.org/show_bug.cgi?id=1399562
Status: UNCONFIRMED → RESOLVED
Last Resolved: a year ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.