summaryrefslogtreecommitdiffstats
path: root/browser/components/tests/unit/test_browserGlue_migration_social_cleanup.js
blob: 00b59202a41cd75c00e2f98766e963adef479100 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const UI_VERSION = 69;
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(async function test_check_cleanup_social_prefs() {
  Services.prefs.setStringPref("social.manifest.example-com", "example.com");

  // Simulate a migration.
  gBrowserGlue.observe(
    null,
    TOPIC_BROWSERGLUE_TEST,
    TOPICDATA_BROWSERGLUE_TEST
  );

  Assert.ok(
    !Services.prefs.prefHasUserValue("social.manifest.example-com"),
    "should have cleared old social preference 'social.manifest.example-com'"
  );
});

registerCleanupFunction(() => {
  Services.prefs.clearUserPref("browser.migration.version");
  Services.prefs.clearUserPref("social.manifest.example-com");
});