This was done using the following script:
37e3803c7a/processors/chromeutils-import.jsm
MozReview-Commit-ID: 1Nc3XDu0wGl
45 lines
1.7 KiB
JavaScript
45 lines
1.7 KiB
JavaScript
/**
|
|
* Provides infrastructure for automated onboarding components tests.
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
/* global Cc, Ci, Cu */
|
|
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
|
ChromeUtils.import("resource://gre/modules/Preferences.jsm");
|
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
|
|
// Load our bootstrap extension manifest so we can access our chrome/resource URIs.
|
|
// Cargo culted from formautofill system add-on
|
|
const EXTENSION_ID = "onboarding@mozilla.org";
|
|
let extensionDir = Services.dirsvc.get("GreD", Ci.nsIFile);
|
|
extensionDir.append("browser");
|
|
extensionDir.append("features");
|
|
extensionDir.append(EXTENSION_ID);
|
|
// If the unpacked extension doesn't exist, use the packed version.
|
|
if (!extensionDir.exists()) {
|
|
extensionDir.leafName += ".xpi";
|
|
}
|
|
Components.manager.addBootstrappedManifestLocation(extensionDir);
|
|
|
|
const TOURSET_VERSION = 1;
|
|
const NEXT_TOURSET_VERSION = 2;
|
|
const PREF_TOUR_TYPE = "browser.onboarding.tour-type";
|
|
const PREF_TOURSET_VERSION = "browser.onboarding.tourset-version";
|
|
const PREF_SEEN_TOURSET_VERSION = "browser.onboarding.seen-tourset-version";
|
|
|
|
function resetOnboardingDefaultState() {
|
|
// All the prefs should be reset to what prefs should looks like in a new user profile
|
|
Services.prefs.setIntPref(PREF_TOURSET_VERSION, TOURSET_VERSION);
|
|
Services.prefs.clearUserPref(PREF_SEEN_TOURSET_VERSION);
|
|
Services.prefs.clearUserPref(PREF_TOUR_TYPE);
|
|
}
|
|
|
|
function resetOldProfileDefaultState() {
|
|
// All the prefs should be reset to what prefs should looks like in a older new user profile
|
|
Services.prefs.setIntPref(PREF_TOURSET_VERSION, TOURSET_VERSION);
|
|
Services.prefs.setIntPref(PREF_SEEN_TOURSET_VERSION, 0);
|
|
Services.prefs.clearUserPref(PREF_TOUR_TYPE);
|
|
}
|