Backed out changeset 7e476d64cf93 (bug 1327946) for timeouts in browser_identityBlock_focus.js

This commit is contained in:
Carsten "Tomcat" Book 2017-01-26 11:45:35 +01:00
Родитель dd89b6966f
Коммит 7df5623c08
6 изменённых файлов: 6 добавлений и 79 удалений

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

@ -565,13 +565,8 @@ toolbar:not(#TabsToolbar) > #personal-bookmarks {
visibility: collapse;
}
#identity-box {
-moz-user-focus: normal;
}
#urlbar[pageproxystate="invalid"] > #identity-box {
pointer-events: none;
-moz-user-focus: ignore;
}
#identity-icon-labels {

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

@ -689,9 +689,13 @@
newlines="stripsurroundingwhitespace"
ontextentered="this.handleCommand(param);"
ontextreverted="return this.handleRevert();"
pageproxystate="invalid">
pageproxystate="invalid"
onfocus="document.getElementById('identity-box').style.MozUserFocus= 'normal'"
onblur="setTimeout(() => { document.getElementById('identity-box').style.MozUserFocus = ''; }, 0);">
<!-- Use onclick instead of normal popup= syntax since the popup
code fires onmousedown, and hence eats our favicon drag events. -->
code fires onmousedown, and hence eats our favicon drag events.
We only add the identity-box button to the tab order when the location bar
has focus, otherwise pressing F6 focuses it instead of the location bar -->
<box id="identity-box" role="button"
align="center"
aria-label="&urlbar.viewSiteInfo.label;"

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

@ -1,6 +0,0 @@
[DEFAULT]
support-files =
head.js
[browser_identityBlock_focus.js]
support-files = ../general/permissions.html

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

@ -1,59 +0,0 @@
/* Tests that the identity block can be reached via keyboard
* shortcuts and that it has the correct tab order.
*/
const TEST_PATH = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://example.com");
const PERMISSIONS_PAGE = TEST_PATH + "permissions.html";
function synthesizeKeyAndWaitForFocus(element, keyCode, options) {
let focused = BrowserTestUtils.waitForEvent(element, "focus");
EventUtils.synthesizeKey(keyCode, options);
return focused;
}
// Checks that the identity block is the next element after the urlbar
// to be focused if there are no active notification anchors.
add_task(function* testWithoutNotifications() {
yield BrowserTestUtils.withNewTab("https://example.com", function*() {
yield synthesizeKeyAndWaitForFocus(gURLBar, "l", {accelKey: true})
is(document.activeElement, gURLBar.inputField, "urlbar should be focused");
yield synthesizeKeyAndWaitForFocus(gIdentityHandler._identityBox, "VK_TAB", {shiftKey: true})
is(document.activeElement, gIdentityHandler._identityBox,
"identity block should be focused");
});
});
// Checks that when there is a notification anchor, it will receive
// focus before the identity block.
add_task(function* testWithoutNotifications() {
yield BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, function*(browser) {
let popupshown = BrowserTestUtils.waitForEvent(PopupNotifications.panel, "popupshown");
// Request a permission;
BrowserTestUtils.synthesizeMouseAtCenter("#geo", {}, browser);
yield popupshown;
yield synthesizeKeyAndWaitForFocus(gURLBar, "l", {accelKey: true})
is(document.activeElement, gURLBar.inputField, "urlbar should be focused");
let geoIcon = document.getElementById("geo-notification-icon");
yield synthesizeKeyAndWaitForFocus(geoIcon, "VK_TAB", {shiftKey: true})
is(document.activeElement, geoIcon, "notification anchor should be focused");
yield synthesizeKeyAndWaitForFocus(gIdentityHandler._identityBox, "VK_TAB", {shiftKey: true})
is(document.activeElement, gIdentityHandler._identityBox,
"identity block should be focused");
});
});
// Checks that with invalid pageproxystate the identity block is ignored.
add_task(function* testInvalidPageProxyState() {
yield BrowserTestUtils.withNewTab("about:blank", function*(browser) {
// Loading about:blank will automatically focus the urlbar, which, however, can
// race with the test code. So we add a call to focus() to be sure it's focused.
gURLBar.focus();
yield synthesizeKeyAndWaitForFocus(gBrowser.selectedTab, "VK_TAB", {shiftKey: true})
isnot(document.activeElement, gIdentityHandler._identityBox,
"identity block should not be focused");
// Restore focus to the url bar.
gURLBar.focus();
});
});

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

@ -1,6 +0,0 @@
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/Promise.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");

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

@ -22,7 +22,6 @@ BROWSER_CHROME_MANIFESTS += [
'content/test/plugins/browser.ini',
'content/test/popupNotifications/browser.ini',
'content/test/referrer/browser.ini',
'content/test/siteIdentity/browser.ini',
'content/test/social/browser.ini',
'content/test/tabcrashed/browser.ini',
'content/test/tabPrompts/browser.ini',