Bug 1330111 - Convert the getFocusedInput method on nsIFormFillController to an attribute. r=felipe

The convention is to use an attribute. This also fixes reference counting.

MozReview-Commit-ID: B38ZVNt4Ugi

--HG--
extra : rebase_source : d84db245899e434c90b124e4ee1c5ebb1c0e79b9
This commit is contained in:
Matthew Noorenberghe 2017-01-31 23:57:49 -08:00
parent 3e2d9794ad
commit 3742b4bd15
3 changed files with 10 additions and 14 deletions

View File

@ -291,7 +291,7 @@ AutofillProfileAutoCompleteSearch.prototype = {
*/
getInputDetails() {
// TODO: Maybe we'll need to wait for cache ready if detail is empty.
return FormAutofillContent.getInputDetails(formFillController.getFocusedInput());
return FormAutofillContent.getInputDetails(formFillController.focusedInput);
},
/**
@ -302,7 +302,7 @@ AutofillProfileAutoCompleteSearch.prototype = {
*/
getFormDetails() {
// TODO: Maybe we'll need to wait for cache ready if details is empty.
return FormAutofillContent.getFormDetails(formFillController.getFocusedInput());
return FormAutofillContent.getFormDetails(formFillController.focusedInput);
},
};

View File

@ -316,11 +316,9 @@ nsFormFillController::MarkAsAutofillField(nsIDOMHTMLInputElement *aInput)
}
NS_IMETHODIMP
nsFormFillController::GetFocusedInput(nsIDOMHTMLInputElement** aRetVal) {
if (!aRetVal) {
return NS_ERROR_INVALID_POINTER;
}
*aRetVal = mFocusedInput;
nsFormFillController::GetFocusedInput(nsIDOMHTMLInputElement **aInput) {
*aInput = mFocusedInput;
NS_IF_ADDREF(*aInput);
return NS_OK;
}

View File

@ -20,6 +20,11 @@ interface nsIDOMHTMLInputElement;
[scriptable, uuid(07f0a0dc-f6e9-4cdd-a55f-56d770523a4c)]
interface nsIFormFillController : nsISupports
{
/*
* The input element the form fill controller is currently bound to.
*/
readonly attribute nsIDOMHTMLInputElement focusedInput;
/*
* Start controlling form fill behavior for the given browser
*
@ -51,11 +56,4 @@ interface nsIFormFillController : nsISupports
* @param aInput - The HTML <input> element to mark
*/
void markAsAutofillField(in nsIDOMHTMLInputElement aInput);
/**
* Return the focused input which is cached in form fill controller.
*
* @returns The focused input.
*/
nsIDOMHTMLInputElement getFocusedInput();
};