Bug 1362224: Cache tab incognito state. r?aswan draft
authorKris Maglione <maglione.k@gmail.com>
Fri, 05 May 2017 13:01:03 -0700
changeset 573492 dbaf63bed6403023ea5ad162fd0808056886dc79
parent 573491 88da9878aadb1c432c550f2ab037e360830d41a3
child 627316 edbf00e445adce62c7116266952defb292811131
push id57408
push usermaglione.k@gmail.com
push dateFri, 05 May 2017 21:03:51 +0000
reviewersaswan
bugs1362224
milestone55.0a1
Bug 1362224: Cache tab incognito state. r?aswan MozReview-Commit-ID: 2BWqXDFRHlV
toolkit/components/extensions/ExtensionTabs.jsm
--- 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
  *