diff --git a/browser/base/content/logos/lockwise.svg b/browser/base/content/logos/lockwise.svg deleted file mode 100644 index c67709194fe6..000000000000 --- a/browser/base/content/logos/lockwise.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/browser/base/jar.mn b/browser/base/jar.mn index e97ef8d0f050..540f045777dd 100644 --- a/browser/base/jar.mn +++ b/browser/base/jar.mn @@ -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) diff --git a/browser/components/about/AboutProtectionsHandler.jsm b/browser/components/about/AboutProtectionsHandler.jsm index 82664bfa4c10..52d330dfeb0e 100644 --- a/browser/components/about/AboutProtectionsHandler.jsm +++ b/browser/components/about/AboutProtectionsHandler.jsm @@ -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; } }, }; diff --git a/browser/components/protections/.eslintrc.js b/browser/components/protections/.eslintrc.js deleted file mode 100644 index f811aa790b28..000000000000 --- a/browser/components/protections/.eslintrc.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -module.exports = { - parserOptions: { - sourceType: "module", - }, -}; diff --git a/browser/components/protections/content/lockwise-card.js b/browser/components/protections/content/lockwise-card.js deleted file mode 100644 index c4d49288a6f2..000000000000 --- a/browser/components/protections/content/lockwise-card.js +++ /dev/null @@ -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"); - } - } -} diff --git a/browser/components/protections/content/protections.css b/browser/components/protections/content/protections.css index a71bf81431c0..4929f8d391c0 100644 --- a/browser/components/protections/content/protections.css +++ b/browser/components/protections/content/protections.css @@ -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; -} diff --git a/browser/components/protections/content/protections.html b/browser/components/protections/content/protections.html index 21fe9e89bfb7..77f5b591fa8f 100644 --- a/browser/components/protections/content/protections.html +++ b/browser/components/protections/content/protections.html @@ -10,7 +10,7 @@ - + Protection Report @@ -83,50 +83,6 @@ - -
-
-
-
-

- -

-

- -

-
- -
-
-
- - -
-
- -
diff --git a/browser/components/protections/content/protections.js b/browser/components/protections/content/protections.js index 36634845e73c..60dd2445ea1d 100644 --- a/browser/components/protections/content/protections.js +++ b/browser/components/protections/content/protections.js @@ -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(); }); diff --git a/browser/components/protections/jar.mn b/browser/components/protections/jar.mn index 23f82693a6cb..dc0c285436ac 100644 --- a/browser/components/protections/jar.mn +++ b/browser/components/protections/jar.mn @@ -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) diff --git a/browser/components/protections/moz.build b/browser/components/protections/moz.build index 45197fc3edc3..f7c39a50c5d7 100644 --- a/browser/components/protections/moz.build +++ b/browser/components/protections/moz.build @@ -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') diff --git a/browser/components/protections/test/browser/browser.ini b/browser/components/protections/test/browser/browser.ini deleted file mode 100644 index 49ddadda6664..000000000000 --- a/browser/components/protections/test/browser/browser.ini +++ /dev/null @@ -1,6 +0,0 @@ -[DEFAULT] -tags = protections -support-files = - head.js - -[browser_protections_lockwise.js] diff --git a/browser/components/protections/test/browser/browser_protections_lockwise.js b/browser/components/protections/test/browser/browser_protections_lockwise.js deleted file mode 100644 index 7e91668df40e..000000000000 --- a/browser/components/protections/test/browser/browser_protections_lockwise.js +++ /dev/null @@ -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); -}); diff --git a/browser/components/protections/test/browser/head.js b/browser/components/protections/test/browser/head.js deleted file mode 100644 index ca0ba37269e2..000000000000 --- a/browser/components/protections/test/browser/head.js +++ /dev/null @@ -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; -}