From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- .../test_browserGlue_migration_loop_cleanup.js | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 browser/components/tests/unit/test_browserGlue_migration_loop_cleanup.js (limited to 'browser/components/tests/unit/test_browserGlue_migration_loop_cleanup.js') diff --git a/browser/components/tests/unit/test_browserGlue_migration_loop_cleanup.js b/browser/components/tests/unit/test_browserGlue_migration_loop_cleanup.js new file mode 100644 index 000000000..a68503db3 --- /dev/null +++ b/browser/components/tests/unit/test_browserGlue_migration_loop_cleanup.js @@ -0,0 +1,32 @@ +const UI_VERSION = 41; +const TOPIC_BROWSERGLUE_TEST = "browser-glue-test"; +const TOPICDATA_BROWSERGLUE_TEST = "force-ui-migration"; + +var gBrowserGlue = Cc["@mozilla.org/browser/browserglue;1"] + .getService(Ci.nsIObserver); + +Services.prefs.setIntPref("browser.migration.version", UI_VERSION - 1); + +add_task(function* test_check_cleanup_loop_prefs() { + Services.prefs.setBoolPref("loop.createdRoom", true); + Services.prefs.setBoolPref("loop1.createdRoom", true); + Services.prefs.setBoolPref("loo.createdRoom", true); + + // Simulate a migration. + gBrowserGlue.observe(null, TOPIC_BROWSERGLUE_TEST, TOPICDATA_BROWSERGLUE_TEST); + + Assert.throws(() => Services.prefs.getBoolPref("loop.createdRoom"), + /NS_ERROR_UNEXPECTED/, + "should have cleared old loop preference 'loop.createdRoom'"); + Assert.ok(Services.prefs.getBoolPref("loop1.createdRoom"), + "should have left non-loop pref 'loop1.createdRoom' untouched"); + Assert.ok(Services.prefs.getBoolPref("loo.createdRoom"), + "should have left non-loop pref 'loo.createdRoom' untouched"); +}); + +do_register_cleanup(() => { + Services.prefs.clearUserPref("browser.migration.version"); + Services.prefs.clearUserPref("loop.createdRoom"); + Services.prefs.clearUserPref("loop1.createdRoom"); + Services.prefs.clearUserPref("loo.createdRoom"); +}); -- cgit v1.2.3