Merge pull request #2498 from ehsan/pbcleanup
Simplify ChromeActions.isInPrivateBrowsing to not rely on the global PB service
This commit is contained in:
commit
24204cc153
@ -198,28 +198,7 @@ function ChromeActions(domWindow, contentDispositionFilename) {
|
||||
|
||||
ChromeActions.prototype = {
|
||||
isInPrivateBrowsing: function() {
|
||||
var docIsPrivate, privateBrowsing;
|
||||
try {
|
||||
docIsPrivate = PrivateBrowsingUtils.isWindowPrivate(this.domWindow);
|
||||
} catch (x) {
|
||||
// unable to use PrivateBrowsingUtils, e.g. FF15
|
||||
}
|
||||
if (typeof docIsPrivate === 'undefined') {
|
||||
// per-window Private Browsing is not supported, trying global service
|
||||
try {
|
||||
privateBrowsing = Cc['@mozilla.org/privatebrowsing;1']
|
||||
.getService(Ci.nsIPrivateBrowsingService);
|
||||
docIsPrivate = privateBrowsing.privateBrowsingEnabled;
|
||||
} catch (x) {
|
||||
// unable to get nsIPrivateBrowsingService (e.g. not Firefox)
|
||||
docIsPrivate = false;
|
||||
}
|
||||
}
|
||||
// caching the result
|
||||
this.isInPrivateBrowsing = function isInPrivateBrowsingCached() {
|
||||
return docIsPrivate;
|
||||
};
|
||||
return docIsPrivate;
|
||||
return PrivateBrowsingUtils.isWindowPrivate(this.domWindow);
|
||||
},
|
||||
download: function(data, sendResponse) {
|
||||
var self = this;
|
||||
|
Loading…
Reference in New Issue
Block a user