зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1378668 - [Form Autofill] Update the saved field names when a profile is updated, merged or reconciled. r=steveck
MozReview-Commit-ID: 5aLqvr0n0KO --HG-- extra : rebase_source : 2e6d529d1091f7d51c7cae4d761aa270853bec38
This commit is contained in:
Родитель
c4e7d0a39e
Коммит
971e68a344
|
@ -117,8 +117,8 @@ FormAutofillParent.prototype = {
|
|||
}
|
||||
|
||||
case "formautofill-storage-changed": {
|
||||
// Early exit if the action is not "add" nor "remove"
|
||||
if (data != "add" && data != "remove") {
|
||||
// Early exit if only metadata is changed
|
||||
if (data == "notifyUsed") {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,22 +47,18 @@ add_task(async function test_activeStatus_observe() {
|
|||
formAutofillParent.observe(null, "nsPref:changed", "extensions.formautofill.addresses.enabled");
|
||||
do_check_eq(formAutofillParent._onStatusChanged.called, true);
|
||||
|
||||
// profile added => Need to trigger _onStatusChanged
|
||||
formAutofillParent._computeStatus.returns(!formAutofillParent._active);
|
||||
formAutofillParent._onStatusChanged.reset();
|
||||
formAutofillParent.observe(null, "formautofill-storage-changed", "add");
|
||||
do_check_eq(formAutofillParent._onStatusChanged.called, true);
|
||||
// profile changed => Need to trigger _onStatusChanged
|
||||
["add", "update", "remove", "reconcile", "merge"].forEach(event => {
|
||||
formAutofillParent._computeStatus.returns(!formAutofillParent._active);
|
||||
formAutofillParent._onStatusChanged.reset();
|
||||
formAutofillParent.observe(null, "formautofill-storage-changed", event);
|
||||
do_check_eq(formAutofillParent._onStatusChanged.called, true);
|
||||
});
|
||||
|
||||
// profile removed => Need to trigger _onStatusChanged
|
||||
// profile metadata updated => No need to trigger _onStatusChanged
|
||||
formAutofillParent._computeStatus.returns(!formAutofillParent._active);
|
||||
formAutofillParent._onStatusChanged.reset();
|
||||
formAutofillParent.observe(null, "formautofill-storage-changed", "remove");
|
||||
do_check_eq(formAutofillParent._onStatusChanged.called, true);
|
||||
|
||||
// profile updated => no need to trigger _onStatusChanged
|
||||
formAutofillParent._computeStatus.returns(!formAutofillParent._active);
|
||||
formAutofillParent._onStatusChanged.reset();
|
||||
formAutofillParent.observe(null, "formautofill-storage-changed", "update");
|
||||
formAutofillParent.observe(null, "formautofill-storage-changed", "notifyUsed");
|
||||
do_check_eq(formAutofillParent._onStatusChanged.called, false);
|
||||
});
|
||||
|
||||
|
|
|
@ -24,18 +24,15 @@ add_task(async function test_profileSavedFieldNames_observe() {
|
|||
|
||||
await formAutofillParent.init();
|
||||
|
||||
// profile added => Need to trigger updateValidFields
|
||||
formAutofillParent.observe(null, "formautofill-storage-changed", "add");
|
||||
do_check_eq(formAutofillParent._updateSavedFieldNames.called, true);
|
||||
// profile changed => Need to trigger updateValidFields
|
||||
["add", "update", "remove", "reconcile", "merge"].forEach(event => {
|
||||
formAutofillParent.observe(null, "formautofill-storage-changed", "add");
|
||||
do_check_eq(formAutofillParent._updateSavedFieldNames.called, true);
|
||||
});
|
||||
|
||||
// profile removed => Need to trigger updateValidFields
|
||||
// profile metadata updated => no need to trigger updateValidFields
|
||||
formAutofillParent._updateSavedFieldNames.reset();
|
||||
formAutofillParent.observe(null, "formautofill-storage-changed", "remove");
|
||||
do_check_eq(formAutofillParent._updateSavedFieldNames.called, true);
|
||||
|
||||
// profile updated => no need to trigger updateValidFields
|
||||
formAutofillParent._updateSavedFieldNames.reset();
|
||||
formAutofillParent.observe(null, "formautofill-storage-changed", "update");
|
||||
formAutofillParent.observe(null, "formautofill-storage-changed", "notifyUsed");
|
||||
do_check_eq(formAutofillParent._updateSavedFieldNames.called, false);
|
||||
});
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче