Backed out 3 changesets (bug 1890718) for failing sevaral UI related bc tests. CLOSED TREE

Backed out changeset 3d91014dfcef (bug 1890718)
Backed out changeset 8c09e2028ad9 (bug 1890718)
Backed out changeset ff91ebffa8ab (bug 1890718)
This commit is contained in:
Cosmin Sabou 2024-04-15 21:11:48 +03:00
parent ddeb384472
commit 271aab4b32
5 changed files with 32 additions and 87 deletions

View File

@ -3,11 +3,14 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
<html:template id="appMenu-viewCache">
<panelview id="appMenu-mainView" class="PanelUI-subView"
<!-- This is a placeholder app menu which should be replaced with the "real"
Proton app menu before the Proton pref starts getting enabled. -->
<panelview id="appMenu-protonMainView" class="PanelUI-subView"
lockpanelvertical="true">
<vbox class="panel-subview-body">
<vbox id="appMenu-addon-banners"/>
<toolbarbutton id="appMenu-update-banner" class="panel-banner-item subviewbutton"
<vbox id="appMenu-proton-addon-banners"/>
<toolbarbutton id="appMenu-proton-update-banner" class="panel-banner-item subviewbutton"
oncommand="PanelUI._onBannerItemSelected(event)"
wrap="true"
hidden="true"/>
<toolbaritem id="appMenu-fxa-status2"
@ -16,7 +19,7 @@
<html:div id="appMenu-fxa-text" data-l10n-id="appmenu-fxa-sync-and-save-data2"/>
<toolbarbutton id="appMenu-fxa-label2"
class="subviewbutton"
>
oncommand="gSync.toggleAccountPanel(this, event)">
<vbox flex="1">
<label id="appMenu-header-title"
crop="end"/>
@ -30,6 +33,7 @@
data-l10n-id="appmenuitem-profiles"
data-l10n-args='{ "profilename": "" }'
closemenu="none"
oncommand="gProfiles.updateView(this)"
hidden="true"/>
<toolbarseparator id="appMenu-fxa-separator" class="proton-zap"/>
<toolbarbutton id="appMenu-new-tab-button2"
@ -52,12 +56,12 @@
class="subviewbutton subviewbutton-nav"
data-l10n-id="library-bookmarks-menu"
closemenu="none"
/>
oncommand="BookmarkingUI.showSubView(this);"/>
<toolbarbutton id="appMenu-history-button"
class="subviewbutton subviewbutton-nav"
data-l10n-id="appmenuitem-history"
closemenu="none"
/>
oncommand="PanelUI.showSubView('PanelUI-history', this)"/>
<toolbarbutton id="appMenu-downloads-button"
class="subviewbutton"
data-l10n-id="appmenuitem-downloads"
@ -66,6 +70,7 @@
<toolbarbutton id="appMenu-passwords-button"
class="subviewbutton"
data-l10n-id="appmenuitem-passwords"
oncommand="LoginHelper.openPasswordManager(window, { entryPoint: 'mainmenu' })"
/>
<toolbarbutton id="appMenu-extensions-themes-button"
class="subviewbutton"
@ -114,6 +119,13 @@
class="subviewbutton subviewbutton-iconic"
data-l10n-id="appmenuitem-fullscreen"
type="checkbox"
# Note that we're custom-handling this click to make sure the panel disappears
# before entering fullscreen, as it does some odd moving about on the screen
# in the middle of the fullscreen transition otherwise.
oncommand="
this.closest('panel').hidePopup();
setTimeout(() => BrowserCommands.fullScreen(), 0);
"
tooltip="dynamic-shortcut-tooltip">
<observes element="View:FullScreen" attribute="checked"/>
</toolbarbutton>
@ -125,12 +137,12 @@
#ifdef XP_MACOSX
key="key_preferencesCmdMac"
#endif
/>
oncommand="openPreferences()"/>
<toolbarbutton id="appMenu-more-button2"
class="subviewbutton subviewbutton-nav"
data-l10n-id="appmenuitem-more-tools"
closemenu="none"
/>
oncommand="PanelUI.showMoreToolsPanel(this);"/>
<toolbarbutton id="appMenu-report-broken-site-button"
class="subviewbutton subviewbutton-nav"
data-l10n-id="appmenuitem-report-broken-site"
@ -141,7 +153,7 @@
class="subviewbutton subviewbutton-nav"
data-l10n-id="appmenuitem-help"
closemenu="none"
/>
oncommand="PanelUI.showSubView('PanelUI-helpView', this)"/>
#ifndef XP_MACOSX
<toolbarseparator/>
<toolbarbutton id="appMenu-quit-button2"
@ -159,16 +171,16 @@
data-l10n-id="appmenu-recently-closed-tabs"
class="subviewbutton subviewbutton-nav"
closemenu="none"
/>
oncommand="PanelUI.showSubView('appMenu-library-recentlyClosedTabs', this)"/>
<toolbarbutton id="appMenuRecentlyClosedWindows"
data-l10n-id="appmenu-recently-closed-windows"
class="subviewbutton subviewbutton-nav"
closemenu="none"
/>
oncommand="PanelUI.showSubView('appMenu-library-recentlyClosedWindows', this)"/>
<toolbarbutton id="appMenuSearchHistory"
data-l10n-id="appmenu-search-history"
class="subviewbutton"
/>
oncommand="PlacesCommandHook.searchHistory()"/>
<toolbarbutton id="appMenu-restoreSession"
data-l10n-id="appmenu-restore-session"
class="subviewbutton"
@ -194,7 +206,7 @@
<toolbarbutton id="PanelUI-historyMore"
class="subviewbutton panel-subview-footer-button"
data-l10n-id="appmenu-manage-history"
/>
oncommand="PlacesCommandHook.showPlacesOrganizer('History'); CustomizableUI.hidePanelForNode(this);"/>
</panelview>
<panelview id="PanelUI-profiles" flex="1">

View File

@ -99,21 +99,6 @@ export const CustomizableWidgets = [
case "unload":
this.onWindowUnload(event);
break;
case "command": {
let { target } = event;
let { PanelUI, PlacesCommandHook } = target.ownerGlobal;
if (target.id == "appMenuRecentlyClosedTabs") {
PanelUI.showSubView(this.recentlyClosedTabsPanel, target);
} else if (target.id == "appMenuRecentlyClosedWindows") {
PanelUI.showSubView(this.recentlyClosedWindowsPanel, target);
} else if (target.id == "appMenuSearchHistory") {
PlacesCommandHook.searchHistory();
} else if (target.id == "PanelUI-historyMore") {
PlacesCommandHook.showPlacesOrganizer("History");
lazy.CustomizableUI.hidePanelForNode(target);
}
break;
}
default:
throw new Error(`Unsupported event for '${this.id}'`);
}
@ -168,7 +153,6 @@ export const CustomizableWidgets = [
// When the popup is hidden (thus the panelmultiview node as well), make
// sure to stop listening to PlacesDatabase updates.
panelview.panelMultiView.addEventListener("PanelMultiViewHidden", this);
panelview.addEventListener("command", this);
window.addEventListener("unload", this);
},
onViewHiding() {
@ -188,10 +172,6 @@ export const CustomizableWidgets = [
document,
this.recentlyClosedWindowsPanel
).removeEventListener("ViewShowing", this);
lazy.PanelMultiView.getViewNode(
document,
this.viewId
).removeEventListener("command", this);
}
panelMultiView.removeEventListener("PanelMultiViewHidden", this);
},

View File

@ -271,7 +271,7 @@
flip="slide"
position="bottomright topright"
noautofocus="true">
<panelmultiview id="appMenu-multiView" mainViewId="appMenu-mainView"
<panelmultiview id="appMenu-multiView" mainViewId="appMenu-protonMainView"
viewCacheId="appMenu-viewCache">
</panelmultiview>
</panel>

View File

@ -132,7 +132,6 @@ const PanelUI = {
"ViewShowing",
this._onHelpViewShow
);
this.mainView.addEventListener("command", this);
this._eventListenersAdded = true;
},
@ -144,7 +143,6 @@ const PanelUI = {
document,
"PanelUI-helpView"
).removeEventListener("ViewShowing", this._onHelpViewShow);
this.mainView.removeEventListener("command", this);
this._eventListenersAdded = false;
},
@ -301,54 +299,6 @@ const PanelUI = {
case "activate":
this.updateNotifications();
break;
case "command":
this.onCommand(aEvent);
break;
}
},
// Note that we listen for bubbling command events. In the case where the
// button that the user clicks has a command attribute, those events are
// redirected to the relevant command element, and we never see them in
// here. Bear this in mind if you want to write code that applies to
// all commands, for which this wouldn't work well.
onCommand(aEvent) {
let { target } = aEvent;
switch (target.id) {
case "appMenu-update-banner":
this._onBannerItemSelected(aEvent);
break;
case "appMenu-fxa-label2":
gSync.toggleAccountPanel(target, aEvent);
break;
case "appMenu-profiles-button":
gProfiles.updateView(target);
break;
case "appMenu-bookmarks-button":
BookmarkingUI.showSubView(target);
break;
case "appMenu-history-button":
this.showSubView("PanelUI-history", target);
break;
case "appMenu-passwords-button":
LoginHelper.openPasswordManager(window, { entryPoint: "mainmenu" });
break;
case "appMenu-fullscreen-button2":
// Note that we're custom-handling the hiding of the panel to make
// sure it disappears before entering fullscreen. Otherwise it can
// end up moving around on the screen during the fullscreen transition.
target.closest("panel").hidePopup();
setTimeout(() => BrowserCommands.fullScreen(), 0);
break;
case "appMenu-settings-button":
openPreferences();
break;
case "appMenu-more-button2":
this.showMoreToolsPanel(target);
break;
case "appMenu-help-button2":
this.showSubView("PanelUI-helpView", target);
break;
}
},
@ -890,7 +840,10 @@ const PanelUI = {
get mainView() {
if (!this._mainView) {
this._mainView = PanelMultiView.getViewNode(document, "appMenu-mainView");
this._mainView = PanelMultiView.getViewNode(
document,
"appMenu-protonMainView"
);
}
return this._mainView;
},
@ -899,7 +852,7 @@ const PanelUI = {
if (!this._addonNotificationContainer) {
this._addonNotificationContainer = PanelMultiView.getViewNode(
document,
"appMenu-addon-banners"
"appMenu-proton-addon-banners"
);
}

View File

@ -13,7 +13,7 @@ add_task(async function test_appMenu_mainView() {
return;
}
let mainViewID = "appMenu-mainView";
let mainViewID = "appMenu-protonMainView";
const mainView = document.getElementById(mainViewID);
let shownPromise = BrowserTestUtils.waitForEvent(mainView, "ViewShown");