Bug 1549115 - Assign telemetry object names for copy-to-clipboard buttons. r=sfoster

Differential Revision: https://phabricator.services.mozilla.com/D33222

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jared Wein 2019-06-10 20:43:17 +00:00
Родитель a34597dc00
Коммит 4af125de15
3 изменённых файлов: 9 добавлений и 10 удалений

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

@ -106,14 +106,16 @@
<span class="username-label field-label"></span>
<modal-input name="username"/>
</label>
<copy-to-clipboard-button class="copy-username-button"></copy-to-clipboard-button>
<copy-to-clipboard-button class="copy-username-button"
data-telemetry-object="username"></copy-to-clipboard-button>
</div>
<div class="detail-row">
<label>
<span class="password-label field-label"></span>
<modal-input type="password" name="password" required />
</label>
<copy-to-clipboard-button class="copy-password-button"></copy-to-clipboard-button>
<copy-to-clipboard-button class="copy-password-button"
data-telemetry-object="password"></copy-to-clipboard-button>
</div>
<p class="time-created meta-info"></p>
<p class="time-changed meta-info"></p>

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

@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import {recordTelemetryEvent} from "chrome://browser/content/aboutlogins/aboutLoginsUtils.js";
import ReflectedFluentElement from "chrome://browser/content/aboutlogins/components/reflected-fluent-element.js";
export default class CopyToClipboardButton extends ReflectedFluentElement {
@ -60,6 +61,10 @@ export default class CopyToClipboardButton extends ReflectedFluentElement {
this.removeAttribute("copied");
}, CopyToClipboardButton.BUTTON_RESET_TIMEOUT);
}, () => copyButton.disabled = false);
if (this.dataset.telemetryObject) {
recordTelemetryEvent({object: this.dataset.telemetryObject, method: "copy"});
}
}
set relatedInput(val) {

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

@ -24,8 +24,6 @@ export default class LoginItem extends ReflectedFluentElement {
this.reflectFluentStrings();
for (let selector of [
".copy-password-button",
".copy-username-button",
".delete-button",
".edit-button",
".open-site-button",
@ -154,12 +152,6 @@ export default class LoginItem extends ReflectedFluentElement {
});
return;
}
if (event.target.classList.contains("copy-password-button")) {
return;
}
if (event.target.classList.contains("copy-username-button")) {
return;
}
if (event.target.classList.contains("delete-button")) {
document.dispatchEvent(new CustomEvent("AboutLoginsDeleteLogin", {
bubbles: true,