зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1628165 - Add telemetry probe for clicks on vulnerable password learn more link. r=MattN
This also fixes a bug where we weren't recording the telemetry probe clicks on breached password learn more links due to the refactoring and renaming of the .alert-link class. A test has been added that would have caught that mistake in automation. Differential Revision: https://phabricator.services.mozilla.com/D70142
This commit is contained in:
Родитель
dd93d56fc0
Коммит
82aad27169
|
@ -96,7 +96,7 @@ export default class LoginItem extends HTMLElement {
|
|||
|
||||
this.render();
|
||||
|
||||
this._breachAlertLink.addEventListener("click", this);
|
||||
this._breachAlertLearnMoreLink.addEventListener("click", this);
|
||||
this._cancelButton.addEventListener("click", this);
|
||||
this._copyPasswordButton.addEventListener("click", this);
|
||||
this._copyUsernameButton.addEventListener("click", this);
|
||||
|
@ -110,6 +110,7 @@ export default class LoginItem extends HTMLElement {
|
|||
this._originInput.addEventListener("auxclick", this);
|
||||
this._originDisplayInput.addEventListener("click", this);
|
||||
this._revealCheckbox.addEventListener("click", this);
|
||||
this._vulnerableAlertLearnMoreLink.addEventListener("click", this);
|
||||
window.addEventListener("AboutLoginsInitialLoginSelected", this);
|
||||
window.addEventListener("AboutLoginsLoadInitialFavicon", this);
|
||||
window.addEventListener("AboutLoginsLoginSelected", this);
|
||||
|
@ -492,14 +493,17 @@ export default class LoginItem extends HTMLElement {
|
|||
if (classList.contains("origin-input")) {
|
||||
this._handleOriginClick();
|
||||
}
|
||||
if (classList.contains("alert-link")) {
|
||||
if (classList.contains("alert-learn-more-link")) {
|
||||
if (event.currentTarget.closest(".breach-alert")) {
|
||||
this._recordTelemetryEvent({
|
||||
object: "existing_login",
|
||||
method: "learn_more_breach",
|
||||
});
|
||||
} else if (event.currentTarget.closest(".vulnerable-alert")) {
|
||||
// TODO: Add telemetry event
|
||||
this._recordTelemetryEvent({
|
||||
object: "existing_login",
|
||||
method: "learn_more_vuln",
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -63,6 +63,29 @@ add_task(async function test_telemetry_events() {
|
|||
});
|
||||
await LoginTestUtils.telemetry.waitForEventCount(2);
|
||||
|
||||
// Need to change the learn-more to a local address for testing.
|
||||
const FAKE_LEARN_MORE_URL = "https://learn-more.example.com/";
|
||||
let promiseNewTab = BrowserTestUtils.waitForNewTab(
|
||||
gBrowser,
|
||||
FAKE_LEARN_MORE_URL
|
||||
);
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser,
|
||||
[FAKE_LEARN_MORE_URL],
|
||||
async function(fakeLearnMoreUrl) {
|
||||
let loginItem = content.document.querySelector("login-item");
|
||||
let learnMoreLink = loginItem.shadowRoot.querySelector(
|
||||
".alert-learn-more-link"
|
||||
);
|
||||
learnMoreLink.href = fakeLearnMoreUrl;
|
||||
learnMoreLink.click();
|
||||
}
|
||||
);
|
||||
let newTab = await promiseNewTab;
|
||||
ok(true, "New tab opened to " + FAKE_LEARN_MORE_URL);
|
||||
BrowserTestUtils.removeTab(newTab);
|
||||
await LoginTestUtils.telemetry.waitForEventCount(3);
|
||||
|
||||
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function() {
|
||||
let loginItem = content.document.querySelector("login-item");
|
||||
let copyButton = loginItem.shadowRoot.querySelector(
|
||||
|
@ -70,7 +93,7 @@ add_task(async function test_telemetry_events() {
|
|||
);
|
||||
copyButton.click();
|
||||
});
|
||||
await LoginTestUtils.telemetry.waitForEventCount(3);
|
||||
await LoginTestUtils.telemetry.waitForEventCount(4);
|
||||
|
||||
if (OSKeyStoreTestUtils.canTestOSKeyStoreLogin()) {
|
||||
let reauthObserved = OSKeyStoreTestUtils.waitForOSKeyStoreLogin(true);
|
||||
|
@ -85,13 +108,13 @@ add_task(async function test_telemetry_events() {
|
|||
// When reauth is observed an extra telemetry event will be recorded
|
||||
// for the reauth, hence the event count increasing by 2 here, and later
|
||||
// in the test as well.
|
||||
await LoginTestUtils.telemetry.waitForEventCount(5);
|
||||
await LoginTestUtils.telemetry.waitForEventCount(6);
|
||||
}
|
||||
let nextTelemetryEventCount = OSKeyStoreTestUtils.canTestOSKeyStoreLogin()
|
||||
? 6
|
||||
: 4;
|
||||
? 7
|
||||
: 5;
|
||||
|
||||
let promiseNewTab = BrowserTestUtils.waitForNewTab(
|
||||
promiseNewTab = BrowserTestUtils.waitForNewTab(
|
||||
gBrowser,
|
||||
TEST_LOGIN3.origin + "/"
|
||||
);
|
||||
|
@ -100,7 +123,7 @@ add_task(async function test_telemetry_events() {
|
|||
let originInput = loginItem.shadowRoot.querySelector(".origin-input");
|
||||
originInput.click();
|
||||
});
|
||||
let newTab = await promiseNewTab;
|
||||
newTab = await promiseNewTab;
|
||||
ok(true, "New tab opened to " + TEST_LOGIN3.origin);
|
||||
BrowserTestUtils.removeTab(newTab);
|
||||
await LoginTestUtils.telemetry.waitForEventCount(nextTelemetryEventCount++);
|
||||
|
@ -240,6 +263,14 @@ add_task(async function test_telemetry_events() {
|
|||
let expectedEvents = [
|
||||
[true, "pwmgr", "open_management", "direct"],
|
||||
[true, "pwmgr", "select", "existing_login", null, { breached: "true" }],
|
||||
[
|
||||
true,
|
||||
"pwmgr",
|
||||
"learn_more_breach",
|
||||
"existing_login",
|
||||
null,
|
||||
{ breached: "true" },
|
||||
],
|
||||
[true, "pwmgr", "copy", "username", null, { breached: "true" }],
|
||||
[testOSAuth, "pwmgr", "reauthenticate", "os_auth", "success"],
|
||||
[testOSAuth, "pwmgr", "copy", "password", null, { breached: "true" }],
|
||||
|
|
|
@ -654,6 +654,7 @@ pwmgr:
|
|||
"filter",
|
||||
"hide",
|
||||
"learn_more_breach",
|
||||
"learn_more_vuln",
|
||||
"new",
|
||||
"open_site",
|
||||
"save",
|
||||
|
@ -665,6 +666,7 @@ pwmgr:
|
|||
- 1548463
|
||||
- 1600958
|
||||
- 1549115
|
||||
- 1628165
|
||||
expiry_version: never
|
||||
notification_emails: ["loines@mozilla.com", "passwords-dev@mozilla.org", "jaws@mozilla.com"]
|
||||
release_channel_collection: opt-out
|
||||
|
|
Загрузка…
Ссылка в новой задаче