Bug 1759388 - Remove unused code in AboutLoiginsChild.jsm r=tgiles

Differential Revision: https://phabricator.services.mozilla.com/D140936
This commit is contained in:
Sergey Galich 2022-03-15 16:44:11 +00:00
Родитель bcb173fd6e
Коммит 7a177f085d
2 изменённых файлов: 47 добавлений и 70 удалений

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

@ -14,12 +14,6 @@ const { XPCOMUtils } = ChromeUtils.import(
);
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.defineModuleGetter(
this,
"AppConstants",
"resource://gre/modules/AppConstants.jsm"
);
XPCOMUtils.defineLazyServiceGetter(
this,
"ClipboardHelper",
@ -55,81 +49,75 @@ class AboutLoginsChild extends JSWindowActorChild {
handleEvent(event) {
switch (event.type) {
case "AboutLoginsInit": {
this.onAboutLoginsInit();
this.#aboutLoginsInit();
break;
}
case "AboutLoginsImportReportInit": {
this.onAboutLoginsImportReportInit();
this.#aboutLoginsImportReportInit();
break;
}
case "AboutLoginsCopyLoginDetail": {
this.onAboutLoginsCopyLoginDetail(event.detail);
this.#aboutLoginsCopyLoginDetail(event.detail);
break;
}
case "AboutLoginsCreateLogin": {
this.onAboutLoginsCreateLogin(event.detail);
this.#aboutLoginsCreateLogin(event.detail);
break;
}
case "AboutLoginsDeleteLogin": {
this.onAboutLoginsDeleteLogin(event.detail);
this.#aboutLoginsDeleteLogin(event.detail);
break;
}
case "AboutLoginsExportPasswords": {
this.onAboutLoginsExportPasswords();
this.#aboutLoginsExportPasswords();
break;
}
case "AboutLoginsGetHelp": {
this.onAboutLoginsGetHelp();
this.#aboutLoginsGetHelp();
break;
}
case "AboutLoginsImportFromBrowser": {
this.onAboutLoginsImportFromBrowser();
this.#aboutLoginsImportFromBrowser();
break;
}
case "AboutLoginsImportFromFile": {
this.onAboutLoginsImportFromFile();
this.#aboutLoginsImportFromFile();
break;
}
case "AboutLoginsOpenPreferences": {
this.onAboutLoginsOpenPreferences();
this.#aboutLoginsOpenPreferences();
break;
}
case "AboutLoginsRecordTelemetryEvent": {
this.onAboutLoginsRecordTelemetryEvent(event);
this.#aboutLoginsRecordTelemetryEvent(event);
break;
}
case "AboutLoginsRemoveAllLogins": {
this.onAboutLoginsRemoveAllLogins();
this.#aboutLoginsRemoveAllLogins();
break;
}
case "AboutLoginsSortChanged": {
this.onAboutLoginsSortChanged(event.detail);
this.#aboutLoginsSortChanged(event.detail);
break;
}
case "AboutLoginsSyncEnable": {
this.onAboutLoginsSyncEnable();
this.#aboutLoginsSyncEnable();
break;
}
case "AboutLoginsSyncOptions": {
this.onAboutLoginsSyncOptions();
this.#aboutLoginsSyncOptions();
break;
}
case "AboutLoginsUpdateLogin": {
this.onAboutLoginsUpdateLogin(event.detail);
this.#aboutLoginsUpdateLogin(event.detail);
break;
}
}
}
onAboutLoginsInit() {
#aboutLoginsInit() {
this.sendAsyncMessage("AboutLogins:Subscribe");
let documentElement = this.document.documentElement;
documentElement.classList.toggle(
"official-branding",
AppConstants.MOZILLA_OFFICIAL
);
let win = this.browsingContext.window;
let waivedContent = Cu.waiveXrays(win);
let that = this;
@ -175,40 +163,35 @@ class AboutLoginsChild extends JSWindowActorChild {
);
}
onAboutLoginsImportReportInit() {
#aboutLoginsImportReportInit() {
this.sendAsyncMessage("AboutLogins:ImportReportInit");
let documentElement = this.document.documentElement;
documentElement.classList.toggle(
"official-branding",
AppConstants.MOZILLA_OFFICIAL
);
}
onAboutLoginsCopyLoginDetail(detail) {
#aboutLoginsCopyLoginDetail(detail) {
ClipboardHelper.copyString(detail, ClipboardHelper.Sensitive);
}
onAboutLoginsCreateLogin(login) {
#aboutLoginsCreateLogin(login) {
this.sendAsyncMessage("AboutLogins:CreateLogin", {
login,
});
}
onAboutLoginsDeleteLogin(login) {
#aboutLoginsDeleteLogin(login) {
this.sendAsyncMessage("AboutLogins:DeleteLogin", {
login,
});
}
onAboutLoginsExportPasswords() {
#aboutLoginsExportPasswords() {
this.sendAsyncMessage("AboutLogins:ExportPasswords");
}
onAboutLoginsGetHelp() {
#aboutLoginsGetHelp() {
this.sendAsyncMessage("AboutLogins:GetHelp");
}
onAboutLoginsImportFromBrowser() {
#aboutLoginsImportFromBrowser() {
this.sendAsyncMessage("AboutLogins:ImportFromBrowser");
recordTelemetryEvent({
object: "import_from_browser",
@ -216,7 +199,7 @@ class AboutLoginsChild extends JSWindowActorChild {
});
}
onAboutLoginsImportFromFile() {
#aboutLoginsImportFromFile() {
this.sendAsyncMessage("AboutLogins:ImportFromFile");
recordTelemetryEvent({
object: "import_from_csv",
@ -224,7 +207,7 @@ class AboutLoginsChild extends JSWindowActorChild {
});
}
onAboutLoginsOpenPreferences() {
#aboutLoginsOpenPreferences() {
this.sendAsyncMessage("AboutLogins:OpenPreferences");
recordTelemetryEvent({
object: "preferences",
@ -232,7 +215,7 @@ class AboutLoginsChild extends JSWindowActorChild {
});
}
onAboutLoginsRecordTelemetryEvent(event) {
#aboutLoginsRecordTelemetryEvent(event) {
let { method } = event.detail;
if (method == "open_management") {
@ -256,23 +239,23 @@ class AboutLoginsChild extends JSWindowActorChild {
recordTelemetryEvent(event.detail);
}
onAboutLoginsRemoveAllLogins() {
#aboutLoginsRemoveAllLogins() {
this.sendAsyncMessage("AboutLogins:RemoveAllLogins");
}
onAboutLoginsSortChanged(detail) {
#aboutLoginsSortChanged(detail) {
this.sendAsyncMessage("AboutLogins:SortChanged", detail);
}
onAboutLoginsSyncEnable() {
#aboutLoginsSyncEnable() {
this.sendAsyncMessage("AboutLogins:SyncEnable");
}
onAboutLoginsSyncOptions() {
#aboutLoginsSyncOptions() {
this.sendAsyncMessage("AboutLogins:SyncOptions");
}
onAboutLoginsUpdateLogin(login) {
#aboutLoginsUpdateLogin(login) {
this.sendAsyncMessage("AboutLogins:UpdateLogin", {
login,
});
@ -281,51 +264,49 @@ class AboutLoginsChild extends JSWindowActorChild {
receiveMessage(message) {
switch (message.name) {
case "AboutLogins:ImportReportData":
this.onImportReportData(message.data);
this.#importReportData(message.data);
break;
case "AboutLogins:PrimaryPasswordResponse":
this.onPrimaryPasswordResponse(message.data);
this.#primaryPasswordResponse(message.data);
break;
case "AboutLogins:RemaskPassword":
this.onRemaskPassword(message.data);
this.#remaskPassword(message.data);
break;
case "AboutLogins:Setup":
this.onSetup(message.data);
this.#setup(message.data);
break;
default:
this.passMessageDataToContent(message);
this.#passMessageDataToContent(message);
}
}
onImportReportData(data) {
#importReportData(data) {
this.sendToContent("ImportReportData", data);
}
onPrimaryPasswordResponse(data) {
#primaryPasswordResponse(data) {
if (gPrimaryPasswordPromise) {
gPrimaryPasswordPromise.resolve(data.result);
recordTelemetryEvent(data.telemetryEvent);
}
}
onRemaskPassword(data) {
#remaskPassword(data) {
this.sendToContent("RemaskPassword", data);
}
onSetup(data) {
let waivedContent = Cu.waiveXrays(this.browsingContext.window);
waivedContent.AboutLoginsUtils.primaryPasswordEnabled =
data.primaryPasswordEnabled;
waivedContent.AboutLoginsUtils.passwordRevealVisible =
data.passwordRevealVisible;
waivedContent.AboutLoginsUtils.importVisible = data.importVisible;
waivedContent.AboutLoginsUtils.supportBaseURL = Services.urlFormatter.formatURLPref(
#setup(data) {
let utils = Cu.waiveXrays(this.browsingContext.window).AboutLoginsUtils;
utils.primaryPasswordEnabled = data.primaryPasswordEnabled;
utils.passwordRevealVisible = data.passwordRevealVisible;
utils.importVisible = data.importVisible;
utils.supportBaseURL = Services.urlFormatter.formatURLPref(
"app.support.baseURL"
);
this.sendToContent("Setup", data);
}
passMessageDataToContent(message) {
#passMessageDataToContent(message) {
this.sendToContent(message.name.replace("AboutLogins:", ""), message.data);
}

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

@ -69,10 +69,6 @@ login-item[data-editing="true"] + login-intro,
font-weight: 600;
}
:root:not(.official-branding) #branding-logo {
visibility: hidden;
}
:root:not(.primary-password-auth-required) #primary-password-required-overlay {
display: none;
}