From 7e75b9408eb0cec301961fac290f3dc471700556 Mon Sep 17 00:00:00 2001 From: Cosmin Sabou Date: Mon, 21 Oct 2019 19:06:02 +0300 Subject: [PATCH] Backed out changeset 004bfb67bff4 (bug 1584524) for browser chrome failures on browser_noLoginsView.js. --HG-- extra : rebase_source : aed78db5e647745c606224f7ff2ed226312bf5e5 --- .../aboutlogins/AboutLoginsChild.jsm | 11 +- .../aboutlogins/AboutLoginsParent.jsm | 4 - .../aboutlogins/content/aboutLogins.html | 3 - .../content/components/login-intro.js | 19 --- .../tests/browser/browser_noLoginsView.js | 128 +++++++----------- .../tests/browser/browser_openImport.js | 4 - .../aboutlogins/tests/browser/head.js | 5 - browser/locales/en-US/browser/aboutLogins.ftl | 1 - 8 files changed, 52 insertions(+), 123 deletions(-) diff --git a/browser/components/aboutlogins/AboutLoginsChild.jsm b/browser/components/aboutlogins/AboutLoginsChild.jsm index 82d2cf46dd39..9b36211c11d3 100644 --- a/browser/components/aboutlogins/AboutLoginsChild.jsm +++ b/browser/components/aboutlogins/AboutLoginsChild.jsm @@ -231,14 +231,11 @@ class AboutLoginsChild extends ActorChild { this.sendToContent("SetBreaches", message.data); break; case "AboutLogins:Setup": - let waivedContent = Cu.waiveXrays(this.content); - waivedContent.AboutLoginsUtils.masterPasswordEnabled = - message.data.masterPasswordEnabled; - waivedContent.AboutLoginsUtils.passwordRevealVisible = - message.data.passwordRevealVisible; - waivedContent.AboutLoginsUtils.importVisible = - message.data.importVisible; this.sendToContent("Setup", message.data); + Cu.waiveXrays(this.content).AboutLoginsUtils.masterPasswordEnabled = + message.data.masterPasswordEnabled; + Cu.waiveXrays(this.content).AboutLoginsUtils.passwordRevealVisible = + message.data.passwordRevealVisible; break; case "AboutLogins:ShowLoginItemError": this.sendToContent("ShowLoginItemError", message.data); diff --git a/browser/components/aboutlogins/AboutLoginsParent.jsm b/browser/components/aboutlogins/AboutLoginsParent.jsm index 04c9e45b9fef..67a20d225ea2 100644 --- a/browser/components/aboutlogins/AboutLoginsParent.jsm +++ b/browser/components/aboutlogins/AboutLoginsParent.jsm @@ -11,7 +11,6 @@ const { XPCOMUtils } = ChromeUtils.import( ); XPCOMUtils.defineLazyModuleGetters(this, { - AppConstants: "resource://gre/modules/AppConstants.jsm", E10SUtils: "resource://gre/modules/E10SUtils.jsm", LoginBreaches: "resource:///modules/LoginBreaches.jsm", LoginHelper: "resource://gre/modules/LoginHelper.jsm", @@ -423,9 +422,6 @@ var AboutLoginsParent = { passwordRevealVisible: Services.policies.isAllowed( "passwordReveal" ), - importVisible: - Services.policies.isAllowed("profileImport") && - AppConstants.platform != "linux", }); await this._sendAllLoginRelatedObjects(logins, messageManager); diff --git a/browser/components/aboutlogins/content/aboutLogins.html b/browser/components/aboutlogins/content/aboutLogins.html index a2ed64d69a54..741b570e8c36 100644 --- a/browser/components/aboutlogins/content/aboutLogins.html +++ b/browser/components/aboutlogins/content/aboutLogins.html @@ -140,9 +140,6 @@ - diff --git a/browser/components/aboutlogins/content/components/login-intro.js b/browser/components/aboutlogins/content/components/login-intro.js index 9c4665dfb82a..83ccd76ed36e 100644 --- a/browser/components/aboutlogins/content/components/login-intro.js +++ b/browser/components/aboutlogins/content/components/login-intro.js @@ -12,9 +12,6 @@ export default class LoginIntro extends HTMLElement { let shadowRoot = this.attachShadow({ mode: "open" }); document.l10n.connectRoot(shadowRoot); shadowRoot.appendChild(loginIntroTemplate.content.cloneNode(true)); - - this._importText = shadowRoot.querySelector(".intro-import-text"); - this._importText.addEventListener("click", this); } focus() { @@ -22,20 +19,6 @@ export default class LoginIntro extends HTMLElement { helpLink.focus(); } - handleEvent(event) { - if ( - event.currentTarget.classList.contains("intro-import-text") && - event.target.localName == "a" - ) { - document.dispatchEvent( - new CustomEvent("AboutLoginsImport", { - bubbles: true, - }) - ); - } - event.preventDefault(); - } - set supportURL(val) { this.shadowRoot.querySelector(".intro-help-link").setAttribute("href", val); } @@ -52,8 +35,6 @@ export default class LoginIntro extends HTMLElement { this.shadowRoot .querySelector(".illustration") .classList.toggle("logged-in", syncState.loggedIn); - - this._importText.hidden = !window.AboutLoginsUtils.importVisible; } } customElements.define("login-intro", LoginIntro); diff --git a/browser/components/aboutlogins/tests/browser/browser_noLoginsView.js b/browser/components/aboutlogins/tests/browser/browser_noLoginsView.js index e6af50c413ba..ddd5c5ac17c9 100644 --- a/browser/components/aboutlogins/tests/browser/browser_noLoginsView.js +++ b/browser/components/aboutlogins/tests/browser/browser_noLoginsView.js @@ -12,92 +12,60 @@ add_task(async function setup() { }); add_task(async function test_no_logins_class() { - let platform = { AppConstants }; - await ContentTask.spawn( - gBrowser.selectedBrowser, - platform, - async aPlatform => { - let loginList = content.document.querySelector("login-list"); + await ContentTask.spawn(gBrowser.selectedBrowser, null, async () => { + let loginList = content.document.querySelector("login-list"); - ok( - content.document.documentElement.classList.contains("no-logins"), - "root should be in no logins view" - ); - ok( - loginList.classList.contains("no-logins"), - "login-list should be in no logins view" - ); + ok( + content.document.documentElement.classList.contains("no-logins"), + "root should be in no logins view" + ); + ok( + loginList.classList.contains("no-logins"), + "login-list should be in no logins view" + ); - let loginIntro = Cu.waiveXrays( - content.document.querySelector("login-intro") - ); - let loginItem = content.document.querySelector("login-item"); - let loginListIntro = loginList.shadowRoot.querySelector(".intro"); - let loginListList = loginList.shadowRoot.querySelector("ol"); + let loginIntro = Cu.waiveXrays( + content.document.querySelector("login-intro") + ); + let loginItem = content.document.querySelector("login-item"); + let loginListIntro = loginList.shadowRoot.querySelector(".intro"); + let loginListList = loginList.shadowRoot.querySelector("ol"); - ok( - !ContentTaskUtils.is_hidden(loginIntro), - "login-intro should be shown in no logins view" - ); - ok( - !ContentTaskUtils.is_hidden(loginListIntro), - "login-list intro should be shown in no logins view" - ); + ok( + !ContentTaskUtils.is_hidden(loginIntro), + "login-intro should be shown in no logins view" + ); + ok( + !ContentTaskUtils.is_hidden(loginListIntro), + "login-list intro should be shown in no logins view" + ); - ok( - ContentTaskUtils.is_hidden(loginItem), - "login-item should be hidden in no logins view" - ); - ok( - ContentTaskUtils.is_hidden(loginListList), - "login-list logins list should be hidden in no logins view" - ); - is( - content.document.l10n.getAttributes( - loginIntro.shadowRoot.querySelector(".heading") - ).id, - "login-intro-heading", - "The default message should be the non-logged-in message" - ); + ok( + ContentTaskUtils.is_hidden(loginItem), + "login-item should be hidden in no logins view" + ); + ok( + ContentTaskUtils.is_hidden(loginListList), + "login-list logins list should be hidden in no logins view" + ); + is( + content.document.l10n.getAttributes( + loginIntro.shadowRoot.querySelector(".heading") + ).id, + "login-intro-heading", + "The default message should be the non-logged-in message" + ); - loginIntro.updateState(Cu.cloneInto({ loggedIn: true }, content)); + loginIntro.updateState(Cu.cloneInto({ loggedIn: true }, content)); - is( - content.document.l10n.getAttributes( - loginIntro.shadowRoot.querySelector(".heading") - ).id, - "about-logins-login-intro-heading-logged-in", - "When logged in the message should update" - ); - - is( - ContentTaskUtils.is_hidden( - loginIntro.shadowRoot.querySelector(".intro-import-text") - ), - aPlatform == "linux", - "the import link should be hidden on Linux builds" - ); - if (aPlatform == "linux") { - // End the test now for Linux since the link is hidden. - return; - } - loginIntro.shadowRoot.querySelector(".intro-import-text > a").click(); - info("waiting for MigrationWizard to open"); - } - ); - if (AppConstants.platform == "linux") { - // End the test now for Linux since the link is hidden. - return; - } - await TestUtils.waitForCondition( - () => Services.wm.getMostRecentWindow("Browser:MigrationWizard"), - "Migrator window opened" - ); - let migratorWindow = Services.wm.getMostRecentWindow( - "Browser:MigrationWizard" - ); - ok(migratorWindow, "Migrator window opened"); - await BrowserTestUtils.closeWindow(migratorWindow); + is( + content.document.l10n.getAttributes( + loginIntro.shadowRoot.querySelector(".heading") + ).id, + "about-logins-login-intro-heading-logged-in", + "When logged in the message should update" + ); + }); }); add_task( diff --git a/browser/components/aboutlogins/tests/browser/browser_openImport.js b/browser/components/aboutlogins/tests/browser/browser_openImport.js index 33e91743526e..53d170d7e39d 100644 --- a/browser/components/aboutlogins/tests/browser/browser_openImport.js +++ b/browser/components/aboutlogins/tests/browser/browser_openImport.js @@ -42,10 +42,6 @@ add_task(async function test_open_import() { info("waiting for Import to get opened"); let importWindow = await promiseImportWindow; ok(true, "Import opened"); - await TestUtils.waitForCondition( - () => importWindow.document.readyState == "complete", - "waiting for Import to fully load before closing it so observers will be correctly removed" - ); importWindow.close(); }); diff --git a/browser/components/aboutlogins/tests/browser/head.js b/browser/components/aboutlogins/tests/browser/head.js index fff270aa51c0..dbf5c1543586 100644 --- a/browser/components/aboutlogins/tests/browser/head.js +++ b/browser/components/aboutlogins/tests/browser/head.js @@ -107,11 +107,6 @@ add_task(async function setup() { // Ignore error messages for no profile found in old XULStore.jsm return; } - if (msg.errorMessage.includes("Error reading typed URL history")) { - // The Migrator when opened can log this exception if there is no Edge - // history on the machine. - return; - } if (msg.errorMessage.includes(EXPECTED_ERROR_MESSAGE)) { return; } diff --git a/browser/locales/en-US/browser/aboutLogins.ftl b/browser/locales/en-US/browser/aboutLogins.ftl index 8e2ef6a536dd..fb991f702b0c 100644 --- a/browser/locales/en-US/browser/aboutLogins.ftl +++ b/browser/locales/en-US/browser/aboutLogins.ftl @@ -70,7 +70,6 @@ login-intro-description = If you saved your logins to { -brand-product-name } on login-intro-instruction-fxa = Create or sign in to your { -fxaccount-brand-name } on the device where your logins are saved login-intro-instruction-fxa-settings = Make sure you’ve selected the Logins checkbox in { -sync-brand-short-name } Settings about-logins-intro-instruction-help = Visit { -lockwise-brand-short-name } Support for more help -about-logins-intro-import = If your logins are saved in another browser, you can import them into { -lockwise-brand-short-name } ## Login