This repository has been archived by the owner on Feb 26, 2022. It is now read-only.
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 #865 from erikvold/stabilization
Bug 841823: Stabilization branch updates for minimal support of per window private browsing. r=me
- Loading branch information
Showing
26 changed files
with
1,223 additions
and
199 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,51 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
'use strict'; | ||
|
||
const { getMostRecentBrowserWindow, windows: getWindows } = require('../window/utils'); | ||
const { ignoreWindow } = require('../private-browsing/utils'); | ||
const { isPrivateBrowsingSupported } = require('../self'); | ||
|
||
function getWindow(anchor) { | ||
let window; | ||
let windows = getWindows("navigator:browser", { | ||
includePrivate: isPrivateBrowsingSupported | ||
}); | ||
|
||
if (anchor) { | ||
let anchorWindow = anchor.ownerDocument.defaultView.top; | ||
let anchorDocument = anchorWindow.document; | ||
|
||
// loop thru supported windows | ||
for each(let enumWindow in windows) { | ||
// Check if the anchor is in this browser window. | ||
if (enumWindow == anchorWindow) { | ||
window = anchorWindow; | ||
break; | ||
} | ||
|
||
// Check if the anchor is in a browser tab in this browser window. | ||
let browser = enumWindow.gBrowser.getBrowserForDocument(anchorDocument); | ||
if (browser) { | ||
window = enumWindow; | ||
break; | ||
} | ||
|
||
// Look in other subdocuments (sidebar, etc.)? | ||
} | ||
} | ||
|
||
// If we didn't find the anchor's window (or we have no anchor), | ||
// return the most recent browser window. | ||
if (!window) | ||
window = getMostRecentBrowserWindow(); | ||
|
||
// if the window is not supported, then it should be ignored | ||
if (ignoreWindow(window)) { | ||
return null; | ||
} | ||
|
||
return window; | ||
} | ||
exports.getWindow = getWindow; |
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 |
---|---|---|
|
@@ -7,3 +7,4 @@ let { ns } = require('../core/namespace'); | |
|
||
exports.tabsNS = ns(); | ||
exports.tabNS = ns(); | ||
exports.rawTabNS = ns(); |
Oops, something went wrong.