mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 02:05:42 +00:00
Backed out changeset c7fc679c1c9e (bug 1340468
) for eslint failure
This commit is contained in:
parent
29a2a2194f
commit
651a0e4730
@ -163,7 +163,6 @@ let ProfileAutocomplete = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
|
||||
|
||||
_lastAutoCompleteResult: null,
|
||||
_lastAutoCompleteFocusedInput: null,
|
||||
_registered: false,
|
||||
_factory: null,
|
||||
|
||||
@ -197,7 +196,6 @@ let ProfileAutocomplete = {
|
||||
|
||||
setProfileAutoCompleteResult(result) {
|
||||
this._lastAutoCompleteResult = result;
|
||||
this._lastAutoCompleteFocusedInput = formFillController.focusedInput;
|
||||
},
|
||||
|
||||
observe(subject, topic, data) {
|
||||
@ -220,16 +218,6 @@ let ProfileAutocomplete = {
|
||||
.getInterface(Ci.nsIContentFrameMessageManager);
|
||||
},
|
||||
|
||||
_getSelectedIndex(contentWindow) {
|
||||
let mm = this._frameMMFromWindow(contentWindow);
|
||||
let selectedIndexResult = mm.sendSyncMessage("FormAutoComplete:GetSelectedIndex", {});
|
||||
if (selectedIndexResult.length != 1 || !Number.isInteger(selectedIndexResult[0])) {
|
||||
throw new Error("Invalid autocomplete selectedIndex");
|
||||
}
|
||||
|
||||
return selectedIndexResult[0];
|
||||
},
|
||||
|
||||
_fillFromAutocompleteRow(focusedInput) {
|
||||
this.log.debug("_fillFromAutocompleteRow:", focusedInput);
|
||||
let formDetails = FormAutofillContent.getFormDetails(focusedInput);
|
||||
@ -238,7 +226,13 @@ let ProfileAutocomplete = {
|
||||
return;
|
||||
}
|
||||
|
||||
let selectedIndex = this._getSelectedIndex(focusedInput.ownerGlobal);
|
||||
let mm = this._frameMMFromWindow(focusedInput.ownerGlobal);
|
||||
let selectedIndexResult = mm.sendSyncMessage("FormAutoComplete:GetSelectedIndex", {});
|
||||
if (selectedIndexResult.length != 1 || !Number.isInteger(selectedIndexResult[0])) {
|
||||
throw new Error("Invalid autocomplete selectedIndex");
|
||||
}
|
||||
let selectedIndex = selectedIndexResult[0];
|
||||
|
||||
if (selectedIndex == -1 ||
|
||||
!this._lastAutoCompleteResult ||
|
||||
this._lastAutoCompleteResult.getStyleAt(selectedIndex) != "autofill-profile") {
|
||||
@ -250,35 +244,6 @@ let ProfileAutocomplete = {
|
||||
|
||||
formHandler.autofillFormFields(profile, focusedInput);
|
||||
},
|
||||
|
||||
_clearProfilePreview() {
|
||||
let focusedInput = formFillController.focusedInput || this._lastAutoCompleteFocusedInput;
|
||||
if (!focusedInput || !FormAutofillContent.getFormDetails(focusedInput)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let formHandler = FormAutofillContent.getFormHandler(focusedInput);
|
||||
|
||||
formHandler.clearPreviewedFormFields();
|
||||
},
|
||||
|
||||
_previewSelectedProfile(selectedIndex) {
|
||||
let focusedInput = formFillController.focusedInput;
|
||||
if (!focusedInput || !FormAutofillContent.getFormDetails(focusedInput)) {
|
||||
// The observer notification is for a different process/frame.
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this._lastAutoCompleteResult ||
|
||||
this._lastAutoCompleteResult.getStyleAt(selectedIndex) != "autofill-profile") {
|
||||
return;
|
||||
}
|
||||
|
||||
let profile = JSON.parse(this._lastAutoCompleteResult.getCommentAt(selectedIndex));
|
||||
let formHandler = FormAutofillContent.getFormHandler(focusedInput);
|
||||
|
||||
formHandler.previewFormFields(profile);
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@ -418,16 +383,6 @@ var FormAutofillContent = {
|
||||
_markAsAutofillField(field) {
|
||||
formFillController.markAsAutofillField(field);
|
||||
},
|
||||
|
||||
_previewProfile(doc) {
|
||||
let selectedIndex = ProfileAutocomplete._getSelectedIndex(doc.ownerGlobal);
|
||||
|
||||
if (selectedIndex === -1) {
|
||||
ProfileAutocomplete._clearProfilePreview();
|
||||
} else {
|
||||
ProfileAutocomplete._previewSelectedProfile(selectedIndex);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
@ -124,37 +124,4 @@ FormAutofillHandler.prototype = {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Populates result to the preview layers with given profile.
|
||||
*
|
||||
* @param {Object} profile
|
||||
* A profile to be previewed with
|
||||
*/
|
||||
previewFormFields(profile) {
|
||||
log.debug("preview profile in autofillFormFields:", profile);
|
||||
for (let fieldDetail of this.fieldDetails) {
|
||||
let value = profile[fieldDetail.fieldName] || "";
|
||||
|
||||
// Skip the fields that already has text entered
|
||||
if (fieldDetail.element.value) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: Set highlight style and preview text.
|
||||
}
|
||||
},
|
||||
|
||||
clearPreviewedFormFields() {
|
||||
log.debug("clear previewed fields in:", this.form);
|
||||
for (let fieldDetail of this.fieldDetails) {
|
||||
// TODO: Clear preview text
|
||||
|
||||
// We keep the highlight of all fields if this form has
|
||||
// already been auto-filled with a profile.
|
||||
if (this.filledProfileGUID == null) {
|
||||
// TODO: Remove highlight style
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
@ -22,8 +22,6 @@ Cu.import("resource://formautofill/FormAutofillContent.jsm");
|
||||
var FormAutofillFrameScript = {
|
||||
init() {
|
||||
addEventListener("DOMContentLoaded", this);
|
||||
addMessageListener("FormAutofill:PreviewProfile", this);
|
||||
addMessageListener("FormAutoComplete:PopupClosed", this);
|
||||
},
|
||||
|
||||
handleEvent(evt) {
|
||||
@ -46,19 +44,6 @@ var FormAutofillFrameScript = {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
receiveMessage(aMessage) {
|
||||
if (!Services.prefs.getBoolPref("browser.formautofill.enabled")) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (aMessage.name) {
|
||||
case "FormAutofill:PreviewProfile":
|
||||
case "FormAutoComplete:PopupClosed":
|
||||
FormAutofillContent._previewProfile(content.document);
|
||||
break;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
FormAutofillFrameScript.init();
|
||||
|
@ -43,22 +43,6 @@
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<property name="selected" onget="return this.getAttribute('selected') == 'true';">
|
||||
<setter><![CDATA[
|
||||
if (val) {
|
||||
this.setAttribute("selected", "true");
|
||||
} else {
|
||||
this.removeAttribute("selected");
|
||||
}
|
||||
|
||||
let {AutoCompletePopup} = Cu.import("resource://gre/modules/AutoCompletePopup.jsm", {});
|
||||
|
||||
AutoCompletePopup.sendMessageToBrowser("FormAutofill:PreviewProfile");
|
||||
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<method name="_cleanup">
|
||||
<body>
|
||||
<![CDATA[
|
||||
@ -67,10 +51,6 @@
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_onChanged">
|
||||
<body></body>
|
||||
</method>
|
||||
|
||||
<method name="_onOverflow">
|
||||
<body></body>
|
||||
</method>
|
||||
|
Loading…
Reference in New Issue
Block a user