mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 1847065 - ensure zoom reset and shopping url bar icons check for non-leftclicks before doing something, r=fchasen
Differential Revision: https://phabricator.services.mozilla.com/D185443
This commit is contained in:
parent
d25a424e50
commit
dc8348b373
@ -482,6 +482,19 @@ var FullZoom = {
|
||||
return result;
|
||||
},
|
||||
|
||||
/**
|
||||
* Called from the URL bar's inline zoom reset indicator button.
|
||||
*
|
||||
* @param {Event} event the click/keyboard event that triggered the call.
|
||||
*/
|
||||
resetFromURLBar(event) {
|
||||
if (event.button > 0) {
|
||||
return;
|
||||
}
|
||||
this.reset();
|
||||
this.resetScalingZoom();
|
||||
},
|
||||
|
||||
resetScalingZoom: function FullZoom_resetScaling(
|
||||
browser = gBrowser.selectedBrowser
|
||||
) {
|
||||
|
@ -390,13 +390,13 @@
|
||||
role="button"
|
||||
data-l10n-id="shopping-sidebar-open-button"
|
||||
hidden="true"
|
||||
onclick="ShoppingSidebarParent.toggleAllSidebars();">
|
||||
onclick="ShoppingSidebarParent.urlbarButtonClick(event);">
|
||||
<image id="shopping-sidebar-button-icon"
|
||||
class="urlbar-icon"/>
|
||||
</hbox>
|
||||
#endif
|
||||
<toolbarbutton id="urlbar-zoom-button"
|
||||
onclick="FullZoom.reset(); FullZoom.resetScalingZoom();"
|
||||
onclick="FullZoom.resetFromURLBar(event);"
|
||||
tooltip="dynamic-shortcut-tooltip"
|
||||
hidden="true"/>
|
||||
<hbox id="pageActionButton"
|
||||
|
@ -24,6 +24,16 @@ export class ShoppingSidebarParent extends JSWindowActorParent {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the user clicks the URL bar button.
|
||||
*/
|
||||
static urlbarButtonClick(event) {
|
||||
if (event.button > 0) {
|
||||
return;
|
||||
}
|
||||
this.toggleAllSidebars();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles opening or closing all Shopping sidebars.
|
||||
* Sets the active pref value for all windows to respond to.
|
||||
|
@ -221,3 +221,24 @@ add_task(async function test_button_toggles_all_windows() {
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
await BrowserTestUtils.closeWindow(newWindow);
|
||||
});
|
||||
|
||||
add_task(async function test_button_right_click_doesnt_affect_sidebars() {
|
||||
Services.prefs.setBoolPref("browser.shopping.experience2023.active", false);
|
||||
|
||||
await BrowserTestUtils.withNewTab(CONTENT_PAGE, async function (browser) {
|
||||
let shoppingButton = document.getElementById("shopping-sidebar-button");
|
||||
let browserPanel = gBrowser.getPanel(browser);
|
||||
|
||||
BrowserTestUtils.loadURIString(browser, PRODUCT_PAGE);
|
||||
await BrowserTestUtils.browserLoaded(browser);
|
||||
|
||||
let sidebar = browserPanel.querySelector("shopping-sidebar");
|
||||
|
||||
is(sidebar, null, "Shopping sidebar should be closed");
|
||||
EventUtils.synthesizeMouseAtCenter(shoppingButton, { button: 1 });
|
||||
// Wait a tick.
|
||||
await new Promise(executeSoon);
|
||||
sidebar = browserPanel.querySelector("shopping-sidebar");
|
||||
is(sidebar, null, "Shopping sidebar should still be closed");
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user