tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit b7c64a2151db790567ccbc506705aaa2478ffff9
parent 60ab53bc551d336922388abd75de1d0dbc735097
Author: Thomas Wisniewski <twisniewski@mozilla.com>
Date:   Tue, 21 Oct 2025 14:47:22 +0000

Bug 1729435 - add a CSS webcompat intervention for milkbarstore.com; r=webcompat-reviewers,ksenia

Differential Revision: https://phabricator.services.mozilla.com/D269315

Diffstat:
Mbrowser/extensions/webcompat/data/interventions.json | 17+++++++++++++++++
Abrowser/extensions/webcompat/injections/css/1729435_milkbarstore.com-fix-cart-quantity-counts.css | 20++++++++++++++++++++
Atesting/webcompat/interventions/tests/test_1729435_milkbarstore_com.py | 33+++++++++++++++++++++++++++++++++
3 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/browser/extensions/webcompat/data/interventions.json b/browser/extensions/webcompat/data/interventions.json @@ -514,6 +514,23 @@ } ] }, + "1729435": { + "label": "milkbarstore.com", + "bugs": { + "1729435": { + "issue": "broken-interactive-elements", + "matches": ["*://milkbarstore.com/*"] + } + }, + "interventions": [ + { + "platforms": ["all"], + "content_scripts": { + "css": ["1729435_milkbarstore.com-fix-cart-quantity-counts.css"] + } + } + ] + }, "1739489": { "label": "Sites using draft.js", "bugs": { diff --git a/browser/extensions/webcompat/injections/css/1729435_milkbarstore.com-fix-cart-quantity-counts.css b/browser/extensions/webcompat/injections/css/1729435_milkbarstore.com-fix-cart-quantity-counts.css @@ -0,0 +1,20 @@ +/* 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/. */ + +/** + * milkbarstore.com - cart quantities are not displayed properly + * Bug #1729435 - https://bugzilla.mozilla.org/show_bug.cgi?id=1729435 + * + * The site is using non-standard CSS incorrectly, which leads to the + * product quantities in their carts being obscured. We can fix it. + */ +#cart-main .scroll-pane .items .quantity-wrapper input[name="quantity"] { + height: 35px; + border: 0; + text-align: center; + width: 45px; + appearance: textfield; + font-family: "Garnett Bold", sans-serif; + font-weight: 700; +} diff --git a/testing/webcompat/interventions/tests/test_1729435_milkbarstore_com.py b/testing/webcompat/interventions/tests/test_1729435_milkbarstore_com.py @@ -0,0 +1,33 @@ +import pytest + +URL = "https://milkbarstore.com/products/assorted-cookie-tin" +ADD_TO_CART_CSS = "#ProductSubmitButton-pdp__main" +INCREASE_QUANTITY_CSS = ".quantity-wrapper button.change-quantity.inc" +QUANTITY_WRAPPER_CSS = ".quantity-wrapper" + + +async def do_cart_quantities_appear(client): + # A screenshot of the quantity lines will show the spinner + # arrows of the number-inputs when the site bug manifests. + client.hide_elements("[id^=alia-root]") + await client.navigate(URL, wait="none") + client.await_css(ADD_TO_CART_CSS, is_displayed=True).click() + inc = client.await_css(INCREASE_QUANTITY_CSS, is_displayed=True) + await client.stall(1) + pre = client.await_css(QUANTITY_WRAPPER_CSS).screenshot() + inc.click() + await client.stall(1) + post = client.await_css(QUANTITY_WRAPPER_CSS).screenshot() + return pre != post + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert await do_cart_quantities_appear(client) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert not await do_cart_quantities_appear(client)