Bug 1267849 - Call LoginManagerParent.init in setupParent of tests. r=dolske
MozReview-Commit-ID: 66FZogdR6Ve
--- a/toolkit/components/passwordmgr/test/pwmgr_common.js
+++ b/toolkit/components/passwordmgr/test/pwmgr_common.js
@@ -355,41 +355,45 @@ function runChecksAfterCommonInit(aFunct
if (this.addMessageListener) {
const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
var SpecialPowers = { Cc, Ci, Cr, Cu, };
var ok, is;
// Ignore ok/is in commonInit since they aren't defined in a chrome script.
ok = is = () => {}; // eslint-disable-line no-native-reassign
Cu.import("resource://gre/modules/LoginHelper.jsm");
+ Cu.import("resource://gre/modules/LoginManagerParent.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm");
function onStorageChanged(subject, topic, data) {
sendAsyncMessage("storageChanged", {
topic,
data,
});
}
Services.obs.addObserver(onStorageChanged, "passwordmgr-storage-changed", false);
addMessageListener("setupParent", ({selfFilling = false} = {selfFilling: false}) => {
+ // Force LoginManagerParent to init for the tests since it's normally delayed
+ // by apps such as on Android.
+ LoginManagerParent.init();
+
commonInit(selfFilling);
sendAsyncMessage("doneSetup");
});
addMessageListener("loadRecipes", Task.async(function* loadRecipes(recipes) {
- var { LoginManagerParent } = Cu.import("resource://gre/modules/LoginManagerParent.jsm", {});
+
var recipeParent = yield LoginManagerParent.recipeParentPromise;
yield recipeParent.load(recipes);
sendAsyncMessage("loadedRecipes", recipes);
}));
addMessageListener("resetRecipes", Task.async(function* resetRecipes() {
- let { LoginManagerParent } = Cu.import("resource://gre/modules/LoginManagerParent.jsm", {});
let recipeParent = yield LoginManagerParent.recipeParentPromise;
yield recipeParent.reset();
sendAsyncMessage("recipesReset");
}));
addMessageListener("proxyLoginManager", msg => {
// Recreate nsILoginInfo objects from vanilla JS objects.
let recreatedArgs = msg.args.map((arg, index) => {