Bug 849009 - Uplift Add-on SDK changeset 645b0ca71ccd41bb1fc69d97d22c456b03452e89
This commit is contained in:
@@ -11,11 +11,11 @@ const { Cc, Ci, Cu } = require('chrome');
|
||||
const { defer } = require('../lang/functional');
|
||||
const { emit, on, once, off } = require('../event/core');
|
||||
const { when: unload } = require('../system/unload');
|
||||
const { getWindowLoadingContext, windows } = require('../window/utils');
|
||||
const { WindowTracker } = require("../deprecated/window-utils");
|
||||
const events = require('../system/events');
|
||||
const { deprecateFunction } = require('../util/deprecate');
|
||||
const { isOneOf, is, satisfiesVersion, version } = require('../system/xul-app');
|
||||
const { isWindowPrivate } = require('../window/utils');
|
||||
const { isPrivateBrowsingSupported } = require('../self');
|
||||
|
||||
let deferredEmit = defer(emit);
|
||||
let pbService;
|
||||
@@ -33,7 +33,8 @@ if (isOneOf(['Firefox', 'Fennec'])) {
|
||||
// feature is not really active. See Bug 818800 and Bug 826037
|
||||
if (!('privateBrowsingEnabled' in pbService))
|
||||
pbService = undefined;
|
||||
} catch(e) { /* Private Browsing Service has been removed (Bug 818800) */ }
|
||||
}
|
||||
catch(e) { /* Private Browsing Service has been removed (Bug 818800) */ }
|
||||
|
||||
try {
|
||||
PrivateBrowsingUtils = Cu.import('resource://gre/modules/PrivateBrowsingUtils.jsm', {}).PrivateBrowsingUtils;
|
||||
@@ -41,27 +42,6 @@ if (isOneOf(['Firefox', 'Fennec'])) {
|
||||
catch(e) { /* if this file DNE then an error will be thrown */ }
|
||||
}
|
||||
|
||||
function isWindowPrivate(win) {
|
||||
if (!PrivateBrowsingUtils || !win)
|
||||
return false;
|
||||
|
||||
// if the pbService is undefined, the PrivateBrowsingUtils.jsm is available,
|
||||
// and the app is Firefox, then assume per-window private browsing is
|
||||
// enabled.
|
||||
if (win instanceof Ci.nsIDOMWindow) {
|
||||
return PrivateBrowsingUtils.isWindowPrivate(win);
|
||||
}
|
||||
|
||||
// Sometimes the input is not a nsIDOMWindow.. but it is still a winodw.
|
||||
try {
|
||||
return !!win.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing;
|
||||
}
|
||||
catch (e) {}
|
||||
|
||||
return false;
|
||||
}
|
||||
exports.isWindowPrivate = isWindowPrivate;
|
||||
|
||||
// checks that global private browsing is implemented
|
||||
let isGlobalPBSupported = exports.isGlobalPBSupported = !!pbService && is('Firefox');
|
||||
|
||||
@@ -72,6 +52,11 @@ let isWindowPBSupported = exports.isWindowPBSupported =
|
||||
// checks that per-tab private browsing is implemented
|
||||
let isTabPBSupported = exports.isTabPBSupported =
|
||||
!pbService && !!PrivateBrowsingUtils && is('Fennec') && satisfiesVersion(version, '>=20.0*');
|
||||
|
||||
function ignoreWindow(window) {
|
||||
return !isPrivateBrowsingSupported && isWindowPrivate(window);
|
||||
}
|
||||
exports.ignoreWindow = ignoreWindow;
|
||||
|
||||
function onChange() {
|
||||
// Emit event with in next turn of event loop.
|
||||
|
||||
Reference in New Issue
Block a user