Hi,
I have notice a problem with the Add-on SDK in “private browsing mode”.
The problem can be reproduce with this simple code:
const windows = require("sdk/windows").browserWindows;
windows.on("activate", function(window) {
console.log("A window was activated.");
console.log("Active window title: " + windows.activeWindow.title);
// => tabs length is always 0 !!!!
console.log("Active window tabs length: " + windows.activeWindow.tabs.length);
});
const tabs = require('sdk/tabs');
tabs.on("activate", function (tab) {
console.log("A tab was activated.");
try {
console.log("Active window tabs length: " + tab.window.tabs.length);
}
catch (e) {
// => exception because the window associated to the tab is null !!!
console.log(e);
}
});
Of course the following key must be set in the package.json file of the add-on:
"permissions": {"private-browsing": true}
To reproduce the problem Firefox must be started with a private window.
So the problem:
- The active window cannot list the tabs.
- The active tab cannot get the associated window.
This only happens if Firefox starts with a private window.
If another private window is opened, the problem doesn’t happen with this window.
If Firefox is started in normal mode and a private window is opened, the problem doesn’t happen with this private window.
Is it a known bug, behavior or do I miss something?
Thanks