Loading toolkit/components/xulstore/old/XULStore.jsm +1 −9 Original line number Diff line number Diff line Loading @@ -12,10 +12,6 @@ const WRITE_DELAY_MS = (debugMode ? 3 : 30) * 1000; const XULSTORE_CID = Components.ID("{6f46b6f4-c8b1-4bd4-a4fa-9ebbed0753ea}"); const STOREDB_FILENAME = "xulstore.json"; const lazy = {}; ChromeUtils.defineModuleGetter(lazy, "OS", "resource://gre/modules/osfile.jsm"); function XULStore() { if (!Services.appinfo.inSafeMode) { this.load(); Loading Loading @@ -104,11 +100,7 @@ XULStore.prototype = { this.log("Writing to xulstore.json"); try { let data = JSON.stringify(this._data); let encoder = new TextEncoder(); data = encoder.encode(data); await lazy.OS.File.writeAtomic(this._storeFile.path, data, { await IOUtils.writeJSON(this._storeFile.path, this._data, { tmpPath: this._storeFile.path + ".tmp", }); } catch (e) { Loading toolkit/components/xulstore/tests/xpcshell/test_XULStore_migration.js +2 −3 Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ const { AppConstants } = ChromeUtils.import( "resource://gre/modules/AppConstants.jsm" ); const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm"); function run_test() { do_get_profile(); Loading @@ -15,7 +14,7 @@ add_task( skip_if: () => !AppConstants.MOZ_NEW_XULSTORE, }, async function test_create_old_datastore() { const path = OS.Path.join(OS.Constants.Path.profileDir, "xulstore.json"); const path = PathUtils.join(PathUtils.profileDir, "xulstore.json"); const xulstoreJSON = { doc1: { Loading @@ -37,7 +36,7 @@ add_task( doc3: {}, }; await OS.File.writeAtomic(path, JSON.stringify(xulstoreJSON)); await IOUtils.writeJSON(path, xulstoreJSON); } ); Loading toolkit/components/xulstore/tests/xpcshell/test_XULStore_migration_fail_invalid_data.js +2 −3 Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ const { AppConstants } = ChromeUtils.import( "resource://gre/modules/AppConstants.jsm" ); const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm"); function run_test() { do_get_profile(); Loading @@ -15,7 +14,7 @@ add_task( skip_if: () => !AppConstants.MOZ_NEW_XULSTORE, }, async function test_create_old_datastore() { const path = OS.Path.join(OS.Constants.Path.profileDir, "xulstore.json"); const path = PathUtils.join(PathUtils.profileDir, "xulstore.json"); // Valid JSON, but invalid data: attr1's value is a number, not a string. const xulstoreJSON = { Loading @@ -31,7 +30,7 @@ add_task( }, }; await OS.File.writeAtomic(path, JSON.stringify(xulstoreJSON)); await IOUtils.writeJSON(path, xulstoreJSON); } ); Loading toolkit/components/xulstore/tests/xpcshell/test_XULStore_migration_fail_invalid_json.js +2 −3 Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ const { AppConstants } = ChromeUtils.import( "resource://gre/modules/AppConstants.jsm" ); const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm"); function run_test() { do_get_profile(); Loading @@ -15,12 +14,12 @@ add_task( skip_if: () => !AppConstants.MOZ_NEW_XULSTORE, }, async function test_create_old_datastore() { const path = OS.Path.join(OS.Constants.Path.profileDir, "xulstore.json"); const path = PathUtils.join(PathUtils.profileDir, "xulstore.json"); // Invalid JSON: it's missing the final closing brace. const xulstoreJSON = '{ doc: { id: { attr: "value" } }'; await OS.File.writeAtomic(path, xulstoreJSON); await IOUtils.writeUTF8(path, xulstoreJSON); } ); Loading toolkit/components/xulstore/tests/xpcshell/test_XULStore_migration_profile_change.js +1 −2 Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ const { AppConstants } = ChromeUtils.import( "resource://gre/modules/AppConstants.jsm" ); const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm"); const { FileUtils } = ChromeUtils.import( "resource://gre/modules/FileUtils.jsm" ); Loading @@ -27,7 +26,7 @@ add_task( // Register an observer before the XULStore service registers its observer, // so we can observe the profile-after-change notification first and create // an old store for it to migrate. We need to write synchronously to avoid // racing XULStore, so we use FileUtils instead of OS.File. // racing XULStore, so we use FileUtils instead of IOUtils. Services.obs.addObserver( { observe() { Loading Loading
toolkit/components/xulstore/old/XULStore.jsm +1 −9 Original line number Diff line number Diff line Loading @@ -12,10 +12,6 @@ const WRITE_DELAY_MS = (debugMode ? 3 : 30) * 1000; const XULSTORE_CID = Components.ID("{6f46b6f4-c8b1-4bd4-a4fa-9ebbed0753ea}"); const STOREDB_FILENAME = "xulstore.json"; const lazy = {}; ChromeUtils.defineModuleGetter(lazy, "OS", "resource://gre/modules/osfile.jsm"); function XULStore() { if (!Services.appinfo.inSafeMode) { this.load(); Loading Loading @@ -104,11 +100,7 @@ XULStore.prototype = { this.log("Writing to xulstore.json"); try { let data = JSON.stringify(this._data); let encoder = new TextEncoder(); data = encoder.encode(data); await lazy.OS.File.writeAtomic(this._storeFile.path, data, { await IOUtils.writeJSON(this._storeFile.path, this._data, { tmpPath: this._storeFile.path + ".tmp", }); } catch (e) { Loading
toolkit/components/xulstore/tests/xpcshell/test_XULStore_migration.js +2 −3 Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ const { AppConstants } = ChromeUtils.import( "resource://gre/modules/AppConstants.jsm" ); const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm"); function run_test() { do_get_profile(); Loading @@ -15,7 +14,7 @@ add_task( skip_if: () => !AppConstants.MOZ_NEW_XULSTORE, }, async function test_create_old_datastore() { const path = OS.Path.join(OS.Constants.Path.profileDir, "xulstore.json"); const path = PathUtils.join(PathUtils.profileDir, "xulstore.json"); const xulstoreJSON = { doc1: { Loading @@ -37,7 +36,7 @@ add_task( doc3: {}, }; await OS.File.writeAtomic(path, JSON.stringify(xulstoreJSON)); await IOUtils.writeJSON(path, xulstoreJSON); } ); Loading
toolkit/components/xulstore/tests/xpcshell/test_XULStore_migration_fail_invalid_data.js +2 −3 Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ const { AppConstants } = ChromeUtils.import( "resource://gre/modules/AppConstants.jsm" ); const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm"); function run_test() { do_get_profile(); Loading @@ -15,7 +14,7 @@ add_task( skip_if: () => !AppConstants.MOZ_NEW_XULSTORE, }, async function test_create_old_datastore() { const path = OS.Path.join(OS.Constants.Path.profileDir, "xulstore.json"); const path = PathUtils.join(PathUtils.profileDir, "xulstore.json"); // Valid JSON, but invalid data: attr1's value is a number, not a string. const xulstoreJSON = { Loading @@ -31,7 +30,7 @@ add_task( }, }; await OS.File.writeAtomic(path, JSON.stringify(xulstoreJSON)); await IOUtils.writeJSON(path, xulstoreJSON); } ); Loading
toolkit/components/xulstore/tests/xpcshell/test_XULStore_migration_fail_invalid_json.js +2 −3 Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ const { AppConstants } = ChromeUtils.import( "resource://gre/modules/AppConstants.jsm" ); const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm"); function run_test() { do_get_profile(); Loading @@ -15,12 +14,12 @@ add_task( skip_if: () => !AppConstants.MOZ_NEW_XULSTORE, }, async function test_create_old_datastore() { const path = OS.Path.join(OS.Constants.Path.profileDir, "xulstore.json"); const path = PathUtils.join(PathUtils.profileDir, "xulstore.json"); // Invalid JSON: it's missing the final closing brace. const xulstoreJSON = '{ doc: { id: { attr: "value" } }'; await OS.File.writeAtomic(path, xulstoreJSON); await IOUtils.writeUTF8(path, xulstoreJSON); } ); Loading
toolkit/components/xulstore/tests/xpcshell/test_XULStore_migration_profile_change.js +1 −2 Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ const { AppConstants } = ChromeUtils.import( "resource://gre/modules/AppConstants.jsm" ); const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm"); const { FileUtils } = ChromeUtils.import( "resource://gre/modules/FileUtils.jsm" ); Loading @@ -27,7 +26,7 @@ add_task( // Register an observer before the XULStore service registers its observer, // so we can observe the profile-after-change notification first and create // an old store for it to migrate. We need to write synchronously to avoid // racing XULStore, so we use FileUtils instead of OS.File. // racing XULStore, so we use FileUtils instead of IOUtils. Services.obs.addObserver( { observe() { Loading