Bug 1378313 - Fix up bogus code showing the reload button as enabled when it's disabled. r=johannh

Bug 1376893's approach is wrong in various ways:

- It shows the reload button as enabled for about:blank

- The disabled state styling is implemented in browser/themes/shared/toolbarbuttons.inc.css, and could be implemented differently. browser/base/content/browser.css should not depend on theme specifics.

- :not(:-moz-window-inactive) only begins to make sense on Mac, and obviously prevents the fix from taking effect in inactive windows

MozReview-Commit-ID: CaBLYFKwPgh

--HG--
extra : rebase_source : a9279e74a2a95779ff58e1ace484cbc45cfbe8c6
This commit is contained in:
Dão Gottwald 2017-07-06 11:07:08 +02:00
Родитель e7f547e34c
Коммит 920860b1f3
3 изменённых файлов: 8 добавлений и 12 удалений

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

@ -474,12 +474,10 @@ toolbar:not(#TabsToolbar) > #personal-bookmarks {
visibility: collapse;
}
/* The reload-button is only disabled temporarily when it becomes visible
to prevent users from accidentally clicking it. We don't however need
to show this disabled state, as the flicker that it generates is short
enough to be visible but not long enough to explain anything to users. */
#reload-button[disabled]:not(:-moz-window-inactive) > .toolbarbutton-icon {
opacity: 1 !important;
/* Temporarily disable the reload button to prevent the user from
accidentally reloading the page when intending to click the stop button. */
#reload-button[temporarily-disabled] {
pointer-events: none;
}
#PanelUI-feeds > .feed-toolbarbutton:-moz-locale-dir(rtl) {

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

@ -4968,11 +4968,10 @@ var CombinedStopReload = {
// Temporarily disable the reload button to prevent the user from
// accidentally reloading the page when intending to click the stop button
this.reload.disabled = true;
this.reload.setAttribute("temporarily-disabled", "true");
this._timer = setTimeout(function(self) {
self._timer = 0;
self.reload.disabled = XULBrowserWindow.reloadCommand
.getAttribute("disabled") == "true";
self.reload.removeAttribute("temporarily-disabled");
}, 650, this);
},

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

@ -105,9 +105,8 @@ add_task(async function test_reloadButton() {
"https://example.com" + DIRECTORY_PATH +
"formless_basic.html");
await BrowserTestUtils.waitForCondition(() => {
return reloadButton.disabled == false;
});
await BrowserTestUtils.waitForCondition(() =>
!reloadButton.disabled && !reloadButton.hasAttribute("temporarily-disabled"));
EventUtils.synthesizeMouseAtCenter(reloadButton, {});
await loadPromise;
});