forked from mozilla/addon-sdk
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mozilla#830 from ochameau/tabs-pb
Bug 838981: Ignore private window in tabs API when addon doesn't have private-browsing permission. r=@Gozala
- Loading branch information
Showing
6 changed files
with
84 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const tabs = require('sdk/tabs'); | ||
const { is } = require('sdk/system/xul-app'); | ||
const { isPrivate } = require('sdk/private-browsing'); | ||
const pbUtils = require('sdk/private-browsing/utils'); | ||
const { getOwnerWindow } = require('sdk/private-browsing/window/utils'); | ||
|
||
exports.testPrivateTabsAreListed = function (assert, done) { | ||
let originalTabCount = tabs.length; | ||
|
||
tabs.open({ | ||
url: 'about:blank', | ||
isPrivate: true, | ||
onOpen: function(tab) { | ||
let win = getOwnerWindow(tab); | ||
// PWPB case | ||
if (pbUtils.isWindowPBSupported || pbUtils.isTabPBSupported) { | ||
assert.ok(isPrivate(tab), "tab is private"); | ||
assert.equal(tabs.length, originalTabCount + 1, | ||
'New private window\'s tab are visible in tabs list'); | ||
} | ||
else { | ||
// Global case, openDialog didn't opened a private window/tab | ||
assert.ok(!isPrivate(tab), "tab isn't private"); | ||
assert.equal(tabs.length, originalTabCount + 1, | ||
'New non-private window\'s tab is visible in tabs list'); | ||
} | ||
tab.close(done); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters