diff options
Diffstat (limited to 'toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js')
-rw-r--r-- | toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js b/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js index 1494c60bbd..1e02e6a368 100644 --- a/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js +++ b/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js @@ -25,11 +25,6 @@ const { LENGTH: GENERATED_PASSWORD_LENGTH, REGEX: GENERATED_PASSWORD_REGEX } = const LOGIN_FIELD_UTILS = LoginTestUtils.loginField; const TESTS_DIR = "/tests/toolkit/components/passwordmgr/test/"; -// Depending on pref state we either show auth prompts as windows or on tab level. -let authPromptModalType = SpecialPowers.Services.prefs.getIntPref( - "prompts.modalType.httpAuth" -); - /** * Recreate a DOM tree using the outerHTML to ensure that any event listeners * and internal state for the elements are removed. @@ -1051,6 +1046,23 @@ SimpleTest.registerCleanupFunction(() => { }); }); +// This is a version of LoginHelper.loginToVanillaObject that is adapted to run +// as content JS instead of chrome JS. This is needed to make it return a +// content JS object because the structured cloning we use to send it over +// JS IPC can't deal with a cross compartment wrapper. +function loginToVanillaObject(login) { + let obj = {}; + for (let i in SpecialPowers.do_QueryInterface( + login, + SpecialPowers.Ci.nsILoginMetaInfo + )) { + if (typeof login[i] !== "function") { + obj[i] = login[i]; + } + } + return obj; +} + /** * Proxy for Services.logins (nsILoginManager). * Only supports arguments which support structured clone plus {nsILoginInfo} @@ -1067,7 +1079,7 @@ this.LoginManager = new Proxy( SpecialPowers.call_Instanceof(val, SpecialPowers.Ci.nsILoginInfo) ) { loginInfoIndices.push(index); - return LoginHelper.loginToVanillaObject(val); + return loginToVanillaObject(val); } return val; |