Commit 1371a054 authored by ECarr's avatar ECarr
Browse files

Bug 1531959 - Change all RemoteLogins message names to PasswordManager in pwmgr code. r=MattN

Differential Revision: https://phabricator.services.mozilla.com/D22176

--HG--
extra : moz-landing-system : lando
parent d03156f6
......@@ -29,7 +29,7 @@ XPCOMUtils.defineLazyGetter(this, "LoginManagerContent", () => {
});
// NOTE: Much of this logic is duplicated in BrowserCLH.js for Android.
addMessageListener("RemoteLogins:fillForm", function(message) {
addMessageListener("PasswordManager:fillForm", function(message) {
// intercept if ContextMenu.jsm had sent a plain object for remote targets
message.objects.inputElement = ContextMenuChild.getTarget(global, message, "inputElement");
LoginManagerContent.receiveMessage(message, content);
......
......@@ -530,12 +530,12 @@ const listeners = {
"Reader:FaviconRequest": ["ReaderParent"],
"Reader:UpdateReaderButton": ["ReaderParent"],
// PLEASE KEEP THIS LIST IN SYNC WITH THE MOBILE LISTENERS IN BrowserCLH.js
"RemoteLogins:findLogins": ["LoginManagerParent"],
"RemoteLogins:findRecipes": ["LoginManagerParent"],
"RemoteLogins:onFormSubmit": ["LoginManagerParent"],
"RemoteLogins:autoCompleteLogins": ["LoginManagerParent"],
"RemoteLogins:removeLogin": ["LoginManagerParent"],
"RemoteLogins:insecureLoginFormPresent": ["LoginManagerParent"],
"PasswordManager:findLogins": ["LoginManagerParent"],
"PasswordManager:findRecipes": ["LoginManagerParent"],
"PasswordManager:onFormSubmit": ["LoginManagerParent"],
"PasswordManager:autoCompleteLogins": ["LoginManagerParent"],
"PasswordManager:removeLogin": ["LoginManagerParent"],
"PasswordManager:insecureLoginFormPresent": ["LoginManagerParent"],
// PLEASE KEEP THIS LIST IN SYNC WITH THE MOBILE LISTENERS IN BrowserCLH.js
"rtcpeer:CancelRequest": ["webrtcUI"],
"rtcpeer:Request": ["webrtcUI"],
......
......@@ -536,7 +536,7 @@ var AboutReaderListener = {
};
AboutReaderListener.init();
addMessageListener("RemoteLogins:fillForm", function(message) {
addMessageListener("PasswordManager:fillForm", function(message) {
LoginManagerContent.receiveMessage(message, content);
});
......
......@@ -72,12 +72,12 @@ BrowserCLH.prototype = {
mm: [
// PLEASE KEEP THIS LIST IN SYNC WITH THE DESKTOP LIST IN
// BrowserGlue.jsm
"RemoteLogins:findLogins",
"RemoteLogins:findRecipes",
"RemoteLogins:onFormSubmit",
"RemoteLogins:autoCompleteLogins",
"RemoteLogins:removeLogin",
"RemoteLogins:insecureLoginFormPresent",
"PasswordManager:findLogins",
"PasswordManager:findRecipes",
"PasswordManager:onFormSubmit",
"PasswordManager:autoCompleteLogins",
"PasswordManager:removeLogin",
"PasswordManager:insecureLoginFormPresent",
// PLEASE KEEP THIS LIST IN SYNC WITH THE DESKTOP LIST IN
// BrowserGlue.jsm
],
......
......@@ -146,8 +146,8 @@ var LoginManagerContent = {
},
_messages: [
"RemoteLogins:loginsFound",
"RemoteLogins:loginsAutoCompleted",
"PasswordManager:loginsFound",
"PasswordManager:loginsAutoCompleted",
],
/**
......@@ -236,7 +236,7 @@ var LoginManagerContent = {
},
receiveMessage(msg, topWindow) {
if (msg.name == "RemoteLogins:fillForm") {
if (msg.name == "PasswordManager:fillForm") {
this.fillForm({
topDocument: topWindow.document,
loginFormOrigin: msg.data.loginFormOrigin,
......@@ -249,7 +249,7 @@ var LoginManagerContent = {
let request = this._takeRequest(msg);
switch (msg.name) {
case "RemoteLogins:loginsFound": {
case "PasswordManager:loginsFound": {
let loginsFound = LoginHelper.vanillaObjectsToLogins(msg.data.logins);
request.promise.resolve({
form: request.form,
......@@ -259,7 +259,7 @@ var LoginManagerContent = {
break;
}
case "RemoteLogins:loginsAutoCompleted": {
case "PasswordManager:loginsAutoCompleted": {
let loginsFound = LoginHelper.vanillaObjectsToLogins(msg.data.logins);
let messageManager = msg.target;
request.promise.resolve({ logins: loginsFound, messageManager });
......@@ -294,7 +294,7 @@ var LoginManagerContent = {
options };
return this._sendRequest(messageManager, requestData,
"RemoteLogins:findLogins",
"PasswordManager:findLogins",
messageData);
},
......@@ -325,7 +325,7 @@ var LoginManagerContent = {
};
return this._sendRequest(messageManager, requestData,
"RemoteLogins:autoCompleteLogins",
"PasswordManager:autoCompleteLogins",
messageData);
},
......@@ -551,7 +551,7 @@ var LoginManagerContent = {
};
let messageManager = topWindow.docShell.messageManager;
messageManager.sendAsyncMessage("RemoteLogins:insecureLoginFormPresent", {
messageManager.sendAsyncMessage("PasswordManager:insecureLoginFormPresent", {
hasInsecureLoginForms: hasInsecureLoginForms(topWindow),
});
},
......@@ -1049,7 +1049,7 @@ var LoginManagerContent = {
openerTopWindowID = win.opener.top.windowUtils.outerWindowID;
}
messageManager.sendAsyncMessage("RemoteLogins:onFormSubmit",
messageManager.sendAsyncMessage("PasswordManager:onFormSubmit",
{ hostname,
formSubmitURL,
usernameField: mockUsername,
......@@ -1692,7 +1692,7 @@ UserAutoCompleteResult.prototype = {
if (removeFromDB) {
if (this._messageManager) {
let vanilla = LoginHelper.loginToVanillaObject(removedLogin);
this._messageManager.sendAsyncMessage("RemoteLogins:removeLogin",
this._messageManager.sendAsyncMessage("PasswordManager:removeLogin",
{ login: vanilla });
} else {
Services.logins.removeLogin(removedLogin);
......
......@@ -72,7 +72,7 @@ var LoginManagerParent = {
receiveMessage(msg) {
let data = msg.data;
switch (msg.name) {
case "RemoteLogins:findLogins": {
case "PasswordManager:findLogins": {
// TODO Verify msg.target's principals against the formOrigin?
this.sendLoginDataToChild(data.options.showMasterPassword,
data.formOrigin,
......@@ -82,12 +82,12 @@ var LoginManagerParent = {
break;
}
case "RemoteLogins:findRecipes": {
case "PasswordManager:findRecipes": {
let formHost = (new URL(data.formOrigin)).host;
return this._recipeManager.getRecipesForHost(formHost);
}
case "RemoteLogins:onFormSubmit": {
case "PasswordManager:onFormSubmit": {
// TODO Verify msg.target's principals against the formOrigin?
this.onFormSubmit(data.hostname,
data.formSubmitURL,
......@@ -99,17 +99,17 @@ var LoginManagerParent = {
break;
}
case "RemoteLogins:insecureLoginFormPresent": {
case "PasswordManager:insecureLoginFormPresent": {
this.setHasInsecureLoginForms(msg.target, data.hasInsecureLoginForms);
break;
}
case "RemoteLogins:autoCompleteLogins": {
case "PasswordManager:autoCompleteLogins": {
this.doAutocompleteSearch(data, msg.target);
break;
}
case "RemoteLogins:removeLogin": {
case "PasswordManager:removeLogin": {
let login = LoginHelper.vanillaObjectToLogin(data.login);
AutoCompletePopup.removeLogin(login);
break;
......@@ -141,7 +141,7 @@ var LoginManagerParent = {
let jsLogins = [LoginHelper.loginToVanillaObject(login)];
let objects = inputElement ? {inputElement} : null;
browser.messageManager.sendAsyncMessage("RemoteLogins:fillForm", {
browser.messageManager.sendAsyncMessage("PasswordManager:fillForm", {
loginFormOrigin,
logins: jsLogins,
recipes,
......@@ -167,7 +167,7 @@ var LoginManagerParent = {
if (!showMasterPassword && !Services.logins.isLoggedIn) {
try {
target.sendAsyncMessage("RemoteLogins:loginsFound", {
target.sendAsyncMessage("PasswordManager:loginsFound", {
requestId,
logins: [],
recipes,
......@@ -193,7 +193,7 @@ var LoginManagerParent = {
Services.obs.removeObserver(this, "passwordmgr-crypto-login");
Services.obs.removeObserver(this, "passwordmgr-crypto-loginCanceled");
if (topic == "passwordmgr-crypto-loginCanceled") {
target.sendAsyncMessage("RemoteLogins:loginsFound", {
target.sendAsyncMessage("PasswordManager:loginsFound", {
requestId,
logins: [],
recipes,
......@@ -222,7 +222,7 @@ var LoginManagerParent = {
// Convert the array of nsILoginInfo to vanilla JS objects since nsILoginInfo
// doesn't support structured cloning.
var jsLogins = LoginHelper.loginsToVanillaObjects(logins);
target.sendAsyncMessage("RemoteLogins:loginsFound", {
target.sendAsyncMessage("PasswordManager:loginsFound", {
requestId,
logins: jsLogins,
recipes,
......@@ -244,7 +244,7 @@ var LoginManagerParent = {
`prompt was last cancelled ${Math.round(timeDiff / 1000)} seconds ago.`);
// Send an empty array to make LoginManagerContent clear the
// outstanding request it has temporarily saved.
target.messageManager.sendAsyncMessage("RemoteLogins:loginsAutoCompleted", {
target.messageManager.sendAsyncMessage("PasswordManager:loginsAutoCompleted", {
requestId,
logins: [],
});
......@@ -282,7 +282,7 @@ var LoginManagerParent = {
// Convert the array of nsILoginInfo to vanilla JS objects since nsILoginInfo
// doesn't support structured cloning.
var jsLogins = LoginHelper.loginsToVanillaObjects(matchingLogins);
target.messageManager.sendAsyncMessage("RemoteLogins:loginsAutoCompleted", {
target.messageManager.sendAsyncMessage("PasswordManager:loginsAutoCompleted", {
requestId,
logins: jsLogins,
});
......
......@@ -237,7 +237,7 @@ var LoginRecipesContent = {
let mm = win.docShell.messageManager;
log.warn("getRecipes: falling back to a synchronous message for:", aHost);
recipes = mm.sendSyncMessage("RemoteLogins:findRecipes", { formOrigin: aHost })[0];
recipes = mm.sendSyncMessage("PasswordManager:findRecipes", { formOrigin: aHost })[0];
this.cacheRecipes(aHost, win, recipes);
return recipes;
......
......@@ -153,6 +153,6 @@ addMessageListener("setMasterPassword", ({ enable }) => {
}
});
Services.mm.addMessageListener("RemoteLogins:onFormSubmit", function onFormSubmit(message) {
Services.mm.addMessageListener("PasswordManager:onFormSubmit", function onFormSubmit(message) {
sendAsyncMessage("formSubmissionProcessed", message.data, message.objects);
});
......@@ -41,7 +41,7 @@ const TESTCASES = [
document: `<input type=password value="pass1">`,
inputIndexForFormLike: 0,
// Expected outputs similar to RemoteLogins:onFormSubmit
// Expected outputs similar to PasswordManager:onFormSubmit
hostname: DEFAULT_ORIGIN,
formSubmitURL: DEFAULT_ORIGIN,
usernameFieldValue: null,
......@@ -150,7 +150,7 @@ add_task(async function test() {
let submittedResult = await processedPromise;
// Check data sent via RemoteLogins:onFormSubmit
// Check data sent via PasswordManager:onFormSubmit
is(submittedResult.hostname, tc.hostname, "Check hostname");
is(submittedResult.formSubmitURL, tc.formSubmitURL, "Check formSubmitURL");
......
......@@ -50,7 +50,7 @@ const TESTCASES = [
// Inputs
document: `<input type=password value="pass1">`,
// Expected outputs similar to RemoteLogins:onFormSubmit
// Expected outputs similar to PasswordManager:onFormSubmit
hostname: DEFAULT_ORIGIN,
formSubmitURL: DEFAULT_ORIGIN,
usernameFieldValue: null,
......@@ -156,7 +156,7 @@ add_task(async function test() {
let submittedResult = await processedPromise;
// Check data sent via RemoteLogins:onFormSubmit
// Check data sent via PasswordManager:onFormSubmit
is(submittedResult.hostname, tc.hostname, "Check hostname");
is(submittedResult.formSubmitURL, tc.formSubmitURL, "Check formSubmitURL");
......
......@@ -153,7 +153,7 @@ this.AutoCompletePopup = {
// Along with being called internally by the receiveMessage handler,
// this function is also called directly by the login manager, which
// uses a single message to fill in the autocomplete results. See
// "RemoteLogins:autoCompleteLogins".
// "PasswordManager:autoCompleteLogins".
showPopupWithResults({ browser, rect, dir, results }) {
if (!results.length || this.openedPopup) {
// We shouldn't ever be showing an empty popup, and if we
......
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