Skip to content

Commit

Permalink
Bug 1649616, remove OS.File usages from ContextualIdentityService.jsm…
Browse files Browse the repository at this point in the history
… r=barret

Differential Revision: https://phabricator.services.mozilla.com/D97054
  • Loading branch information
Emma Malysz committed Nov 18, 2020
1 parent 64280c7 commit 1110207
Showing 1 changed file with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ ChromeUtils.defineModuleGetter(
"AsyncShutdown",
"resource://gre/modules/AsyncShutdown.jsm"
);
ChromeUtils.defineModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
ChromeUtils.defineModuleGetter(
this,
"DeferredTask",
Expand Down Expand Up @@ -170,7 +169,7 @@ _ContextualIdentityService.prototype = {
},

load() {
return OS.File.read(this._path).then(
return IOUtils.read(this._path).then(
bytes => {
// If synchronous loading happened in the meantime, exit now.
if (this._dataReady) {
Expand Down Expand Up @@ -217,14 +216,7 @@ _ContextualIdentityService.prototype = {
},

loadError(error) {
if (
error != null &&
!(error instanceof OS.File.Error && error.becauseNoSuchFile) &&
!(
error instanceof Components.Exception &&
error.result == Cr.NS_ERROR_FILE_NOT_FOUND
)
) {
if (error != null && error.name != "NotFoundError") {
// Let's report the error.
Cu.reportError(error);
}
Expand Down Expand Up @@ -266,7 +258,7 @@ _ContextualIdentityService.prototype = {
};

let bytes = gTextEncoder.encode(JSON.stringify(object));
return OS.File.writeAtomic(this._path, bytes, {
return IOUtils.writeAtomic(this._path, bytes, {
tmpPath: this._path + ".tmp",
});
},
Expand Down Expand Up @@ -653,5 +645,8 @@ _ContextualIdentityService.prototype = {
},
};

let path = OS.Path.join(OS.Constants.Path.profileDir, "containers.json");
let path = PathUtils.join(
Services.dirsvc.get("ProfD", Ci.nsIFile).path,
"containers.json"
);
var ContextualIdentityService = new _ContextualIdentityService(path);

0 comments on commit 1110207

Please sign in to comment.