Commit 62025568 authored by Dorel Luca's avatar Dorel Luca
Browse files

Backed out 2 changesets (bug 1530029) for Mochitest failues in...

Backed out 2 changesets (bug 1530029) for Mochitest failues in toolkit/components/passwordmgr/test/mochitest/test_autocomplete_https_upgrade.html

Backed out changeset ad613d1154eb (bug 1530029)
Backed out changeset 21d6040d2bd8 (bug 1530029)
parent cdedc6cb
...@@ -1703,7 +1703,6 @@ pref("extensions.pocket.site", "getpocket.com"); ...@@ -1703,7 +1703,6 @@ pref("extensions.pocket.site", "getpocket.com");
pref("signon.schemeUpgrades", true); pref("signon.schemeUpgrades", true);
pref("signon.privateBrowsingCapture.enabled", true); pref("signon.privateBrowsingCapture.enabled", true);
pref("signon.showAutoCompleteFooter", true);
// Enable the "Simplify Page" feature in Print Preview. This feature // Enable the "Simplify Page" feature in Print Preview. This feature
// is disabled by default in toolkit. // is disabled by default in toolkit.
......
...@@ -536,7 +536,6 @@ const listeners = { ...@@ -536,7 +536,6 @@ const listeners = {
"PasswordManager:autoCompleteLogins": ["LoginManagerParent"], "PasswordManager:autoCompleteLogins": ["LoginManagerParent"],
"PasswordManager:removeLogin": ["LoginManagerParent"], "PasswordManager:removeLogin": ["LoginManagerParent"],
"PasswordManager:insecureLoginFormPresent": ["LoginManagerParent"], "PasswordManager:insecureLoginFormPresent": ["LoginManagerParent"],
"PasswordManager:OpenPreferences": ["LoginManagerParent"],
// PLEASE KEEP THIS LIST IN SYNC WITH THE MOBILE LISTENERS IN BrowserCLH.js // PLEASE KEEP THIS LIST IN SYNC WITH THE MOBILE LISTENERS IN BrowserCLH.js
"rtcpeer:CancelRequest": ["webrtcUI"], "rtcpeer:CancelRequest": ["webrtcUI"],
"rtcpeer:Request": ["webrtcUI"], "rtcpeer:Request": ["webrtcUI"],
......
...@@ -31,7 +31,6 @@ var LoginHelper = { ...@@ -31,7 +31,6 @@ var LoginHelper = {
schemeUpgrades: null, schemeUpgrades: null,
insecureAutofill: null, insecureAutofill: null,
privateBrowsingCaptureEnabled: null, privateBrowsingCaptureEnabled: null,
showAutoCompleteFooter: null,
init() { init() {
// Watch for pref changes to update cached pref values. // Watch for pref changes to update cached pref values.
...@@ -49,8 +48,8 @@ var LoginHelper = { ...@@ -49,8 +48,8 @@ var LoginHelper = {
Services.prefs.getBoolPref("signon.privateBrowsingCapture.enabled"); Services.prefs.getBoolPref("signon.privateBrowsingCapture.enabled");
this.schemeUpgrades = Services.prefs.getBoolPref("signon.schemeUpgrades"); this.schemeUpgrades = Services.prefs.getBoolPref("signon.schemeUpgrades");
this.showAutoCompleteFooter = Services.prefs.getBoolPref("signon.showAutoCompleteFooter");
this.storeWhenAutocompleteOff = Services.prefs.getBoolPref("signon.storeWhenAutocompleteOff"); this.storeWhenAutocompleteOff = Services.prefs.getBoolPref("signon.storeWhenAutocompleteOff");
this.showAutoCompleteFooter = Services.prefs.getBoolPref("signon.showAutoCompleteFooter");
}, },
createLogger(aLogPrefix) { createLogger(aLogPrefix) {
......
...@@ -192,9 +192,6 @@ var LoginManagerContent = { ...@@ -192,9 +192,6 @@ var LoginManagerContent = {
// Number of outstanding requests to each manager. // Number of outstanding requests to each manager.
_managers: new Map(), _managers: new Map(),
// Input element on which enter keydown event was fired.
_keyDownEnterForInput: null,
_takeRequest(msg) { _takeRequest(msg) {
let data = msg.data; let data = msg.data;
let request = this._requests.get(data.requestId); let request = this._requests.get(data.requestId);
...@@ -239,27 +236,6 @@ var LoginManagerContent = { ...@@ -239,27 +236,6 @@ var LoginManagerContent = {
return deferred.promise; return deferred.promise;
}, },
_onKeyDown(event) {
let focusedElement = LoginManagerContent._formFillService.focusedInput;
if (event.keyCode != event.DOM_VK_RETURN || focusedElement != event.target) {
this._keyDownEnterForInput = null;
return;
}
LoginManagerContent._keyDownEnterForInput = focusedElement;
},
_onPopupClosed(selectedRowStyle, mm) {
let focusedElement = LoginManagerContent._formFillService.focusedInput;
let eventTarget = LoginManagerContent._keyDownEnterForInput;
if (!eventTarget || eventTarget !== focusedElement ||
selectedRowStyle != "loginsFooter") {
this._keyDownEnterForInput = null;
return;
}
let hostname = eventTarget.ownerDocument.documentURIObject.host;
mm.sendAsyncMessage("PasswordManager:OpenPreferences", {hostname});
},
receiveMessage(msg, topWindow) { receiveMessage(msg, topWindow) {
if (msg.name == "PasswordManager:fillForm") { if (msg.name == "PasswordManager:fillForm") {
this.fillForm({ this.fillForm({
...@@ -272,10 +248,10 @@ var LoginManagerContent = { ...@@ -272,10 +248,10 @@ var LoginManagerContent = {
return; return;
} }
let request = this._takeRequest(msg);
switch (msg.name) { switch (msg.name) {
case "PasswordManager:loginsFound": { case "PasswordManager:loginsFound": {
let loginsFound = LoginHelper.vanillaObjectsToLogins(msg.data.logins); let loginsFound = LoginHelper.vanillaObjectsToLogins(msg.data.logins);
let request = this._takeRequest(msg);
request.promise.resolve({ request.promise.resolve({
form: request.form, form: request.form,
loginsFound, loginsFound,
...@@ -287,25 +263,9 @@ var LoginManagerContent = { ...@@ -287,25 +263,9 @@ var LoginManagerContent = {
case "PasswordManager:loginsAutoCompleted": { case "PasswordManager:loginsAutoCompleted": {
let loginsFound = LoginHelper.vanillaObjectsToLogins(msg.data.logins); let loginsFound = LoginHelper.vanillaObjectsToLogins(msg.data.logins);
let messageManager = msg.target; let messageManager = msg.target;
let request = this._takeRequest(msg);
request.promise.resolve({ logins: loginsFound, messageManager }); request.promise.resolve({ logins: loginsFound, messageManager });
break; break;
} }
case "FormAutoComplete:PopupOpened": {
let {chromeEventHandler} = msg.target.docShell;
chromeEventHandler.addEventListener("keydown", this._onKeyDown,
true);
break;
}
case "FormAutoComplete:PopupClosed": {
this._onPopupClosed(msg.data.selectedRowStyle, msg.target);
let {chromeEventHandler} = msg.target.docShell;
chromeEventHandler.removeEventListener("keydown", this._onKeyDown,
true);
break;
}
} }
}, },
...@@ -365,11 +325,6 @@ var LoginManagerContent = { ...@@ -365,11 +325,6 @@ var LoginManagerContent = {
isPasswordField: aElement.type == "password", isPasswordField: aElement.type == "password",
}; };
if (LoginHelper.showAutoCompleteFooter) {
messageManager.addMessageListener("FormAutoComplete:PopupOpened", this);
messageManager.addMessageListener("FormAutoComplete:PopupClosed", this);
}
return this._sendRequest(messageManager, requestData, return this._sendRequest(messageManager, requestData,
"PasswordManager:autoCompleteLogins", "PasswordManager:autoCompleteLogins",
messageData); messageData);
......
...@@ -115,11 +115,6 @@ var LoginManagerParent = { ...@@ -115,11 +115,6 @@ var LoginManagerParent = {
AutoCompletePopup.removeLogin(login); AutoCompletePopup.removeLogin(login);
break; break;
} }
case "PasswordManager:OpenPreferences": {
LoginHelper.openPasswordManager(msg.target.ownerGlobal, msg.data.hostname);
break;
}
} }
return undefined; return undefined;
......
...@@ -21,24 +21,6 @@ function loginList() { ...@@ -21,24 +21,6 @@ function loginList() {
]; ];
} }
function openPopup(popup, browser) {
return new Promise(async (resolve) => {
let promiseShown = BrowserTestUtils.waitForEvent(popup, "popupshown");
await SimpleTest.promiseFocus(browser);
info("content window focused");
// Focus the username field to open the popup.
await ContentTask.spawn(browser, null, function openAutocomplete() {
content.document.getElementById("form-basic-username").focus();
});
let shown = await promiseShown;
ok(shown, "autocomplete popup shown");
resolve(shown);
});
}
/** /**
* Initialize logins and set prefs needed for the test. * Initialize logins and set prefs needed for the test.
*/ */
...@@ -53,50 +35,27 @@ add_task(async function test_initialize() { ...@@ -53,50 +35,27 @@ add_task(async function test_initialize() {
} }
}); });
add_task(async function test_autocomplete_footer_onclick() { add_task(async function test_autocomplete_footer() {
let url = TEST_HOSTNAME + BASIC_FORM_PAGE_PATH; let url = TEST_HOSTNAME + BASIC_FORM_PAGE_PATH;
await BrowserTestUtils.withNewTab({ await BrowserTestUtils.withNewTab({
gBrowser, gBrowser,
url, url,
}, async function footer_onclick(browser) { }, async function(browser) {
let popup = document.getElementById("PopupAutoComplete"); let popup = document.getElementById("PopupAutoComplete");
ok(popup, "Got popup"); ok(popup, "Got popup");
await openPopup(popup, browser); let promiseShown = BrowserTestUtils.waitForEvent(popup, "popupshown");
let footer = popup.querySelector(`[originaltype="loginsFooter"]`);
ok(footer, "Got footer richlistitem");
await TestUtils.waitForCondition(() => {
return !EventUtils.isHidden(footer);
}, "Waiting for footer to become visible");
EventUtils.synthesizeMouseAtCenter(footer, {});
await TestUtils.waitForCondition(() => {
return Services.wm.getMostRecentWindow("Toolkit:PasswordManager") !== null;
}, "Waiting for the password manager dialog to open");
info("Login dialog was opened");
let window = Services.wm.getMostRecentWindow("Toolkit:PasswordManager");
await TestUtils.waitForCondition(() => {
return window.document.getElementById("filter").value == "example.com";
}, "Waiting for the search string to filter logins");
window.close(); await SimpleTest.promiseFocus(browser);
popup.hidePopup(); info("content window focused");
});
});
add_task(async function test_autocomplete_footer_keydown() { // Focus the username field to open the popup.
let url = TEST_HOSTNAME + BASIC_FORM_PAGE_PATH; await ContentTask.spawn(browser, null, function openAutocomplete() {
await BrowserTestUtils.withNewTab({ content.document.getElementById("form-basic-username").focus();
gBrowser, });
url,
}, async function footer_enter_keydown(browser) {
let popup = document.getElementById("PopupAutoComplete");
ok(popup, "Got popup");
await openPopup(popup, browser); await promiseShown;
ok(promiseShown, "autocomplete shown");
let footer = popup.querySelector(`[originaltype="loginsFooter"]`); let footer = popup.querySelector(`[originaltype="loginsFooter"]`);
ok(footer, "Got footer richlistitem"); ok(footer, "Got footer richlistitem");
...@@ -105,11 +64,7 @@ add_task(async function test_autocomplete_footer_keydown() { ...@@ -105,11 +64,7 @@ add_task(async function test_autocomplete_footer_keydown() {
return !EventUtils.isHidden(footer); return !EventUtils.isHidden(footer);
}, "Waiting for footer to become visible"); }, "Waiting for footer to become visible");
await EventUtils.synthesizeKey("KEY_ArrowDown"); EventUtils.synthesizeMouseAtCenter(footer, {});
await EventUtils.synthesizeKey("KEY_ArrowDown");
await EventUtils.synthesizeKey("KEY_ArrowDown");
await EventUtils.synthesizeKey("KEY_Enter");
await TestUtils.waitForCondition(() => { await TestUtils.waitForCondition(() => {
return Services.wm.getMostRecentWindow("Toolkit:PasswordManager") !== null; return Services.wm.getMostRecentWindow("Toolkit:PasswordManager") !== null;
}, "Waiting for the password manager dialog to open"); }, "Waiting for the password manager dialog to open");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment