Backed out changeset f8d8b15ccc84 (bug 1559418) for ESlint failure. CLOSED TREE

This commit is contained in:
Dorel Luca 2019-07-09 20:39:26 +03:00
Родитель b290fc08af
Коммит 4cb5b6e3c9
13 изменённых файлов: 18 добавлений и 451 удалений

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

До

Ширина:  |  Высота:  |  Размер: 5.6 KiB

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

@ -19,7 +19,6 @@ browser.jar:
content/browser/illustrations/error-malformed-url.svg (content/illustrations/error-malformed-url.svg)
content/browser/illustrations/under-construction.svg (content/illustrations/under-construction.svg)
content/browser/illustrations/blue-berror.svg (content/illustrations/blue-berror.svg)
content/browser/logos/lockwise.svg (content/logos/lockwise.svg)
content/browser/aboutNetError.xhtml (content/aboutNetError.xhtml)
content/browser/aboutNetError.js (content/aboutNetError.js)
content/browser/aboutRobots-icon.png (content/aboutRobots-icon.png)

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

@ -9,19 +9,12 @@ var EXPORTED_SYMBOLS = ["AboutProtectionsHandler"];
const { RemotePages } = ChromeUtils.import(
"resource://gre/modules/remotepagemanager/RemotePageManagerParent.jsm"
);
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var AboutProtectionsHandler = {
_inited: false,
_topics: [
"openContentBlockingPreferences",
"OpenAboutLogins",
"OpenSyncPreferences",
"FetchUserLoginsData",
],
_topics: ["openContentBlockingPreferences"],
init() {
this.receiveMessage = this.receiveMessage.bind(this);
this.pageListener = new RemotePages("about:protections");
for (let topic of this._topics) {
this.pageListener.addMessageListener(topic, this.receiveMessage);
@ -39,25 +32,6 @@ var AboutProtectionsHandler = {
this.pageListener.destroy();
},
/**
* Retrieves login data for the user.
*
* @return {{ isLoggedIn: Boolean,
* numberOfLogins: Number,
* numberOfSyncedDevices: Number }}
* The login data.
*/
getLoginData() {
const logins = Services.logins.countLogins("", "", "");
const isLoggedIn = logins > 0;
return {
isLoggedIn,
numberOfLogins: logins,
numberOfSyncedDevices: 0,
};
},
receiveMessage(aMessage) {
let win = aMessage.target.browser.ownerGlobal;
switch (aMessage.name) {
@ -66,18 +40,6 @@ var AboutProtectionsHandler = {
origin: "about-protections",
});
break;
case "OpenAboutLogins":
win.openTrustedLinkIn("about:logins", "tab");
break;
case "OpenSyncPreferences":
win.openTrustedLinkIn("about:preferences#sync", "tab");
break;
case "FetchUserLoginsData":
aMessage.target.sendAsyncMessage(
"SendUserLoginsData",
this.getLoginData()
);
break;
}
},
};

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

@ -1,7 +0,0 @@
"use strict";
module.exports = {
parserOptions: {
sourceType: "module",
},
};

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

@ -1,106 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
/* eslint-env mozilla/frame-script */
export default class LockwiseCard {
constructor(document) {
this.doc = document;
}
/**
* Initializes message listeners/senders.
*/
init() {
const openAboutLoginsButton = this.doc.getElementById(
"open-about-logins-button"
);
openAboutLoginsButton.addEventListener("click", () => {
RPMSendAsyncMessage("OpenAboutLogins");
});
const syncLink = this.doc.querySelector(".synced-devices-text a");
// Register a click handler for the anchor since it's not possible to navigate to about:preferences via href
syncLink.addEventListener("click", () => {
RPMSendAsyncMessage("OpenSyncPreferences");
});
RPMAddMessageListener("SendUserLoginsData", ({ data }) => {
// Once browser data for the user is retrieved, display it on the card's body
// section.
this.buildContent(data);
});
// Dispatch messages to retrieve data for the Lockwise card.
RPMSendAsyncMessage("FetchUserLoginsData");
}
buildContent(data) {
const { isLoggedIn, numberOfLogins, numberOfSyncedDevices } = data;
const title = this.doc.getElementById("lockwise-title");
const headerContent = this.doc.getElementById("lockwise-header-content");
const lockwiseBodyContent = this.doc.getElementById(
"lockwise-body-content"
);
// Get the container for the content to display.
const container = isLoggedIn
? lockwiseBodyContent.querySelector(".has-logins")
: lockwiseBodyContent.querySelector(".no-logins");
// Display the content
container.classList.remove("hidden");
if (isLoggedIn) {
title.textContent = "Firefox Lockwise";
headerContent.textContent =
"Securely store and sync your passwords to all your devices.";
this.renderContentForLoggedInUser(
container,
numberOfLogins,
numberOfSyncedDevices
);
} else {
title.textContent = "Never forget a password again";
headerContent.textContent =
"Firefox Lockwise securely stores your passwords in your browser.";
}
}
/**
* Displays the number of stored logins and synced devices for a user.
*
* @param {Element} container
* The containing element for the content.
* @param {Number} storedLogins
* The number of browser-stored logins.
* @param {Number} syncedDevices
* The number of synced devices.
*/
renderContentForLoggedInUser(container, storedLogins, syncedDevices) {
// Set the text for number of stored logins.
const numberOfLoginsBlock = container.querySelector(
".number-of-logins.block"
);
numberOfLoginsBlock.textContent = storedLogins;
// Set the text for the number of synced devices.
const syncedDevicesBlock = container.querySelector(
".number-of-synced-devices.block"
);
syncedDevicesBlock.textContent = syncedDevices;
const syncedDevicesText = container.querySelector(".synced-devices-text");
const textEl = syncedDevicesText.querySelector("span");
textEl.textContent =
syncedDevices > 0
? `Syncing to ${syncedDevices} other devices.`
: "Not syncing to other devices.";
// Display the link for enabling sync if no synced devices are detected.
if (syncedDevices === 0) {
const syncLink = syncedDevicesText.querySelector("a");
syncLink.classList.remove("hidden");
}
}
}

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

@ -15,29 +15,13 @@
--crossSite-color-darker: #0073C3;
--tracker-color: #2AC3A2;
--tracker-color-darker: #229C82;
--orange: #FFBD4F;
--dark-orange: #ffA40C;
--grey: #AFAFBB;
--dark-grey: #88889A;
--fingerprinter-color: #FFBD4F;
--fingerprinter-color-darker: #ffA40C;
--cryptominer-color: #AFAFBB;
--cryptominer-color-darker: #88889A;
--tab-highlight: var(--social-color); /* start with social selected */
--blue-60: #0060DF;
--blue-70: #003eaa;
--blue-80: #002275;
}
a {
color: var(--blue-60);
text-decoration: none;
}
a:active {
color: var(--blue-70);
}
a:hover, a:active {
text-decoration: underline;
}
body {
background-color: var(--report-background);
font: message-box;
@ -57,11 +41,11 @@ body[focuseddatatype=tracker] {
}
body[focuseddatatype=fingerprinter] {
--tab-highlight: var(--orange);
--tab-highlight: var(--fingerprinter-color);
}
body[focuseddatatype=cryptominer] {
--tab-highlight: var(--grey);
--tab-highlight: var(--cryptominer-color);
}
#report-title {
@ -75,46 +59,14 @@ body[focuseddatatype=cryptominer] {
margin: 0 auto;
}
.card-header button {
font-size: 0.95rem;
background-color: var(--blue-60);
border-radius: 2px;
border: none;
color: #FFFFFF;
cursor: pointer;
margin-inline-end: 15px;
margin-inline-start: 15px;
padding: 10px;
align-self: center;
}
.card-header button:hover {
background-color: var(--blue-70);
}
.card-header button:active {
background-color: var(--blue-80);
}
.report-card.lockwise-card .card-header {
grid-template-columns: 2fr 6fr 7fr;
}
.icon {
.etp-card .icon {
width: 60px;
height: 60px;
background: url("chrome://browser/skin/controlcenter/tracking-protection.svg") no-repeat center/cover;
grid-column: 1;
margin: 0 auto;
}
.etp-card .icon {
background: url("chrome://browser/skin/controlcenter/tracking-protection.svg") no-repeat center/cover;
}
.lockwise-card .icon {
background: url("chrome://browser/content/logos/lockwise.svg") no-repeat center/cover;
}
.report-card {
display: grid;
grid-template-columns: 100%;
@ -122,7 +74,6 @@ body[focuseddatatype=cryptominer] {
border-radius: 3px;
background-color: var(--card-background);
box-shadow: var(--card-box-shadow);
margin-bottom: 25px;
}
.report-card .card-header,
@ -238,19 +189,19 @@ body[focuseddatatype=cryptominer] {
}
.fingerprinter-bar {
background-color: var(--orange);
background-color: var(--fingerprinter-color);
}
.hover-fingerprinter .fingerprinter-bar {
background-color: var(--dark-orange);
background-color: var(--fingerprinter-color-darker);
}
.cryptominer-bar {
background-color: var(--grey);
background-color: var(--cryptominer-color);
}
.hover-cryptominer .cryptominer-bar {
background-color: var(--dark-grey);
background-color: var(--cryptominer-color-darker);
}
.column-label {
@ -295,14 +246,14 @@ label[data-type="tracker"] {
label[data-type="fingerprinter"] {
background-image: url(chrome://browser/skin/controlcenter/fingerprinters.svg);
fill: var(--orange);
color: var(--orange);
fill: var(--fingerprinter-color);
color: var(--fingerprinter-color);
}
label[data-type="cryptominer"] {
background-image: url(chrome://browser/skin/controlcenter/cryptominers.svg);
fill: var(--grey);
color: var(--grey);
fill: var(--cryptominer-color);
color: var(--cryptominer-color);
}
.hover-social label[for="tab-social"],
@ -345,62 +296,3 @@ label:hover {
#tab-cryptominer:checked ~ #cryptominer {
display: block;
}
/* Lockwise Card */
#lockwise-body-content > .no-logins,
#lockwise-body-content > .has-logins {
display: grid;
grid: 1fr 1fr / minmax(70px, auto) 1fr;
font-size: 0.875rem;
grid-gap: 10px;
align-items: center;
}
a.hidden,
#lockwise-body-content .has-logins.hidden,
#lockwise-body-content .no-logins.hidden {
display: none;
}
.number-of-logins {
background-color: var(--dark-grey);
}
.number-of-synced-devices {
background-color: var(--orange);
}
.lockwise-text-icon {
background-size: 16px 16px;
background-repeat: no-repeat;
background-position-x: 3px;
background-position-y: 5px;
padding: 4px 4px 4px 24px;
display: inline;
}
.passwords-stored-text {
background-image: url("chrome://browser/skin/login.svg");
}
.synced-devices-text {
background-image: url("chrome://browser/skin/sync.svg");
}
.non-logged-in-user-content {
grid-column: 2;
}
.block {
border-radius: 4px;
text-align: center;
font-size: 1.125rem;
color: var(--card-background);
padding: 7px;
line-height: 18px;
}
.has-logins a {
margin-inline-start: 10px;
}

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

@ -10,7 +10,7 @@
<link rel="stylesheet" type="text/css"
href="chrome://browser/content/protections.css">
<link rel="icon" href="chrome://global/skin/icons/warning.svg">
<script type="module" src="chrome://browser/content/protections.js"></script>
<script type="text/javascript" src="chrome://browser/content/protections.js"></script>
<title>Protection Report</title>
</head>
@ -83,50 +83,6 @@
</div>
</div>
</div>
<!-- Markup for Lockwise card. -->
<section class="report-card lockwise-card">
<div class="card-header">
<div class="icon"></div>
<div class="wrapper">
<h3 id="lockwise-title" class="card-title">
<!-- Insert Lockwise card title here. -->
</h3>
<p id="lockwise-header-content" class="content">
<!-- Insert Lockwise header content here. -->
</p>
</div>
<button id="open-about-logins-button">Open in Firefox</button>
</div>
<div class="card-body">
<div id="lockwise-body-content" class="body-wrapper">
<div class="no-logins hidden">
<span>
Get the <a target="_blank" href="https://lockwise.firefox.com/">Firefox Lockwise</a>
app to take your passwords everywhere.
</span>
</div>
<div class="has-logins hidden">
<span class="number-of-logins block">
<!-- Display number of stored logins here. -->
</span>
<span class="lockwise-text-icon passwords-stored-text">
Passwords stored securely.
<a href="">How it works</a>
</span>
<span class="number-of-synced-devices block">
<!-- Display number of synced devices here. -->
</span>
<span class="lockwise-text-icon synced-devices-text">
<span>
<!-- Display message for status of synced devices here. -->
</span>
<a class="hidden" href="" title="Go to sync preferences">Turn on sync…</a>
</span>
</div>
</div>
</div>
</div>
</section>
</div>
</body>
</html>

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

@ -4,8 +4,6 @@
/* eslint-env mozilla/frame-script */
import LockwiseCard from "./lockwise-card.js";
document.addEventListener("DOMContentLoaded", e => {
let dataTypes = [
"cryptominer",
@ -145,11 +143,6 @@ document.addEventListener("DOMContentLoaded", e => {
});
}
};
createGraph();
addListeners();
// Create the Lockwise card.
const lockwiseCard = new LockwiseCard(document);
lockwiseCard.init();
});

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

@ -3,7 +3,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
browser.jar:
content/browser/lockwise-card.js (content/lockwise-card.js)
content/browser/protections.css (content/protections.css)
content/browser/protections.html (content/protections.html)
content/browser/protections.js (content/protections.js)

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

@ -5,7 +5,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
JAR_MANIFESTS += ['jar.mn']
BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini']
with Files('**'):
BUG_COMPONENT = ('Firefox', 'Tracking Protection')

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

@ -1,6 +0,0 @@
[DEFAULT]
tags = protections
support-files =
head.js
[browser_protections_lockwise.js]

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

@ -1,102 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
"use strict";
const nsLoginInfo = new Components.Constructor(
"@mozilla.org/login-manager/loginInfo;1",
Ci.nsILoginInfo,
"init"
);
const TEST_LOGIN1 = new nsLoginInfo(
"https://example.com/",
"https://example.com/",
null,
"user1",
"pass1",
"username",
"password"
);
const TEST_LOGIN2 = new nsLoginInfo(
"https://2.example.com/",
"https://2.example.com/",
null,
"user2",
"pass2",
"username",
"password"
);
add_task(async function() {
let tab = await BrowserTestUtils.openNewForegroundTab({
url: "about:protections",
gBrowser,
});
info("Check that the correct content is displayed for non-logged in users.");
await ContentTask.spawn(tab.linkedBrowser, {}, function() {
const noLoginsContent = content.document.querySelector(
"#lockwise-body-content .no-logins"
);
const hasLoginsContent = content.document.querySelector(
"#lockwise-body-content .has-logins"
);
ok(
ContentTaskUtils.is_visible(noLoginsContent),
"Content for user with no logins is shown."
);
ok(
ContentTaskUtils.is_hidden(hasLoginsContent),
"Content for user with logins is hidden."
);
});
info("Add a login and check that content for a logged in user is displayed.");
Services.logins.addLogin(TEST_LOGIN1);
await reloadTab(tab);
await ContentTask.spawn(tab.linkedBrowser, {}, function() {
const noLoginsContent = content.document.querySelector(
"#lockwise-body-content .no-logins"
);
const hasLoginsContent = content.document.querySelector(
"#lockwise-body-content .has-logins"
);
const numberOfLogins = hasLoginsContent.querySelector(
".number-of-logins.block"
);
ok(
ContentTaskUtils.is_hidden(noLoginsContent),
"Content for user with no logins is hidden."
);
ok(
ContentTaskUtils.is_visible(hasLoginsContent),
"Content for user with logins is shown."
);
is(numberOfLogins.textContent, 1, "One stored login should be displayed");
});
info(
"Add another login and check the number of stored logins is updated after reload."
);
Services.logins.addLogin(TEST_LOGIN2);
await reloadTab(tab);
await ContentTask.spawn(tab.linkedBrowser, {}, function() {
const numberOfLogins = content.document.querySelector(
"#lockwise-body-content .has-logins .number-of-logins.block"
);
is(numberOfLogins.textContent, 2, "Two stored logins should be displayed");
});
// remove logins
Services.logins.removeLogin(TEST_LOGIN1);
Services.logins.removeLogin(TEST_LOGIN2);
await BrowserTestUtils.removeTab(tab);
});

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

@ -1,11 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
"use strict";
async function reloadTab(tab) {
const tabReloaded = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
gBrowser.reloadTab(tab);
await tabReloaded;
}