зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset c5efa902cbe5 (bug 1287091)
This commit is contained in:
Родитель
a937b9b8c3
Коммит
c412661b21
|
@ -67,7 +67,7 @@ this.ContextualIdentityService = {
|
|||
accessKey: "userContextShopping.accesskey",
|
||||
telemetryId: 4,
|
||||
},
|
||||
{ userContextId: 5,
|
||||
{ userContextId: Math.pow(2, 31) - 1,
|
||||
public: false,
|
||||
icon: "",
|
||||
color: "",
|
||||
|
@ -77,7 +77,6 @@ this.ContextualIdentityService = {
|
|||
|
||||
_identities: null,
|
||||
_openedIdentities: new Set(),
|
||||
_lastUserContextId: 0,
|
||||
|
||||
_path: null,
|
||||
_dataReady: false,
|
||||
|
@ -102,16 +101,7 @@ this.ContextualIdentityService = {
|
|||
}
|
||||
|
||||
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);
|
||||
|
@ -122,8 +112,7 @@ this.ContextualIdentityService = {
|
|||
},
|
||||
|
||||
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.
|
||||
|
@ -136,8 +125,6 @@ this.ContextualIdentityService = {
|
|||
}
|
||||
|
||||
this._identities = this._defaultIdentities;
|
||||
this._lastUserContextId = this._defaultIdentities.length;
|
||||
|
||||
this._dataReady = true;
|
||||
|
||||
this.saveSoon();
|
||||
|
@ -148,13 +135,7 @@ this.ContextualIdentityService = {
|
|||
},
|
||||
|
||||
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" });
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче