Bug 1287091 - part 2 - ContextualIdentityService must store telemetry data in a separate array, r=Gijs
☠☠ backed out by 905027321962 ☠ ☠
authorAndrea Marchesini <amarchesini@mozilla.com>
Sat, 23 Jul 2016 08:57:53 +0200
changeset 348540 93fa501cfd3a0d8b8ed5960789a2197a0db59ba9
parent 348539 bf7c4e797f762c0de3e92e8ec19eec47a95ce92d
child 348541 c5efa902cbe52cda80ef1db75322f8d0a9b31d18
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [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);