Backed out changeset 03a739869466 (bug 1568226) for browser chrome failures on browser_urlbar_event_telemetry.js

This commit is contained in:
Cosmin Sabou 2019-07-25 21:26:27 +03:00
Родитель 55eaae4de3
Коммит 3886a83206
5 изменённых файлов: 18 добавлений и 62 удалений

Просмотреть файл

@ -182,7 +182,7 @@ var AboutProtectionsHandler = {
*/
async getMonitorData() {
let monitorData = {};
let potentiallyBreachedLogins = null;
let potentiallyBreachedLogins = 0;
const hasFxa = await fxAccounts.accountStatus();
if (hasFxa) {
@ -214,14 +214,11 @@ var AboutProtectionsHandler = {
}
}
// Get the stats for number of potentially breached Lockwise passwords if no master
// password is set.
if (!LoginHelper.isMasterPasswordSet()) {
const logins = await LoginHelper.getAllUserFacingLogins();
potentiallyBreachedLogins = await LoginHelper.getBreachesForLogins(
logins
);
}
// Get the stats for number of potentially breached Lockwise passwords
const logins = await LoginHelper.getAllUserFacingLogins();
potentiallyBreachedLogins = await LoginHelper.getBreachesForLogins(
logins
);
} else {
// If no account exists, then the user is not logged in with an fxAccount.
monitorData = {
@ -231,9 +228,7 @@ var AboutProtectionsHandler = {
return {
...monitorData,
potentiallyBreachedLogins: potentiallyBreachedLogins
? potentiallyBreachedLogins.size
: 0,
potentiallyBreachedLogins: potentiallyBreachedLogins.size,
error: !!monitorData.errorMessage,
};
},

Просмотреть файл

@ -77,24 +77,14 @@ export default class MonitorClass {
const exposedPasswords = this.doc.querySelector(
"span[data-type='exposed-passwords']"
);
const exposedLockwisePasswords = this.doc.querySelector(
"span[data-type='breached-lockwise-passwords']"
);
storedEmail.textContent = monitorData.monitoredEmails;
knownBreaches.textContent = monitorData.numBreaches;
exposedPasswords.textContent = monitorData.passwords;
// Display Lockwise section if there are any potential breached logins to report.
if (monitorData.potentiallyBreachedLogins > 0) {
const lockwiseSection = this.doc.querySelector(
".monitor-breached-passwords"
);
const exposedLockwisePasswords = this.doc.querySelector(
"span[data-type='breached-lockwise-passwords']"
);
exposedLockwisePasswords.textContent =
monitorData.potentiallyBreachedLogins;
lockwiseSection.classList.remove("hidden");
}
exposedLockwisePasswords.textContent =
monitorData.potentiallyBreachedLogins;
}
}

Просмотреть файл

@ -77,8 +77,7 @@ a.hidden,
.monitor-card.no-logins .card-body,
.monitor-card.no-logins #monitor-header-content a,
.monitor-card.no-logins .inline-text-icon.monitor-scanned-text,
.monitor-card.has-logins #sign-up-for-monitor-button,
#monitor-body-content .monitor-breached-passwords.hidden {
.monitor-card.has-logins #sign-up-for-monitor-button {
display: none;
}

Просмотреть файл

@ -137,7 +137,7 @@
<span>View full report on</span>
<a href="">Firefox Monitor</a>
</div>
<div class="monitor-breached-passwords hidden">
<div class="monitor-breached-passwords">
<span data-type="breached-lockwise-passwords" class="number-of-breaches block">
<!-- Display number of exposed stored passwords here. -->
</span>

Просмотреть файл

@ -7,6 +7,7 @@
const { AboutProtectionsHandler } = ChromeUtils.import(
"resource:///modules/aboutpages/AboutProtectionsHandler.jsm"
);
const nsLoginInfo = new Components.Constructor(
"@mozilla.org/login-manager/loginInfo;1",
Ci.nsILoginInfo,
@ -39,8 +40,8 @@ let fakeDataWithError = {
error: true,
};
// Modify AboutProtectionsHandler's getMonitorData method to fake returning data from the
// Monitor endpoint.
// Modify AboutProtectionsHandler's getMonitorData method to fake returning a specified
// number of devices.
const mockGetMonitorData = data => async () => data;
// Modify AboutProtectionsHandler's getLoginData method to fake being logged in with Fxa.
@ -121,35 +122,6 @@ add_task(async function() {
);
});
info("Make sure Lockwise section is hidden if no passwords are returned.");
const noBreachedLoginsData = {
...fakeDataWithNoError,
potentiallyBreachedLogins: 0,
};
AboutProtectionsHandler.getMonitorData = mockGetMonitorData(
noBreachedLoginsData
);
await reloadTab(tab);
await ContentTask.spawn(tab.linkedBrowser, {}, async function() {
await ContentTaskUtils.waitForCondition(() => {
const noLogins = content.document.querySelector(
".monitor-card.has-logins"
);
return ContentTaskUtils.is_visible(noLogins);
}, "Monitor card for user with stored logins is shown.");
const lockwiseSection = content.document.querySelector(
".monitor-breached-passwords"
);
ok(
ContentTaskUtils.is_hidden(lockwiseSection),
"Lockwise section is hidden."
);
});
info(
"Check that correct content is displayed when monitor data contains an error message."
);
@ -174,7 +146,7 @@ add_task(async function() {
}, "Monitor card is not enabled.");
const monitorCard = content.document.querySelector(".monitor-card");
ok(ContentTaskUtils.is_hidden(monitorCard), "Monitor card is hidden.");
ok(ContentTaskUtils.is_hidden(monitorCard), "Lockwise card is hidden.");
});
// set the pref back to displaying the card.