зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1747893 - Fix credit cards not syncing correctly once disabled on subsequent startup. r=sgalich
Depends on D135076 Differential Revision: https://phabricator.services.mozilla.com/D137673
This commit is contained in:
Родитель
a887c814a4
Коммит
631334fa35
|
@ -862,29 +862,3 @@ add_task(async function test_creditCardFillDisabled() {
|
|||
true
|
||||
);
|
||||
});
|
||||
|
||||
add_task(async function test_creditCardFillUnavailable() {
|
||||
Services.prefs.setCharPref(
|
||||
"extensions.formautofill.creditCards.supported",
|
||||
"off"
|
||||
);
|
||||
|
||||
let path = getTempFile(TEST_STORE_FILE_NAME).path;
|
||||
let profileStorage = new FormAutofillStorage(path);
|
||||
await profileStorage.initialize();
|
||||
|
||||
try {
|
||||
profileStorage.creditCards; // eslint-disable-line no-unused-expressions
|
||||
throw new Error("Access credit card didn't throw.");
|
||||
} catch (err) {
|
||||
Assert.equal(
|
||||
err.message,
|
||||
"CreditCards is not initialized. " +
|
||||
"Please restart if you flip the pref manually."
|
||||
);
|
||||
}
|
||||
|
||||
Services.prefs.clearUserPref(
|
||||
"extensions.formautofill.creditCards.availability"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1997,21 +1997,10 @@ class FormAutofillStorageBase {
|
|||
if (!this._initializePromise) {
|
||||
this._store = this._initializeStore();
|
||||
this._initializePromise = this._store.load().then(() => {
|
||||
let initializeAutofillRecords = [this.addresses.initialize()];
|
||||
if (FormAutofill.isAutofillCreditCardsAvailable) {
|
||||
initializeAutofillRecords.push(this.creditCards.initialize());
|
||||
} else {
|
||||
// Make creditCards records unavailable to other modules
|
||||
// because we never initialize it.
|
||||
Object.defineProperty(this, "creditCards", {
|
||||
get() {
|
||||
throw new Error(
|
||||
"CreditCards is not initialized. " +
|
||||
"Please restart if you flip the pref manually."
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
let initializeAutofillRecords = [
|
||||
this.addresses.initialize(),
|
||||
this.creditCards.initialize(),
|
||||
];
|
||||
return Promise.all(initializeAutofillRecords);
|
||||
});
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче