зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1648640, remove character encoding panel view, panic view, SSB view, more view, and what's new panel view from main panel and place in template r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D81621
This commit is contained in:
Родитель
b29ef28dc4
Коммит
cb57528ee2
|
@ -2536,7 +2536,10 @@ const SiteSpecificBrowserUI = {
|
||||||
}
|
}
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(this, "panelBody", () => {
|
XPCOMUtils.defineLazyGetter(this, "panelBody", () => {
|
||||||
return document.querySelector("#appMenu-SSBView .panel-subview-body");
|
return PanelMultiView.getViewNode(
|
||||||
|
document,
|
||||||
|
"appMenu-SSBView .panel-subview-body"
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
let initializeMenu = async () => {
|
let initializeMenu = async () => {
|
||||||
|
@ -2559,7 +2562,10 @@ const SiteSpecificBrowserUI = {
|
||||||
"popupshowing",
|
"popupshowing",
|
||||||
() => {
|
() => {
|
||||||
let blocker = initializeMenu();
|
let blocker = initializeMenu();
|
||||||
document.getElementById("appMenu-SSBView").addEventListener(
|
PanelMultiView.getViewNode(
|
||||||
|
document,
|
||||||
|
"appMenu-SSBView"
|
||||||
|
).addEventListener(
|
||||||
"ViewShowing",
|
"ViewShowing",
|
||||||
event => {
|
event => {
|
||||||
event.detail.addBlocker(blocker);
|
event.detail.addBlocker(blocker);
|
||||||
|
|
|
@ -906,6 +906,72 @@
|
||||||
</vbox>
|
</vbox>
|
||||||
</panelview>
|
</panelview>
|
||||||
|
|
||||||
|
<panelview id="PanelUI-characterEncodingView" flex="1">
|
||||||
|
<vbox class="panel-subview-body">
|
||||||
|
<vbox id="PanelUI-characterEncodingView-pinned"
|
||||||
|
class="PanelUI-characterEncodingView-list"/>
|
||||||
|
<toolbarseparator/>
|
||||||
|
<vbox id="PanelUI-characterEncodingView-charsets"
|
||||||
|
class="PanelUI-characterEncodingView-list"/>
|
||||||
|
</vbox>
|
||||||
|
</panelview>
|
||||||
|
|
||||||
|
<panelview id="PanelUI-panicView" flex="1"
|
||||||
|
descriptionheightworkaround="true">
|
||||||
|
<vbox class="panel-subview-body">
|
||||||
|
<hbox id="PanelUI-panic-timeframe">
|
||||||
|
<image id="PanelUI-panic-timeframe-icon" alt=""/>
|
||||||
|
<vbox flex="1">
|
||||||
|
<description data-l10n-id="panic-main-timeframe-desc" id="PanelUI-panic-mainDesc"></description>
|
||||||
|
<radiogroup id="PanelUI-panic-timeSpan" aria-labelledby="PanelUI-panic-mainDesc" closemenu="none">
|
||||||
|
<radio id="PanelUI-panic-5min" data-l10n-id="panic-button-5min" selected="true"
|
||||||
|
value="5" class="subviewradio"/>
|
||||||
|
<radio id="PanelUI-panic-2hr" data-l10n-id="panic-button-2hr"
|
||||||
|
value="2" class="subviewradio"/>
|
||||||
|
<radio id="PanelUI-panic-day" data-l10n-id="panic-button-day"
|
||||||
|
value="6" class="subviewradio"/>
|
||||||
|
</radiogroup>
|
||||||
|
</vbox>
|
||||||
|
</hbox>
|
||||||
|
<vbox id="PanelUI-panic-explanations">
|
||||||
|
<label id="PanelUI-panic-actionlist-main-label" data-l10n-id="panic-button-action-desc"></label>
|
||||||
|
|
||||||
|
<label id="PanelUI-panic-actionlist-windows" class="PanelUI-panic-actionlist" data-l10n-id="panic-button-delete-tabs-and-windows"></label>
|
||||||
|
<label id="PanelUI-panic-actionlist-cookies" class="PanelUI-panic-actionlist" data-l10n-id="panic-button-delete-cookies"></label>
|
||||||
|
<label id="PanelUI-panic-actionlist-history" class="PanelUI-panic-actionlist" data-l10n-id="panic-button-delete-history"></label>
|
||||||
|
<label id="PanelUI-panic-actionlist-newwindow" class="PanelUI-panic-actionlist" data-l10n-id="panic-button-open-new-window"></label>
|
||||||
|
|
||||||
|
<label id="PanelUI-panic-warning" data-l10n-id="panic-button-undo-warning"></label>
|
||||||
|
</vbox>
|
||||||
|
<button id="PanelUI-panic-view-button"
|
||||||
|
data-l10n-id="panic-button-forget-button"/>
|
||||||
|
</vbox>
|
||||||
|
</panelview>
|
||||||
|
|
||||||
|
<panelview id="appMenu-SSBView" class="PanelUI-subView">
|
||||||
|
<vbox class="panel-subview-body">
|
||||||
|
</vbox>
|
||||||
|
</panelview>
|
||||||
|
|
||||||
|
<panelview id="appMenu-moreView" title="&moreMenu.label;" class="PanelUI-subView">
|
||||||
|
<vbox class="panel-subview-body">
|
||||||
|
<toolbarbutton id="appMenu-taskmanager-button"
|
||||||
|
class="subviewbutton subviewbutton-iconic"
|
||||||
|
label="&taskManagerCmd.label;"
|
||||||
|
oncommand="switchToTabHavingURI('about:performance', true)"/>
|
||||||
|
<toolbarbutton id="appMenu-characterencoding-button"
|
||||||
|
class="subviewbutton subviewbutton-nav"
|
||||||
|
label="&charsetMenu2.label;"
|
||||||
|
closemenu="none"
|
||||||
|
oncommand="PanelUI.showSubView('PanelUI-characterEncodingView', this)"/>
|
||||||
|
<toolbarbutton id="appMenu-workoffline-button"
|
||||||
|
class="subviewbutton"
|
||||||
|
data-l10n-id="menu-file-go-offline"
|
||||||
|
type="checkbox"
|
||||||
|
command="cmd_toggleOfflineStatus"/>
|
||||||
|
</vbox>
|
||||||
|
</panelview>
|
||||||
|
|
||||||
<panelview id="appMenu-libraryView" class="PanelUI-subView">
|
<panelview id="appMenu-libraryView" class="PanelUI-subView">
|
||||||
<vbox class="panel-subview-body">
|
<vbox class="panel-subview-body">
|
||||||
<toolbarbutton id="appMenu-library-bookmarks-button"
|
<toolbarbutton id="appMenu-library-bookmarks-button"
|
||||||
|
@ -969,6 +1035,25 @@
|
||||||
oncommand="BookmarkingUI.toggleBookmarksToolbar('bookmark-tools');"/>
|
oncommand="BookmarkingUI.toggleBookmarksToolbar('bookmark-tools');"/>
|
||||||
</vbox>
|
</vbox>
|
||||||
</panelview>
|
</panelview>
|
||||||
|
|
||||||
|
<panelview id="PanelUI-whatsNew" class="PanelUI-subView">
|
||||||
|
<vbox class="panel-subview-body">
|
||||||
|
<box id="PanelUI-whatsNew-title" class="panel-header">
|
||||||
|
<label data-l10n-id="whatsnew-panel-header"/>
|
||||||
|
</box>
|
||||||
|
<toolbaritem id="PanelUI-whatsNew-content"
|
||||||
|
orient="vertical"
|
||||||
|
smoothscroll="false">
|
||||||
|
<html:div id="PanelUI-whatsNew-message-container" role="document">
|
||||||
|
<!-- What's New messages will be rendered here -->
|
||||||
|
</html:div>
|
||||||
|
</toolbaritem>
|
||||||
|
</vbox>
|
||||||
|
<checkbox id="panelMenu-toggleWhatsNew"
|
||||||
|
class="panelMenu-toggleWhatsNew-checkbox"
|
||||||
|
oncommand="ToolbarPanelHub.toggleWhatsNewPref(event)"
|
||||||
|
data-l10n-id="whatsnew-panel-footer-checkbox"/>
|
||||||
|
</panelview>
|
||||||
</html:template>
|
</html:template>
|
||||||
|
|
||||||
<!-- Temporary wrapper until we move away from XUL flex to allow a negative
|
<!-- Temporary wrapper until we move away from XUL flex to allow a negative
|
||||||
|
|
|
@ -907,42 +907,7 @@ if (Services.prefs.getBoolPref("privacy.panicButton.enabled")) {
|
||||||
let win = aEvent.target.ownerGlobal;
|
let win = aEvent.target.ownerGlobal;
|
||||||
let doc = win.document;
|
let doc = win.document;
|
||||||
let eventBlocker = null;
|
let eventBlocker = null;
|
||||||
if (!doc.querySelector("#PanelUI-panic-timeframe")) {
|
eventBlocker = doc.l10n.translateElements([aEvent.target]);
|
||||||
win.MozXULElement.insertFTLIfNeeded("browser/panicButton.ftl");
|
|
||||||
let frag = win.MozXULElement.parseXULToFragment(`
|
|
||||||
<vbox class="panel-subview-body">
|
|
||||||
<hbox id="PanelUI-panic-timeframe">
|
|
||||||
<image id="PanelUI-panic-timeframe-icon" alt=""/>
|
|
||||||
<vbox flex="1">
|
|
||||||
<description data-l10n-id="panic-main-timeframe-desc" id="PanelUI-panic-mainDesc"></description>
|
|
||||||
<radiogroup id="PanelUI-panic-timeSpan" aria-labelledby="PanelUI-panic-mainDesc" closemenu="none">
|
|
||||||
<radio id="PanelUI-panic-5min" data-l10n-id="panic-button-5min" selected="true"
|
|
||||||
value="5" class="subviewradio"/>
|
|
||||||
<radio id="PanelUI-panic-2hr" data-l10n-id="panic-button-2hr"
|
|
||||||
value="2" class="subviewradio"/>
|
|
||||||
<radio id="PanelUI-panic-day" data-l10n-id="panic-button-day"
|
|
||||||
value="6" class="subviewradio"/>
|
|
||||||
</radiogroup>
|
|
||||||
</vbox>
|
|
||||||
</hbox>
|
|
||||||
<vbox id="PanelUI-panic-explanations">
|
|
||||||
<label id="PanelUI-panic-actionlist-main-label" data-l10n-id="panic-button-action-desc"></label>
|
|
||||||
|
|
||||||
<label id="PanelUI-panic-actionlist-windows" class="PanelUI-panic-actionlist" data-l10n-id="panic-button-delete-tabs-and-windows"></label>
|
|
||||||
<label id="PanelUI-panic-actionlist-cookies" class="PanelUI-panic-actionlist" data-l10n-id="panic-button-delete-cookies"></label>
|
|
||||||
<label id="PanelUI-panic-actionlist-history" class="PanelUI-panic-actionlist" data-l10n-id="panic-button-delete-history"></label>
|
|
||||||
<label id="PanelUI-panic-actionlist-newwindow" class="PanelUI-panic-actionlist" data-l10n-id="panic-button-open-new-window"></label>
|
|
||||||
|
|
||||||
<label id="PanelUI-panic-warning" data-l10n-id="panic-button-undo-warning"></label>
|
|
||||||
</vbox>
|
|
||||||
<button id="PanelUI-panic-view-button"
|
|
||||||
data-l10n-id="panic-button-forget-button"/>
|
|
||||||
</vbox>
|
|
||||||
`);
|
|
||||||
|
|
||||||
aEvent.target.appendChild(frag);
|
|
||||||
eventBlocker = doc.l10n.translateElements([aEvent.target]);
|
|
||||||
}
|
|
||||||
|
|
||||||
let forgetButton = aEvent.target.querySelector(
|
let forgetButton = aEvent.target.querySelector(
|
||||||
"#PanelUI-panic-view-button"
|
"#PanelUI-panic-view-button"
|
||||||
|
|
|
@ -569,45 +569,6 @@
|
||||||
</vbox>
|
</vbox>
|
||||||
</panelview>
|
</panelview>
|
||||||
|
|
||||||
<panelview id="PanelUI-characterEncodingView" flex="1">
|
|
||||||
<vbox class="panel-subview-body">
|
|
||||||
<vbox id="PanelUI-characterEncodingView-pinned"
|
|
||||||
class="PanelUI-characterEncodingView-list"/>
|
|
||||||
<toolbarseparator/>
|
|
||||||
<vbox id="PanelUI-characterEncodingView-charsets"
|
|
||||||
class="PanelUI-characterEncodingView-list"/>
|
|
||||||
</vbox>
|
|
||||||
</panelview>
|
|
||||||
|
|
||||||
<panelview id="PanelUI-panicView" flex="1"
|
|
||||||
descriptionheightworkaround="true">
|
|
||||||
<!-- This is constructed in CustomizableWidgets.jsm -->
|
|
||||||
</panelview>
|
|
||||||
|
|
||||||
<panelview id="appMenu-moreView" title="&moreMenu.label;" class="PanelUI-subView">
|
|
||||||
<vbox class="panel-subview-body">
|
|
||||||
<toolbarbutton id="appMenu-taskmanager-button"
|
|
||||||
class="subviewbutton subviewbutton-iconic"
|
|
||||||
label="&taskManagerCmd.label;"
|
|
||||||
oncommand="switchToTabHavingURI('about:performance', true)"/>
|
|
||||||
<toolbarbutton id="appMenu-characterencoding-button"
|
|
||||||
class="subviewbutton subviewbutton-nav"
|
|
||||||
label="&charsetMenu2.label;"
|
|
||||||
closemenu="none"
|
|
||||||
oncommand="PanelUI.showSubView('PanelUI-characterEncodingView', this)"/>
|
|
||||||
<toolbarbutton id="appMenu-workoffline-button"
|
|
||||||
class="subviewbutton"
|
|
||||||
data-l10n-id="menu-file-go-offline"
|
|
||||||
type="checkbox"
|
|
||||||
command="cmd_toggleOfflineStatus"/>
|
|
||||||
</vbox>
|
|
||||||
</panelview>
|
|
||||||
|
|
||||||
<panelview id="appMenu-SSBView" class="PanelUI-subView">
|
|
||||||
<vbox class="panel-subview-body">
|
|
||||||
</vbox>
|
|
||||||
</panelview>
|
|
||||||
|
|
||||||
<panelview id="PanelUI-fxa" title="&fxa.menu.account.label;" class="PanelUI-subView" descriptionheightworkaround="true">
|
<panelview id="PanelUI-fxa" title="&fxa.menu.account.label;" class="PanelUI-subView" descriptionheightworkaround="true">
|
||||||
<vbox id="PanelUI-fxa-menu" class="panel-subview-body">
|
<vbox id="PanelUI-fxa-menu" class="panel-subview-body">
|
||||||
<toolbarbutton id="fxa-manage-account-button"
|
<toolbarbutton id="fxa-manage-account-button"
|
||||||
|
@ -723,25 +684,6 @@
|
||||||
oncommand="gSync.openConnectAnotherDeviceFromFxaMenu(this);"/>
|
oncommand="gSync.openConnectAnotherDeviceFromFxaMenu(this);"/>
|
||||||
</vbox>
|
</vbox>
|
||||||
</panelview>
|
</panelview>
|
||||||
|
|
||||||
<panelview id="PanelUI-whatsNew" class="PanelUI-subView">
|
|
||||||
<vbox class="panel-subview-body">
|
|
||||||
<box id="PanelUI-whatsNew-title" class="panel-header">
|
|
||||||
<label data-l10n-id="whatsnew-panel-header"/>
|
|
||||||
</box>
|
|
||||||
<toolbaritem id="PanelUI-whatsNew-content"
|
|
||||||
orient="vertical"
|
|
||||||
smoothscroll="false">
|
|
||||||
<html:div id="PanelUI-whatsNew-message-container" role="document">
|
|
||||||
<!-- What's New messages will be rendered here -->
|
|
||||||
</html:div>
|
|
||||||
</toolbaritem>
|
|
||||||
</vbox>
|
|
||||||
<checkbox id="panelMenu-toggleWhatsNew"
|
|
||||||
class="panelMenu-toggleWhatsNew-checkbox"
|
|
||||||
oncommand="ToolbarPanelHub.toggleWhatsNewPref(event)"
|
|
||||||
data-l10n-id="whatsnew-panel-footer-checkbox"/>
|
|
||||||
</panelview>
|
|
||||||
</panelmultiview>
|
</panelmultiview>
|
||||||
</panel>
|
</panel>
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,6 @@ const PanelUI = {
|
||||||
overflowFixedList: "widget-overflow-fixed-list",
|
overflowFixedList: "widget-overflow-fixed-list",
|
||||||
overflowPanel: "widget-overflow",
|
overflowPanel: "widget-overflow",
|
||||||
navbar: "nav-bar",
|
navbar: "nav-bar",
|
||||||
whatsNewPanel: "PanelUI-whatsNew",
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -198,7 +197,9 @@ const PanelUI = {
|
||||||
if (this.libraryView) {
|
if (this.libraryView) {
|
||||||
this.libraryView.removeEventListener("ViewShowing", this);
|
this.libraryView.removeEventListener("ViewShowing", this);
|
||||||
}
|
}
|
||||||
this.whatsNewPanel.removeEventListener("ViewShowing", this);
|
if (this.whatsNewPanel) {
|
||||||
|
this.whatsNewPanel.removeEventListener("ViewShowing", this);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -454,6 +455,7 @@ const PanelUI = {
|
||||||
|
|
||||||
this.ensureLibraryInitialized(viewNode);
|
this.ensureLibraryInitialized(viewNode);
|
||||||
this.ensureWhatsNewInitialized(viewNode);
|
this.ensureWhatsNewInitialized(viewNode);
|
||||||
|
this.ensurePanicViewInitialized(viewNode);
|
||||||
|
|
||||||
let container = aAnchor.closest("panelmultiview");
|
let container = aAnchor.closest("panelmultiview");
|
||||||
if (container) {
|
if (container) {
|
||||||
|
@ -683,14 +685,36 @@ const PanelUI = {
|
||||||
* @param {panelview} panelView The What's New panelview.
|
* @param {panelview} panelView The What's New panelview.
|
||||||
*/
|
*/
|
||||||
ensureWhatsNewInitialized(panelView) {
|
ensureWhatsNewInitialized(panelView) {
|
||||||
if (panelView != this.whatsNewPanel || panelView._initialized) {
|
if (panelView.id != "PanelUI-whatsNew" || panelView._initialized) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.whatsNewPanel) {
|
||||||
|
this.whatsNewPanel = panelView;
|
||||||
|
}
|
||||||
|
|
||||||
panelView._initialized = true;
|
panelView._initialized = true;
|
||||||
panelView.addEventListener("ViewShowing", this);
|
panelView.addEventListener("ViewShowing", this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds FTL before appending the panic view markup to the main DOM.
|
||||||
|
*
|
||||||
|
* @param {panelview} panelView The Panic View panelview.
|
||||||
|
*/
|
||||||
|
ensurePanicViewInitialized(panelView) {
|
||||||
|
if (panelView.id != "PanelUI-panicView" || panelView._initialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.panic) {
|
||||||
|
this.panic = panelView;
|
||||||
|
}
|
||||||
|
|
||||||
|
MozXULElement.insertFTLIfNeeded("browser/panicButton.ftl");
|
||||||
|
panelView._initialized = true;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the What's New panel is showing, we fetch the messages to show.
|
* When the What's New panel is showing, we fetch the messages to show.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -50,11 +50,11 @@ add_task(async function() {
|
||||||
!charEncodingButton.hasAttribute("disabled"),
|
!charEncodingButton.hasAttribute("disabled"),
|
||||||
"The Character encoding button gets enabled"
|
"The Character encoding button gets enabled"
|
||||||
);
|
);
|
||||||
|
charEncodingButton.click();
|
||||||
let characterEncodingView = document.getElementById(
|
let characterEncodingView = document.getElementById(
|
||||||
"PanelUI-characterEncodingView"
|
"PanelUI-characterEncodingView"
|
||||||
);
|
);
|
||||||
let subviewShownPromise = subviewShown(characterEncodingView);
|
let subviewShownPromise = subviewShown(characterEncodingView);
|
||||||
charEncodingButton.click();
|
|
||||||
await subviewShownPromise;
|
await subviewShownPromise;
|
||||||
|
|
||||||
ok(
|
ok(
|
||||||
|
|
|
@ -27,11 +27,11 @@ add_task(async function() {
|
||||||
|
|
||||||
await document.getElementById("nav-bar").overflowable.show();
|
await document.getElementById("nav-bar").overflowable.show();
|
||||||
let charEncodingButton = document.getElementById("characterencoding-button");
|
let charEncodingButton = document.getElementById("characterencoding-button");
|
||||||
|
charEncodingButton.click();
|
||||||
let characterEncodingView = document.getElementById(
|
let characterEncodingView = document.getElementById(
|
||||||
"PanelUI-characterEncodingView"
|
"PanelUI-characterEncodingView"
|
||||||
);
|
);
|
||||||
let subviewShownPromise = subviewShown(characterEncodingView);
|
let subviewShownPromise = subviewShown(characterEncodingView);
|
||||||
charEncodingButton.click();
|
|
||||||
await subviewShownPromise;
|
await subviewShownPromise;
|
||||||
|
|
||||||
let checkedButtons = characterEncodingView.querySelectorAll(
|
let checkedButtons = characterEncodingView.querySelectorAll(
|
||||||
|
|
|
@ -20,10 +20,10 @@ add_task(async function test_character_encoding_menu() {
|
||||||
);
|
);
|
||||||
|
|
||||||
const button = document.getElementById("characterencoding-button");
|
const button = document.getElementById("characterencoding-button");
|
||||||
const view = document.getElementById("PanelUI-characterEncodingView");
|
|
||||||
|
|
||||||
let shownPromise = subviewShown(view);
|
|
||||||
EventUtils.synthesizeMouseAtCenter(button, { ctrlKey: true });
|
EventUtils.synthesizeMouseAtCenter(button, { ctrlKey: true });
|
||||||
|
|
||||||
|
const view = document.getElementById("PanelUI-characterEncodingView");
|
||||||
|
let shownPromise = subviewShown(view);
|
||||||
await shownPromise;
|
await shownPromise;
|
||||||
ok(true, "Character encoding menu shown after button pressed");
|
ok(true, "Character encoding menu shown after button pressed");
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,11 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
"resource://messaging-system/lib/SpecialMessageActions.jsm",
|
"resource://messaging-system/lib/SpecialMessageActions.jsm",
|
||||||
RemoteL10n: "resource://activity-stream/lib/RemoteL10n.jsm",
|
RemoteL10n: "resource://activity-stream/lib/RemoteL10n.jsm",
|
||||||
});
|
});
|
||||||
|
ChromeUtils.defineModuleGetter(
|
||||||
|
this,
|
||||||
|
"PanelMultiView",
|
||||||
|
"resource:///modules/PanelMultiView.jsm"
|
||||||
|
);
|
||||||
XPCOMUtils.defineLazyServiceGetter(
|
XPCOMUtils.defineLazyServiceGetter(
|
||||||
this,
|
this,
|
||||||
"TrackingDBService",
|
"TrackingDBService",
|
||||||
|
@ -176,7 +181,7 @@ class _ToolbarPanelHub {
|
||||||
const messages =
|
const messages =
|
||||||
(options.force && options.messages) ||
|
(options.force && options.messages) ||
|
||||||
(await this.messages).sort(this._sortWhatsNewMessages);
|
(await this.messages).sort(this._sortWhatsNewMessages);
|
||||||
const container = doc.getElementById(containerId);
|
const container = PanelMultiView.getViewNode(doc, containerId);
|
||||||
|
|
||||||
if (messages) {
|
if (messages) {
|
||||||
// Targeting attribute state might have changed making new messages
|
// Targeting attribute state might have changed making new messages
|
||||||
|
@ -215,9 +220,10 @@ class _ToolbarPanelHub {
|
||||||
|
|
||||||
removeMessages(win, containerId) {
|
removeMessages(win, containerId) {
|
||||||
const doc = win.document;
|
const doc = win.document;
|
||||||
const messageNodes = doc
|
const messageNodes = PanelMultiView.getViewNode(
|
||||||
.getElementById(containerId)
|
doc,
|
||||||
.querySelectorAll(".whatsNew-message");
|
containerId
|
||||||
|
).querySelectorAll(".whatsNew-message");
|
||||||
for (const messageNode of messageNodes) {
|
for (const messageNode of messageNodes) {
|
||||||
messageNode.remove();
|
messageNode.remove();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ describe("ToolbarPanelHub", () => {
|
||||||
let defaultSearchStub;
|
let defaultSearchStub;
|
||||||
let scriptloaderStub;
|
let scriptloaderStub;
|
||||||
let fakeRemoteL10n;
|
let fakeRemoteL10n;
|
||||||
|
let getViewNodeStub;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
sandbox = sinon.createSandbox();
|
sandbox = sinon.createSandbox();
|
||||||
|
@ -125,6 +126,7 @@ describe("ToolbarPanelHub", () => {
|
||||||
new Date() - 500
|
new Date() - 500
|
||||||
);
|
);
|
||||||
getEventsByDateRangeStub = sandbox.stub().returns([]);
|
getEventsByDateRangeStub = sandbox.stub().returns([]);
|
||||||
|
getViewNodeStub = sandbox.stub().returns(fakeElementById);
|
||||||
defaultSearchStub = { defaultEngine: { name: "DDG" } };
|
defaultSearchStub = { defaultEngine: { name: "DDG" } };
|
||||||
fakeRemoteL10n = {
|
fakeRemoteL10n = {
|
||||||
l10n: {},
|
l10n: {},
|
||||||
|
@ -158,6 +160,9 @@ describe("ToolbarPanelHub", () => {
|
||||||
handleAction: sandbox.stub(),
|
handleAction: sandbox.stub(),
|
||||||
},
|
},
|
||||||
RemoteL10n: fakeRemoteL10n,
|
RemoteL10n: fakeRemoteL10n,
|
||||||
|
PanelMultiView: {
|
||||||
|
getViewNode: getViewNodeStub,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
|
|
@ -6,26 +6,35 @@ add_task(async () => {
|
||||||
let win = await BrowserTestUtils.openNewBrowserWindow();
|
let win = await BrowserTestUtils.openNewBrowserWindow();
|
||||||
|
|
||||||
let button = win.document.getElementById("appMenu-ssb-button");
|
let button = win.document.getElementById("appMenu-ssb-button");
|
||||||
let panel = win.document.querySelector(
|
|
||||||
"#appMenu-SSBView .panel-subview-body"
|
|
||||||
);
|
|
||||||
|
|
||||||
Assert.ok(button.hidden, "Button should be hidden.");
|
Assert.ok(button.hidden, "Button should be hidden.");
|
||||||
Assert.equal(panel.firstElementChild, null, "Should be nothing in the list.");
|
Assert.equal(
|
||||||
|
win.document.querySelector("#appMenu-SSBView .panel-subview-body"),
|
||||||
|
null,
|
||||||
|
"Panel should not be available"
|
||||||
|
);
|
||||||
|
|
||||||
let ssb = await SiteSpecificBrowser.createFromURI(
|
let ssb = await SiteSpecificBrowser.createFromURI(
|
||||||
Services.io.newURI(gHttpsTestRoot)
|
Services.io.newURI(gHttpsTestRoot)
|
||||||
);
|
);
|
||||||
|
|
||||||
Assert.ok(button.hidden, "Button should be hidden.");
|
Assert.ok(button.hidden, "Button should be hidden.");
|
||||||
Assert.equal(panel.firstElementChild, null, "Should be nothing in the list.");
|
Assert.equal(
|
||||||
|
win.document.querySelector("#appMenu-SSBView .panel-subview-body"),
|
||||||
|
null,
|
||||||
|
"Panel should not be available"
|
||||||
|
);
|
||||||
|
|
||||||
await ssb.install();
|
await ssb.install();
|
||||||
|
|
||||||
// Button should still be hidden, we don't populate the list until it is
|
// Button should still be hidden, we don't populate the list until it is
|
||||||
// first opened.
|
// first opened.
|
||||||
Assert.ok(button.hidden, "Button should be hidden.");
|
Assert.ok(button.hidden, "Button should be hidden.");
|
||||||
Assert.equal(panel.firstElementChild, null, "Should be nothing in the list.");
|
Assert.equal(
|
||||||
|
win.document.querySelector("#appMenu-SSBView .panel-subview-body"),
|
||||||
|
null,
|
||||||
|
"Panel should not be available"
|
||||||
|
);
|
||||||
|
|
||||||
let appMenuOpened = BrowserTestUtils.waitForEvent(
|
let appMenuOpened = BrowserTestUtils.waitForEvent(
|
||||||
win.document.getElementById("appMenu-popup"),
|
win.document.getElementById("appMenu-popup"),
|
||||||
|
@ -42,6 +51,22 @@ add_task(async () => {
|
||||||
await Promise.all([appMenuOpened, buttonShown]);
|
await Promise.all([appMenuOpened, buttonShown]);
|
||||||
|
|
||||||
Assert.ok(!button.hidden, "Button should be visible.");
|
Assert.ok(!button.hidden, "Button should be visible.");
|
||||||
|
|
||||||
|
EventUtils.synthesizeMouseAtCenter(
|
||||||
|
win.document.getElementById("appMenu-ssb-button"),
|
||||||
|
{},
|
||||||
|
win
|
||||||
|
);
|
||||||
|
|
||||||
|
let panelShown = BrowserTestUtils.waitForEvent(
|
||||||
|
win.document.getElementById("appMenu-SSBView"),
|
||||||
|
"ViewShown"
|
||||||
|
);
|
||||||
|
let panel = win.document.querySelector(
|
||||||
|
"#appMenu-SSBView .panel-subview-body"
|
||||||
|
);
|
||||||
|
await panelShown;
|
||||||
|
|
||||||
Assert.notEqual(
|
Assert.notEqual(
|
||||||
panel.firstElementChild,
|
panel.firstElementChild,
|
||||||
null,
|
null,
|
||||||
|
@ -53,18 +78,6 @@ add_task(async () => {
|
||||||
"Should have the right ID."
|
"Should have the right ID."
|
||||||
);
|
);
|
||||||
|
|
||||||
let panelShown = BrowserTestUtils.waitForEvent(
|
|
||||||
win.document.getElementById("appMenu-SSBView"),
|
|
||||||
"ViewShown"
|
|
||||||
);
|
|
||||||
|
|
||||||
EventUtils.synthesizeMouseAtCenter(
|
|
||||||
win.document.getElementById("appMenu-ssb-button"),
|
|
||||||
{},
|
|
||||||
win
|
|
||||||
);
|
|
||||||
await panelShown;
|
|
||||||
|
|
||||||
let ssbOpened = waitForSSB();
|
let ssbOpened = waitForSSB();
|
||||||
EventUtils.synthesizeMouseAtCenter(panel.firstElementChild, {}, win);
|
EventUtils.synthesizeMouseAtCenter(panel.firstElementChild, {}, win);
|
||||||
let ssbWin = await ssbOpened;
|
let ssbWin = await ssbOpened;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче