Bug 1287091 - part 2 - ContextualIdentityService must store telemetry data in a separate array, r=Gijs
☠☠ backed out by 820961ff0369 ☠ ☠
authorAndrea Marchesini <amarchesini@mozilla.com>
Fri, 22 Jul 2016 16:19:46 +0200
changeset 306265 939d5064ab91410a763fd3a285a55038f0f36ebc
parent 306264 acbca9af0a3b2c14bbaa20d7d44bd197b3a03e50
child 306266 7ed07b35bad6e2b5571f24213787ab08237d88cc
push id79807
push useramarchesini@mozilla.com
push dateFri, 22 Jul 2016 14:21:20 +0000
treeherdermozilla-inbound@c57fd3af416e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1287091
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1287091 - part 2 - ContextualIdentityService must store telemetry data in a separate array, r=Gijs
toolkit/components/contextualidentity/ContextualIdentityService.jsm
--- a/toolkit/components/contextualidentity/ContextualIdentityService.jsm
+++ b/toolkit/components/contextualidentity/ContextualIdentityService.jsm
@@ -36,56 +36,52 @@ XPCOMUtils.defineLazyModuleGetter(this, 
 this.ContextualIdentityService = {
   _defaultIdentities: [
     { userContextId: 1,
       public: true,
       icon: "chrome://browser/skin/usercontext/personal.svg",
       color: "#00a7e0",
       label: "userContextPersonal.label",
       accessKey: "userContextPersonal.accesskey",
-      alreadyOpened: false,
       telemetryId: 1,
     },
     { userContextId: 2,
       public: true,
       icon: "chrome://browser/skin/usercontext/work.svg",
       color: "#f89c24",
       label: "userContextWork.label",
       accessKey: "userContextWork.accesskey",
-      alreadyOpened: false,
       telemetryId: 2,
     },
     { userContextId: 3,
       public: true,
       icon: "chrome://browser/skin/usercontext/banking.svg",
       color: "#7dc14c",
       label: "userContextBanking.label",
       accessKey: "userContextBanking.accesskey",
-      alreadyOpened: false,
       telemetryId: 3,
     },
     { userContextId: 4,
       public: true,
       icon: "chrome://browser/skin/usercontext/shopping.svg",
       color: "#ee5195",
       label: "userContextShopping.label",
       accessKey: "userContextShopping.accesskey",
-      alreadyOpened: false,
       telemetryId: 4,
     },
     { userContextId: Math.pow(2, 31) - 1,
       public: false,
       icon: "",
       color: "",
       label: "userContextIdInternal.thumbnail",
-      accessKey: "",
-      alreadyOpened: false },
+      accessKey: "" },
   ],
 
   _identities: null,
+  _openedIdentities: new Set(),
 
   _path: null,
   _dataReady: false,
 
   _saver: null,
 
   init() {
     this._path = OS.Path.join(OS.Constants.Path.profileDir, "containers.json");
@@ -214,18 +210,18 @@ this.ContextualIdentityService = {
   telemetry(userContextId) {
     let identity = this.getIdentityFromId(userContextId);
 
     // Let's ignore unknown identities for now.
     if (!identity || !identity.public) {
       return;
     }
 
-    if (!identity.alreadyOpened) {
-      identity.alreadyOpened = true;
+    if (this._openedIdentities.has(userContextId)) {
+      this._openedIdentities.add(userContextId);
       Services.telemetry.getHistogramById("UNIQUE_CONTAINERS_OPENED").add(1);
     }
 
     Services.telemetry.getHistogramById("TOTAL_CONTAINERS_OPENED").add(1);
 
     if (identity.telemetryId) {
       Services.telemetry.getHistogramById("CONTAINER_USED")
                         .add(identity.telemetryId);