зеркало из https://github.com/mozilla/pjs.git
Bug 659777 - Check for existence of Svc.Private before accessing it [r=philikon]
This commit is contained in:
Родитель
659370ee1e
Коммит
526ed059bb
|
@ -179,7 +179,7 @@ TabStore.prototype = {
|
|||
record.clientName = Clients.localName;
|
||||
|
||||
// Don't provide any tabs to compare against and ignore the update later.
|
||||
if (Svc.Private.privateBrowsingEnabled && !PBPrefs.get("autostart")) {
|
||||
if (Svc.Private && Svc.Private.privateBrowsingEnabled && !PBPrefs.get("autostart")) {
|
||||
record.tabs = [];
|
||||
return record;
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ TabStore.prototype = {
|
|||
getAllIDs: function TabStore_getAllIds() {
|
||||
// Don't report any tabs if we're in private browsing for first syncs.
|
||||
let ids = {};
|
||||
if (Svc.Private.privateBrowsingEnabled && !PBPrefs.get("autostart"))
|
||||
if (Svc.Private && Svc.Private.privateBrowsingEnabled && !PBPrefs.get("autostart"))
|
||||
return ids;
|
||||
|
||||
ids[Clients.localID] = true;
|
||||
|
@ -333,7 +333,7 @@ TabTracker.prototype = {
|
|||
},
|
||||
|
||||
onTab: function onTab(event) {
|
||||
if (Svc.Private.privateBrowsingEnabled && !PBPrefs.get("autostart")) {
|
||||
if (Svc.Private && Svc.Private.privateBrowsingEnabled && !PBPrefs.get("autostart")) {
|
||||
this._log.trace("Ignoring tab event from private browsing.");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1304,12 +1304,21 @@ let _sessionCID = Services.appinfo.ID == SEAMONKEY_ID ?
|
|||
[["Form", "@mozilla.org/satchel/form-history;1", "nsIFormHistory2"],
|
||||
["Idle", "@mozilla.org/widget/idleservice;1", "nsIIdleService"],
|
||||
["KeyFactory", "@mozilla.org/security/keyobjectfactory;1", "nsIKeyObjectFactory"],
|
||||
["Private", "@mozilla.org/privatebrowsing;1", "nsIPrivateBrowsingService"],
|
||||
["Session", _sessionCID, "nsISessionStore"]
|
||||
].forEach(function([name, contract, iface]) {
|
||||
XPCOMUtils.defineLazyServiceGetter(Svc, name, contract, iface);
|
||||
});
|
||||
|
||||
// nsIPrivateBrowsingService is not implemented in mobile Firefox.
|
||||
// Svc.Private should just return undefined in this case instead of throwing.
|
||||
XPCOMUtils.defineLazyGetter(Svc, "Private", function() {
|
||||
try {
|
||||
return Cc["@mozilla.org/privatebrowsing;1"].getService(Ci["nsIPrivateBrowsingService"]);
|
||||
} catch (e) {
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
|
||||
Svc.__defineGetter__("Crypto", function() {
|
||||
let cryptoSvc;
|
||||
let ns = {};
|
||||
|
|
Загрузка…
Ссылка в новой задаче