Bug 1383299 - Fix xpcshell test failures, r=dao

Some xpcshell tests run with _windowless_ browser and calls its LoadURI().
It then failed to get `aBrowser.contentWindow` when we tried to create OA
and detected if the browser was in the private mode.

MozReview-Commit-ID: DWGMyfao1wG

--HG--
extra : rebase_source : c8ed703221aa84ead8288dc7c1f200838808792b
This commit is contained in:
Evelyn Hung 2017-08-22 12:04:19 +08:00
parent c6c14335a6
commit 2292f819c5

View File

@ -35,11 +35,12 @@ this.PrivateBrowsingUtils = {
isBrowserPrivate(aBrowser) {
let chromeWin = aBrowser.ownerGlobal;
if (chromeWin.gMultiProcessBrowser || !aBrowser.isConnected) {
if (chromeWin.gMultiProcessBrowser || !aBrowser.contentWindow) {
// In e10s we have to look at the chrome window's private
// browsing status since the only alternative is to check the
// content window, which is in another process. If the browser
// is lazy then the content window doesn't exist.
// is lazy or is running in windowless configuration then the
// content window doesn't exist.
return this.isWindowPrivate(chromeWin);
}
return this.privacyContextFromWindow(aBrowser.contentWindow).usePrivateBrowsing;