Bug 1362224: Cache tab incognito state. r?aswan
MozReview-Commit-ID: 2BWqXDFRHlV
--- a/toolkit/components/extensions/ExtensionTabs.jsm
+++ b/toolkit/components/extensions/ExtensionTabs.jsm
@@ -20,16 +20,17 @@ XPCOMUtils.defineLazyModuleGetter(this,
Cu.import("resource://gre/modules/ExtensionUtils.jsm");
const {
DefaultMap,
DefaultWeakMap,
EventEmitter,
ExtensionError,
+ defineLazyGetter,
getWinUtils,
} = ExtensionUtils;
/**
* The platform-specific type of native tab objects, which are wrapped by
* TabBase instances.
*
* @typedef {Object|XULElement} NativeTab
@@ -175,17 +176,17 @@ class TabBase {
this.activeTabWindowID === this.innerWindowID);
}
/**
* @property {boolean} incognito
* Returns true if this is a private browsing tab, false otherwise.
* @readonly
*/
- get incognito() {
+ get _incognito() {
return PrivateBrowsingUtils.isBrowserPrivate(this.browser);
}
/**
* @property {string} _url
* Returns the current URL of this tab. Does not do any permission
* checks.
* @readonly
@@ -637,16 +638,18 @@ class TabBase {
* @returns {Promise}
* Resolves when the operation has completed.
*/
removeCSS(context, details) {
return this._execute(context, details, "css", "removeCSS").then(() => {});
}
}
+defineLazyGetter(TabBase.prototype, "incognito", function() { return this._incognito; });
+
// Note: These must match the values in windows.json.
const WINDOW_ID_NONE = -1;
const WINDOW_ID_CURRENT = -2;
/**
* A platform-independent base class for extension-specific wrappers around
* native browser windows
*