Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 'use strict';
6 module.metadata = {
7 'stability': 'unstable'
8 };
11 // NOTE: This file should only export Tab instances
14 const { getTabForContentWindow, getTabForBrowser: getRawTabForBrowser } = require('./utils');
15 const { Tab } = require('./tab');
16 const { rawTabNS } = require('./namespace');
18 function getTabForWindow(win) {
19 let tab = getTabForContentWindow(win);
20 // We were unable to find the related tab!
21 if (!tab)
22 return null;
24 return getTabForRawTab(tab) || Tab({ tab: tab });
25 }
26 exports.getTabForWindow = getTabForWindow;
28 // only works on fennec atm
29 function getTabForRawTab(rawTab) {
30 let tab = rawTabNS(rawTab).tab;
31 if (tab) {
32 return tab;
33 }
34 return null;
35 }
36 exports.getTabForRawTab = getTabForRawTab;
38 function getTabForBrowser(browser) {
39 return getTabForRawTab(getRawTabForBrowser(browser));
40 }
41 exports.getTabForBrowser = getTabForBrowser;