Backed out changeset c5efa902cbe5 (bug 1287091)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Sun, 24 Jul 2016 14:31:44 +0200
changeset 306350 37e221f3b0df2407181771f1037aca5f193e05b5
parent 306349 50b8cc9b8e57488317a14fbd0bd45635a2bd200f
child 306351 9050273219625ef34adf0d4482bb7b623fa1438c
push id79841
push usercbook@mozilla.com
push dateSun, 24 Jul 2016 12:32:19 +0000
treeherdermozilla-inbound@8b0f3616c00a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1287091
milestone50.0a1
backs outc5efa902cbe52cda80ef1db75322f8d0a9b31d18
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
Backed out changeset c5efa902cbe5 (bug 1287091)
toolkit/components/contextualidentity/ContextualIdentityService.jsm
--- a/toolkit/components/contextualidentity/ContextualIdentityService.jsm
+++ b/toolkit/components/contextualidentity/ContextualIdentityService.jsm
@@ -62,27 +62,26 @@ this.ContextualIdentityService = {
     { userContextId: 4,
       public: true,
       icon: "chrome://browser/skin/usercontext/shopping.svg",
       color: "#ee5195",
       label: "userContextShopping.label",
       accessKey: "userContextShopping.accesskey",
       telemetryId: 4,
     },
-    { userContextId: 5,
+    { userContextId: Math.pow(2, 31) - 1,
       public: false,
       icon: "",
       color: "",
       label: "userContextIdInternal.thumbnail",
       accessKey: "" },
   ],
 
   _identities: null,
   _openedIdentities: new Set(),
-  _lastUserContextId: 0,
 
   _path: null,
   _dataReady: false,
 
   _saver: null,
 
   init() {
     this._path = OS.Path.join(OS.Constants.Path.profileDir, "containers.json");
@@ -97,69 +96,51 @@ this.ContextualIdentityService = {
   load() {
     OS.File.read(this._path).then(bytes => {
       // If synchronous loading happened in the meantime, exit now.
       if (this._dataReady) {
         return;
       }
 
       try {
-        let data = JSON.parse(gTextDecoder.decode(bytes));
-        if (data.version != 1) {
-          dump("ERROR - ContextualIdentityService - Unknown version found in " + this._path + "\n");
-          this.loadError(null);
-          return;
-        }
-
-        this._identities = data.identities;
-        this._lastUserContextId = data.lastUserContextId;
-
+        this._identities = JSON.parse(gTextDecoder.decode(bytes));
         this._dataReady = true;
       } catch(error) {
         this.loadError(error);
       }
     }, (error) => {
       this.loadError(error);
     });
   },
 
   loadError(error) {
-    if (error != null &&
-        !(error instanceof OS.File.Error && error.becauseNoSuchFile) &&
+    if (!(error instanceof OS.File.Error && error.becauseNoSuchFile) &&
         !(error instanceof Components.Exception &&
           error.result == Cr.NS_ERROR_FILE_NOT_FOUND)) {
       // Let's report the error.
       Cu.reportError(error);
     }
 
     // If synchronous loading happened in the meantime, exit now.
     if (this._dataReady) {
       return;
     }
 
     this._identities = this._defaultIdentities;
-    this._lastUserContextId = this._defaultIdentities.length;
-
     this._dataReady = true;
 
     this.saveSoon();
   },
 
   saveSoon() {
     this._saver.arm();
   },
 
   save() {
-   let object = {
-     version: 1,
-     lastUserContextId: this._lastUserContextId,
-     identities: this._identities
-   };
-
-   let bytes = gTextEncoder.encode(JSON.stringify(object));
+   let bytes = gTextEncoder.encode(JSON.stringify(this._identities));
    return OS.File.writeAtomic(this._path, bytes,
                               { tmpPath: this._path + ".tmp" });
   },
 
   ensureDataReady() {
     if (this._dataReady) {
       return;
     }