mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1689372, simplify history panel r=mconley,fluent-reviewers,flod
Differential Revision: https://phabricator.services.mozilla.com/D103535
This commit is contained in:
parent
09539c4e2c
commit
5aa317ef1e
@ -1073,32 +1073,11 @@
|
||||
|
||||
<panelview id="PanelUI-history" flex="1">
|
||||
<vbox class="panel-subview-body">
|
||||
<toolbarbutton id="appMenuViewHistorySidebar"
|
||||
label="&appMenuHistory.viewSidebar.label;"
|
||||
label-checked="&appMenuHistory.hideSidebar.label;"
|
||||
label-unchecked="&appMenuHistory.viewSidebar.label;"
|
||||
type="checkbox"
|
||||
class="subviewbutton subviewbutton-iconic"
|
||||
key="key_gotoHistory"
|
||||
oncommand="SidebarUI.toggle('viewHistorySidebar');">
|
||||
<observes element="sidebar-box" attribute="positionend"/>
|
||||
</toolbarbutton>
|
||||
<toolbarbutton id="appMenuClearRecentHistory"
|
||||
label="&appMenuHistory.clearRecent.label;"
|
||||
class="subviewbutton subviewbutton-iconic"
|
||||
command="Tools:Sanitize"/>
|
||||
<toolbarseparator/>
|
||||
<toolbarbutton id="appMenuRecentlyClosedTabs"
|
||||
label="&historyUndoMenu.label;"
|
||||
class="subviewbutton subviewbutton-iconic subviewbutton-nav"
|
||||
closemenu="none"
|
||||
oncommand="PanelUI.showSubView('appMenu-library-recentlyClosedTabs', this)"/>
|
||||
<toolbarbutton id="appMenuRecentlyClosedWindows"
|
||||
label="&historyUndoWindowMenu.label;"
|
||||
class="subviewbutton subviewbutton-iconic subviewbutton-nav"
|
||||
closemenu="none"
|
||||
oncommand="PanelUI.showSubView('appMenu-library-recentlyClosedWindows', this)"/>
|
||||
<toolbarseparator/>
|
||||
<label value="&appMenuHistory.recentHistory.label;"
|
||||
class="subview-subheader"/>
|
||||
<toolbaritem id="appMenu_historyMenu"
|
||||
@ -1109,9 +1088,21 @@
|
||||
<!-- history menu items will go here -->
|
||||
</toolbaritem>
|
||||
</vbox>
|
||||
<toolbarseparator/>
|
||||
<toolbarbutton id="appMenuRecentlyClosedTabs"
|
||||
label="&historyUndoMenu.label;"
|
||||
class="subviewbutton subviewbutton-iconic subviewbutton-nav"
|
||||
closemenu="none"
|
||||
oncommand="PanelUI.showSubView('appMenu-library-recentlyClosedTabs', this)"/>
|
||||
<toolbarbutton id="appMenuRecentlyClosedWindows"
|
||||
label="&historyUndoWindowMenu.label;"
|
||||
class="subviewbutton subviewbutton-iconic subviewbutton-nav"
|
||||
closemenu="none"
|
||||
oncommand="PanelUI.showSubView('appMenu-library-recentlyClosedWindows', this)"/>
|
||||
<toolbarseparator/>
|
||||
<toolbarbutton id="PanelUI-historyMore"
|
||||
class="panel-subview-footer subviewbutton"
|
||||
label="&appMenuHistory.showAll.label;"
|
||||
class="subviewbutton subviewbutton-iconic panel-subview-footer-button"
|
||||
data-l10n-id="appmenu-manage-history"
|
||||
oncommand="PlacesCommandHook.showPlacesOrganizer('History'); CustomizableUI.hidePanelForNode(this);"/>
|
||||
</panelview>
|
||||
|
||||
|
@ -25,6 +25,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
CharsetMenu: "resource://gre/modules/CharsetMenu.jsm",
|
||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
|
||||
Sanitizer: "resource:///modules/Sanitizer.jsm",
|
||||
SessionStore: "resource:///modules/sessionstore/SessionStore.jsm",
|
||||
SyncedTabs: "resource://services-sync/SyncedTabs.jsm",
|
||||
});
|
||||
|
||||
@ -108,6 +109,15 @@ const CustomizableWidgets = [
|
||||
let document = panelview.ownerDocument;
|
||||
let window = document.defaultView;
|
||||
|
||||
PanelMultiView.getViewNode(
|
||||
document,
|
||||
"appMenuRecentlyClosedTabs"
|
||||
).disabled = SessionStore.getClosedTabCount(window) == 0;
|
||||
PanelMultiView.getViewNode(
|
||||
document,
|
||||
"appMenuRecentlyClosedWindows"
|
||||
).disabled = SessionStore.getClosedWindowCount(window) == 0;
|
||||
|
||||
// We restrict the amount of results to 42. Not 50, but 42. Why? Because 42.
|
||||
let query =
|
||||
"place:queryType=" +
|
||||
|
@ -151,6 +151,7 @@ skip-if = os == "linux" # linux doesn't get drag space (no tabsintitlebar)
|
||||
[browser_exit_background_customize_mode.js]
|
||||
[browser_flexible_space_area.js]
|
||||
[browser_help_panel_cloning.js]
|
||||
[browser_history_recently_closed.js]
|
||||
[browser_insert_before_moved_node.js]
|
||||
[browser_library_after_appMenu.js]
|
||||
[browser_menubar_visibility.js]
|
||||
|
@ -0,0 +1,125 @@
|
||||
/* 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 TEST_PATH = getRootDirectory(gTestPath).replace(
|
||||
"chrome://mochitests/content",
|
||||
"http://example.com"
|
||||
);
|
||||
|
||||
/**
|
||||
* Opens the history panel through the history toolbarbutton in the
|
||||
* navbar and returns a promise that resolves as soon as the panel is open
|
||||
* is showing.
|
||||
*/
|
||||
async function openHistoryPanel() {
|
||||
await waitForOverflowButtonShown();
|
||||
await document.getElementById("nav-bar").overflowable.show();
|
||||
info("Menu panel was opened");
|
||||
|
||||
let historyButton = document.getElementById("history-panelmenu");
|
||||
Assert.ok(historyButton, "History button appears in Panel Menu");
|
||||
|
||||
historyButton.click();
|
||||
|
||||
let historyPanel = document.getElementById("PanelUI-history");
|
||||
return BrowserTestUtils.waitForEvent(historyPanel, "ViewShown");
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the history panel and returns a promise that resolves as sooon
|
||||
* as the panel is closed.
|
||||
*/
|
||||
async function hideHistoryPanel() {
|
||||
let historyView = document.getElementById("PanelUI-history");
|
||||
let historyPanel = historyView.closest("panel");
|
||||
let promise = BrowserTestUtils.waitForEvent(historyPanel, "popuphidden");
|
||||
historyPanel.hidePopup();
|
||||
return promise;
|
||||
}
|
||||
|
||||
add_task(async function testRecentlyClosedDisabled() {
|
||||
info("Check history recently closed tabs/windows section");
|
||||
|
||||
CustomizableUI.addWidgetToArea(
|
||||
"history-panelmenu",
|
||||
CustomizableUI.AREA_FIXED_OVERFLOW_PANEL
|
||||
);
|
||||
registerCleanupFunction(() => CustomizableUI.reset());
|
||||
|
||||
await openHistoryPanel();
|
||||
|
||||
let recentlyClosedTabs = document.getElementById("appMenuRecentlyClosedTabs");
|
||||
let recentlyClosedWindows = document.getElementById(
|
||||
"appMenuRecentlyClosedWindows"
|
||||
);
|
||||
|
||||
// Wait for the disabled attribute to change, as we receive
|
||||
// the "viewshown" event before this changes
|
||||
await BrowserTestUtils.waitForCondition(
|
||||
() => recentlyClosedTabs.getAttribute("disabled"),
|
||||
"Waiting for button to become disabled"
|
||||
);
|
||||
Assert.ok(
|
||||
recentlyClosedTabs.getAttribute("disabled"),
|
||||
"Recently closed tabs button disabled"
|
||||
);
|
||||
Assert.ok(
|
||||
recentlyClosedWindows.getAttribute("disabled"),
|
||||
"Recently closed windows button disabled"
|
||||
);
|
||||
|
||||
await hideHistoryPanel();
|
||||
|
||||
gBrowser.selectedTab.focus();
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
TEST_PATH + "dummy_history_item.html"
|
||||
);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
|
||||
await openHistoryPanel();
|
||||
|
||||
await BrowserTestUtils.waitForCondition(
|
||||
() => !recentlyClosedTabs.getAttribute("disabled"),
|
||||
"Waiting for button to be enabled"
|
||||
);
|
||||
Assert.ok(
|
||||
!recentlyClosedTabs.getAttribute("disabled"),
|
||||
"Recently closed tabs is available"
|
||||
);
|
||||
Assert.ok(
|
||||
recentlyClosedWindows.getAttribute("disabled"),
|
||||
"Recently closed windows button disabled"
|
||||
);
|
||||
|
||||
await hideHistoryPanel();
|
||||
|
||||
let newWin = await BrowserTestUtils.openNewBrowserWindow();
|
||||
let loadedPromise = BrowserTestUtils.browserLoaded(
|
||||
newWin.gBrowser.selectedBrowser
|
||||
);
|
||||
BrowserTestUtils.loadURI(newWin.gBrowser.selectedBrowser, "about:mozilla");
|
||||
await loadedPromise;
|
||||
await BrowserTestUtils.closeWindow(newWin);
|
||||
|
||||
await openHistoryPanel();
|
||||
|
||||
await BrowserTestUtils.waitForCondition(
|
||||
() => !recentlyClosedWindows.getAttribute("disabled"),
|
||||
"Waiting for button to be enabled"
|
||||
);
|
||||
Assert.ok(
|
||||
!recentlyClosedTabs.getAttribute("disabled"),
|
||||
"Recently closed tabs is available"
|
||||
);
|
||||
Assert.ok(
|
||||
!recentlyClosedWindows.getAttribute("disabled"),
|
||||
"Recently closed windows is available"
|
||||
);
|
||||
|
||||
await hideHistoryPanel();
|
||||
await Sanitizer.sanitize(["history"]);
|
||||
});
|
@ -112,6 +112,11 @@ profiler-popup-capture-shortcut =
|
||||
*[other] Ctrl+Shift+2
|
||||
}
|
||||
|
||||
## History panel
|
||||
|
||||
appmenu-manage-history =
|
||||
.label = Manage History
|
||||
|
||||
## Help panel
|
||||
appmenu-help-header =
|
||||
.title = { -brand-shorter-name } Help
|
||||
|
@ -82,11 +82,8 @@ this container is a toolbar. This avoids double-speaking. -->
|
||||
<!-- LOCALIZATION NOTE (historyUndoWindowMenu): see bug 394759 -->
|
||||
<!ENTITY historyUndoWindowMenu.label "Recently Closed Windows">
|
||||
|
||||
<!ENTITY appMenuHistory.showAll.label "Show All History">
|
||||
<!ENTITY appMenuHistory.clearRecent.label "Clear Recent History…">
|
||||
<!ENTITY appMenuHistory.restoreSession.label "Restore Previous Session">
|
||||
<!ENTITY appMenuHistory.viewSidebar.label "View History Sidebar">
|
||||
<!ENTITY appMenuHistory.hideSidebar.label "Hide History Sidebar">
|
||||
<!ENTITY appMenuHistory.recentHistory.label "Recent History">
|
||||
<!ENTITY appMenuHelp.label "Help">
|
||||
|
||||
|
@ -121,7 +121,6 @@
|
||||
}
|
||||
|
||||
#PanelUI-fxa-menu-view-sidebar,
|
||||
#appMenuViewHistorySidebar,
|
||||
#PanelUI-remotetabs-view-sidebar,
|
||||
#panelMenu_viewBookmarksSidebar {
|
||||
list-style-image: url("chrome://browser/skin/sidebars-right.svg");
|
||||
@ -129,8 +128,6 @@
|
||||
|
||||
#PanelUI-fxa-menu-view-sidebar:-moz-locale-dir(ltr):not([positionend]),
|
||||
#PanelUI-fxa-menu-view-sidebar:-moz-locale-dir(rtl)[positionend],
|
||||
#appMenuViewHistorySidebar:-moz-locale-dir(ltr):not([positionend]),
|
||||
#appMenuViewHistorySidebar:-moz-locale-dir(rtl)[positionend],
|
||||
#PanelUI-remotetabs-view-sidebar:-moz-locale-dir(ltr):not([positionend]),
|
||||
#PanelUI-remotetabs-view-sidebar:-moz-locale-dir(rtl)[positionend],
|
||||
#panelMenu_viewBookmarksSidebar:-moz-locale-dir(ltr):not([positionend]),
|
||||
|
Loading…
Reference in New Issue
Block a user