Bug 1341569 - Part 2: Send form started time and set probes in FormAutofillParent. r?MattN
MozReview-Commit-ID: 7Kj7BZQmaAa
--- a/browser/extensions/formautofill/FormAutofillContent.jsm
+++ b/browser/extensions/formautofill/FormAutofillContent.jsm
@@ -333,18 +333,18 @@ var FormAutofillContent = {
* Send the profile to parent for doorhanger and storage saving/updating.
*
* @param {Object} profile Submitted form's address/creditcard guid and record.
* @param {Object} domWin Current content window.
* @param {int} timeStartedFillingMS Time of form filling started.
*/
_onFormSubmit(profile, domWin, timeStartedFillingMS) {
let mm = this._messageManagerFromWindow(domWin);
- mm.sendAsyncMessage("FormAutofill:OnFormSubmit", profile);
- // TODO: Send handler.timeStartedFillingMS to parent for recording time
+ mm.sendAsyncMessage("FormAutofill:OnFormSubmit",
+ {profile, timeStartedFillingMS});
},
/**
* Handle earlyformsubmit event and early return when:
* 1. In private browsing mode.
* 2. Could not map any autofill handler by form element.
* 3. Number of filled fields is less than autofill threshold
*
--- a/browser/extensions/formautofill/FormAutofillParent.jsm
+++ b/browser/extensions/formautofill/FormAutofillParent.jsm
@@ -271,20 +271,23 @@ FormAutofillParent.prototype = {
});
Services.ppmm.broadcastAsyncMessage("FormAutofill:savedFieldNames",
Services.ppmm.initialProcessData.autofillSavedFieldNames);
this._updateStatus();
},
_onFormSubmit(data, target) {
- let {address} = data;
+ let {profile, timeStartedFillingMS} = data;
+ let {address} = profile;
if (address.guid) {
if (!this.profileStorage.addresses.mergeIfPossible(address.guid, address.record)) {
+ this._setFillFormTimeProbe("address", "autofill-update", timeStartedFillingMS);
+
FormAutofillDoorhanger.show(target, "update").then((state) => {
let changedGUIDs = this.profileStorage.addresses.mergeToStorage(address.record);
switch (state) {
case "create":
if (!changedGUIDs.length) {
changedGUIDs.push(this.profileStorage.addresses.add(address.record));
}
break;
@@ -296,23 +299,25 @@ FormAutofillParent.prototype = {
this.profileStorage.addresses.remove(address.guid);
}
break;
}
changedGUIDs.forEach(guid => this.profileStorage.addresses.notifyUsed(guid));
});
return;
}
+ this._setFillFormTimeProbe("address", "autofill", timeStartedFillingMS);
this.profileStorage.addresses.notifyUsed(address.guid);
} else {
let changedGUIDs = this.profileStorage.addresses.mergeToStorage(address.record);
if (!changedGUIDs.length) {
changedGUIDs.push(this.profileStorage.addresses.add(address.record));
}
changedGUIDs.forEach(guid => this.profileStorage.addresses.notifyUsed(guid));
+ this._setFillFormTimeProbe("address", "manual", timeStartedFillingMS);
// Show first time use doorhanger
if (Services.prefs.getBoolPref("extensions.formautofill.firstTimeUse")) {
Services.prefs.setBoolPref("extensions.formautofill.firstTimeUse", false);
FormAutofillDoorhanger.show(target, "firstTimeUse").then((state) => {
if (state !== "open-pref") {
return;
}