commit 788ef7442a830172407fe755f54d8ea82dc44c8d
parent 7f5f39e4ba09f94f6dc4aec14dc0fe3ed5980e2a
Author: iulian moraru <imoraru@mozilla.com>
Date: Tue, 11 Nov 2025 05:27:51 +0200
Revert "Bug 1995350 -[contextual-password-manager] Remove #enabled member on LoginDataSource. r=dimi" for causing xpcshell failures on test_loginDataSourceReloadDataSource.js.
This reverts commit ccb8ecc8bda75d14e63639af6ac4058d31c2ff86.
Diffstat:
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/toolkit/components/satchel/megalist/aggregator/datasources/LoginDataSource.sys.mjs b/toolkit/components/satchel/megalist/aggregator/datasources/LoginDataSource.sys.mjs
@@ -81,8 +81,8 @@ export class LoginDataSource extends DataSourceBase {
#originPrototype;
#usernamePrototype;
#passwordPrototype;
+ #enabled;
#header;
- #initialized;
#exportPasswordsStrings;
#displayMode;
@@ -364,7 +364,6 @@ export class LoginDataSource extends DataSourceBase {
this.#displayMode = DISPLAY_MODES.ALL;
this.#addObservers();
this.#reloadDataSource();
- this.#initialized = true;
});
}
@@ -791,13 +790,16 @@ export class LoginDataSource extends DataSourceBase {
* @param {string} searchText used to filter data
*/
*enumerateLines(searchText) {
- if (!this.#initialized) {
+ if (this.#enabled === undefined) {
// Async Fluent API makes it possible to have data source waiting
// for the localized strings, which can be detected by undefined in #enabled.
return;
}
yield this.#header;
+ if (this.#header.collapsed || !this.#enabled) {
+ return;
+ }
const stats = { count: 0, total: 0 };
searchText = searchText.toUpperCase();
@@ -820,6 +822,12 @@ export class LoginDataSource extends DataSourceBase {
*/
async #reloadDataSource() {
this.doneReloadDataSource = false;
+ this.#enabled = Services.prefs.getBoolPref("signon.rememberSignons");
+ if (!this.#enabled) {
+ this.#reloadEmptyDataSource();
+ this.doneReloadDataSource = true;
+ return;
+ }
const logins = await LoginHelper.getAllUserFacingLogins();
const breachesMap = lazy.BREACH_ALERTS_ENABLED
@@ -901,6 +909,14 @@ export class LoginDataSource extends DataSourceBase {
this.afterReloadingDataSource();
}
+ #reloadEmptyDataSource() {
+ this.lines.length = 0;
+ //todo: user can enable passwords by activating Passwords header line
+ this.#header.value.total = 0;
+ this.#header.value.alerts = 0;
+ this.refreshAllLinesOnScreen();
+ }
+
getAuthTimeoutMs() {
return AUTH_TIMEOUT_MS;
}