Backed out 2 changesets (bug 1550137) for perma-failing bug 1553196 on a CLOSED TREE

Backed out changeset e6cc0fd6e665 (bug 1550137)
Backed out changeset 4c8faa218f64 (bug 1550137)
This commit is contained in:
Andreea Pavel 2019-06-12 20:43:06 +03:00
parent 1adae3f54d
commit af8aab10a0
12 changed files with 21 additions and 114 deletions

View File

@ -87,7 +87,6 @@ let LEGACY_ACTORS = {
events: {
"AboutLoginsCreateLogin": {wantUntrusted: true},
"AboutLoginsDeleteLogin": {wantUntrusted: true},
"AboutLoginsImport": {wantUntrusted: true},
"AboutLoginsInit": {wantUntrusted: true},
"AboutLoginsOpenPreferences": {wantUntrusted: true},
"AboutLoginsOpenSite": {wantUntrusted: true},
@ -584,7 +583,6 @@ const listeners = {
mm: {
"AboutLogins:CreateLogin": ["AboutLoginsParent"],
"AboutLogins:DeleteLogin": ["AboutLoginsParent"],
"AboutLogins:Import": ["AboutLoginsParent"],
"AboutLogins:OpenPreferences": ["AboutLoginsParent"],
"AboutLogins:OpenSite": ["AboutLoginsParent"],
"AboutLogins:Subscribe": ["AboutLoginsParent"],

View File

@ -20,8 +20,7 @@ class AboutLoginsChild extends ActorChild {
case "AboutLoginsInit": {
this.mm.sendAsyncMessage("AboutLogins:Subscribe");
let document = this.content.document;
let documentElement = document.documentElement;
let documentElement = this.content.document.documentElement;
documentElement.classList.toggle("official-branding", AppConstants.MOZILLA_OFFICIAL);
let waivedContent = Cu.waiveXrays(this.content);
@ -43,10 +42,6 @@ class AboutLoginsChild extends ActorChild {
this.mm.sendAsyncMessage("AboutLogins:DeleteLogin", {login: event.detail});
break;
}
case "AboutLoginsImport": {
this.mm.sendAsyncMessage("AboutLogins:Import");
break;
}
case "AboutLoginsOpenPreferences": {
this.mm.sendAsyncMessage("AboutLogins:OpenPreferences");
break;

View File

@ -13,8 +13,6 @@ ChromeUtils.defineModuleGetter(this, "Localization",
"resource://gre/modules/Localization.jsm");
ChromeUtils.defineModuleGetter(this, "LoginHelper",
"resource://gre/modules/LoginHelper.jsm");
ChromeUtils.defineModuleGetter(this, "MigrationUtils",
"resource:///modules/MigrationUtils.jsm");
ChromeUtils.defineModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
@ -91,15 +89,6 @@ var AboutLoginsParent = {
Services.logins.removeLogin(login);
break;
}
case "AboutLogins:Import": {
try {
MigrationUtils.showMigrationWizard(message.target.ownerGlobal,
[MigrationUtils.MIGRATION_ENTRYPOINT_PASSWORDS]);
} catch (ex) {
Cu.reportError(ex);
}
break;
}
case "AboutLogins:OpenPreferences": {
message.target.ownerGlobal.openPreferences("privacy-logins");
break;

View File

@ -59,7 +59,6 @@ master-password-reload-button-accesskey = L
menu-button =
.button-title = Open menu
.menuitem-import = Import Passwords…
.menuitem-preferences =
{ PLATFORM() ->
[windows] Options

View File

@ -28,7 +28,6 @@
<button id="create-login-button" data-l10n-id="create-login-button"></button>
<menu-button data-l10n-id="menu-button"
data-l10n-attrs="button-title,
menuitem-import,
menuitem-preferences"></menu-button>
</header>
<login-list data-l10n-id="login-list"
@ -138,13 +137,8 @@
<link rel="stylesheet" href="chrome://browser/content/aboutlogins/common.css">
<link rel="stylesheet" href="chrome://browser/content/aboutlogins/components/menu-button.css">
<button class="menu-button alternate-button"></button>
<ul class="menu" role="menu" hidden>
<li role="menuitem" class="menuitem windows-only">
<button class="menuitem-button menuitem-import alternate-button" data-event-name="AboutLoginsImport"></button>
</li>
<li role="menuitem" class="menuitem">
<button class="menuitem-button menuitem-preferences alternate-button" data-event-name="AboutLoginsOpenPreferences"></button>
</li>
<ul class="menu" role="menu" aria-hidden="true">
<li role="menuitem" class="menuitem"><button class="menuitem-button menuitem-preferences alternate-button"></button></li>
</ul>
</template>

View File

@ -25,9 +25,6 @@ document.addEventListener("DOMContentLoaded", () => {
recordTelemetryEvent({object: "new_login", method: "new"});
});
let menuButton = document.querySelector("menu-button");
menuButton.classList.add(navigator.platform);
document.dispatchEvent(new CustomEvent("AboutLoginsInit", {bubbles: true}));
}, {once: true});

View File

@ -18,6 +18,10 @@
margin-inline-end: 0;
}
.menu[aria-hidden="true"] {
display: none;
}
.menu {
position: absolute;
top: 30px;
@ -37,10 +41,6 @@
left: 0;
}
.menuitem {
display: flex;
}
.menuitem-button {
padding: 4px 8px;
/* 32px = 8px (padding) + 16px (icon) + 8px (padding) */
@ -52,22 +52,12 @@
border-radius: 0;
/* Override common.inc.css box-shadow on these buttons */
box-shadow: none !important;
flex-grow: 1;
text-align: start;
}
.menuitem-button:dir(rtl) {
background-position: right 8px center;
}
.menuitem-import {
background-image: url("chrome://browser/skin/save.svg");
}
.menuitem-preferences {
background-image: url("chrome://browser/skin/settings.svg");
}
:host(:not(.Win32)) .windows-only {
display: none;
}

View File

@ -20,11 +20,7 @@ export default class MenuButton extends ReflectedFluentElement {
}
static get reflectedFluentIDs() {
return [
"button-title",
"menuitem-import",
"menuitem-preferences",
];
return ["button-title", "menuitem-preferences"];
}
static get observedAttributes() {
@ -50,15 +46,12 @@ export default class MenuButton extends ReflectedFluentElement {
event.originalTarget == this.shadowRoot.querySelector(".menu-button")) {
return;
}
let classList = event.originalTarget.classList;
if (classList.contains("menuitem-import") ||
classList.contains("menuitem-preferences")) {
let eventName = event.originalTarget.dataset.eventName;
document.dispatchEvent(new CustomEvent(eventName, {
if (event.originalTarget.classList.contains("menuitem-preferences")) {
document.dispatchEvent(new CustomEvent("AboutLoginsOpenPreferences", {
bubbles: true,
}));
this.hideMenu();
break;
return;
}
this.toggleMenu();
break;
@ -67,7 +60,7 @@ export default class MenuButton extends ReflectedFluentElement {
}
toggleMenu() {
let wasHidden = this.shadowRoot.querySelector(".menu").hidden;
let wasHidden = this.shadowRoot.querySelector(".menu").getAttribute("aria-hidden") == "true";
if (wasHidden) {
this.showMenu();
} else {
@ -76,12 +69,12 @@ export default class MenuButton extends ReflectedFluentElement {
}
hideMenu() {
this.shadowRoot.querySelector(".menu").hidden = true;
this.shadowRoot.querySelector(".menu").setAttribute("aria-hidden", "true");
document.documentElement.removeEventListener("click", this, true);
}
showMenu() {
this.shadowRoot.querySelector(".menu").hidden = false;
this.shadowRoot.querySelector(".menu").setAttribute("aria-hidden", "false");
// Add a catch-all event listener to close the menu.
document.documentElement.addEventListener("click", this, true);

View File

@ -11,8 +11,6 @@ skip-if = asan || debug
[browser_loginListChanges.js]
[browser_masterPassword.js]
[browser_openFiltered.js]
[browser_openImport.js]
skip-if = (os != "win") # import is only available on Windows
[browser_openPreferences.js]
[browser_openSite.js]
[browser_updateLogin.js]

View File

@ -1,42 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
add_task(async function setup() {
let aboutLoginsTab = await BrowserTestUtils.openNewForegroundTab({gBrowser, url: "about:logins"});
registerCleanupFunction(() => {
BrowserTestUtils.removeTab(aboutLoginsTab);
});
});
add_task(async function test_open_import() {
let promiseImportWindow = BrowserTestUtils.domWindowOpened();
let browser = gBrowser.selectedBrowser;
await BrowserTestUtils.synthesizeMouseAtCenter("menu-button", {}, browser);
await ContentTask.spawn(browser, null, async () => {
return ContentTaskUtils.waitForCondition(() => {
let menuButton = Cu.waiveXrays(content.document.querySelector("menu-button"));
return !menuButton.shadowRoot
.querySelector(".menu")
.hidden;
}, "waiting for menu to open");
});
// Not using synthesizeMouseAtCenter here because the element we want clicked on
// is in the shadow DOM. BrowserTestUtils.synthesizeMouseAtCenter/AsyncUtilsContent
// thinks that the shadow DOM element is in another document and throws an exception
// when trying to call element.ownerGlobal on the targeted shadow DOM node. This is
// on file as bug 1557489. As a workaround, this manually calculates the position to click.
let {x, y} = await ContentTask.spawn(browser, null, async () => {
let menuButton = Cu.waiveXrays(content.document.querySelector("menu-button"));
let prefsItem = menuButton.shadowRoot.querySelector(".menuitem-import");
return prefsItem.getBoundingClientRect();
});
await BrowserTestUtils.synthesizeMouseAtPoint(x + 5, y + 5, {}, browser);
info("waiting for Import to get opened");
let importWindow = await promiseImportWindow;
ok(true, "Import opened");
importWindow.close();
});

View File

@ -16,9 +16,9 @@ add_task(async function test_open_preferences() {
await ContentTask.spawn(browser, null, async () => {
return ContentTaskUtils.waitForCondition(() => {
let menuButton = Cu.waiveXrays(content.document.querySelector("menu-button"));
return !menuButton.shadowRoot
.querySelector(".menu")
.hidden;
return menuButton.shadowRoot
.querySelector(".menu")
.getAttribute("aria-hidden") == "false";
}, "waiting for menu to open");
});

View File

@ -45,28 +45,24 @@ add_task(async function test_menu_open_close() {
is(document.activeElement, gMenuButton, "menu-button should be focused to start the test");
let menu = gMenuButton.shadowRoot.querySelector(".menu");
is(true, menu.hidden, "menu should be hidden before pressing 'space'");
is("true", menu.getAttribute("aria-hidden"), "menu should be hidden before pressing 'space'");
sendKey("SPACE");
await new Promise(resolve => requestAnimationFrame(resolve));
is(false, menu.hidden, "menu should be visible after pressing 'space'");
is("false", menu.getAttribute("aria-hidden"), "menu should be visible after pressing 'space'");
let preferencesItem = gMenuButton.shadowRoot.querySelector(".menuitem-preferences");
ok(!preferencesItem.matches(":focus"), ".menuitem-preferences should not be focused before tabbing to it");
// The Windows-only Import menuitem is only visible when the platform is set on gMenuButton,
// but the platform is set by aboutLogins.js and isn't run by this test, so the Import
// menuitem is always hidden when running this test. Thus, there only needs to be one Tab
// to move focus to the preferencesItem.
sendKey("TAB");
await SimpleTest.promiseWaitForCondition(() => preferencesItem.matches(":focus"),
"waiting for preferencesItem to get focus");
ok(preferencesItem.matches(":focus"), ".menuitem-preferences should be focused after tabbing to it");
let openPreferencesEvent = null;
is(false, menu.hidden, "menu should be visible before pressing 'space' on .menuitem-preferences");
is("false", menu.getAttribute("aria-hidden"), "menu should be visible before pressing 'space' on .menuitem-preferences");
window.addEventListener("AboutLoginsOpenPreferences", event => openPreferencesEvent = event);
sendKey("SPACE");
ok(openPreferencesEvent, "AboutLoginsOpenPreferences event should be dispatched after pressing 'space' on .menuitem-preferences");
is(true, menu.hidden, "menu should be hidden after pressing 'space' on .menuitem-preferences");
is("true", menu.getAttribute("aria-hidden"), "menu should be hidden after pressing 'space' on .menuitem-preferences");
});
</script>