Bug 1004395 - Uplift Add-on SDK to Firefox r=me

This commit is contained in:
Erik Vold
2014-05-09 10:10:05 -07:00
parent baa9ce2119
commit c8de16d891
41 changed files with 342 additions and 378 deletions

View File

@@ -7,13 +7,10 @@ module.metadata = {
"stability": "stable"
};
const { Ci } = require('chrome');
const { setMode, getMode, on: onStateChange, isPermanentPrivateBrowsing } = require('./private-browsing/utils');
const { isWindowPrivate } = require('./window/utils');
const { setMode, getMode, on: onStateChange, isPrivate } = require('./private-browsing/utils');
const { emit, on, once, off } = require('./event/core');
const { when: unload } = require('./system/unload');
const { deprecateUsage, deprecateFunction, deprecateEvent } = require('./util/deprecate');
const { getOwnerWindow } = require('./private-browsing/window/utils');
const { deprecateFunction, deprecateEvent } = require('./util/deprecate');
onStateChange('start', function onStart() {
emit(exports, 'start');
@@ -39,48 +36,7 @@ exports.removeListener = deprecateEvents(function removeListener(type, listener)
off(exports, type, listener);
});
exports.isPrivate = function(thing) {
// if thing is defined, and we can find a window for it
// then check if the window is private
if (!!thing) {
// if the thing is a window, and the window is private
// then return true
if (isWindowPrivate(thing)) {
return true;
}
// does the thing have an associated tab?
// page-mod instances do..
if (thing.tab) {
let tabWindow = getOwnerWindow(thing.tab);
if (tabWindow) {
let isThingPrivate = isWindowPrivate(tabWindow);
if (isThingPrivate)
return isThingPrivate;
}
}
// can we find an associated window?
let window = getOwnerWindow(thing);
if (window)
return isWindowPrivate(window);
try {
let { isChannelPrivate } = thing.QueryInterface(Ci.nsIPrivateBrowsingChannel);
if (isChannelPrivate)
return true;
} catch(e) {}
}
// check if the post pwpb, global pb service is enabled.
if (isPermanentPrivateBrowsing())
return true;
// if we get here, and global private browsing
// is available, and it is true, then return
// true otherwise false is returned here
return getMode();
};
exports.isPrivate = isPrivate;
function deprecateEvents(func) deprecateEvent(
func,