From aab92dc17a9035ffdb0c677c9654819bc4d303ad Mon Sep 17 00:00:00 2001 From: Thomas Wisniewski Date: Wed, 20 Nov 2024 14:07:40 +0000 Subject: [PATCH] Bug 1886591 - add a CSS intervention for la-vache-noire.com to un-hide the cookie banner; r=denschub,webcompat-reviewers Differential Revision: https://phabricator.services.mozilla.com/D228871 --- .../extensions/webcompat/data/injections.js | 14 +++++++++ ...1-la-vache-noire.com-cookie-banner-fix.css | 15 ++++++++++ browser/extensions/webcompat/moz.build | 1 + .../extensions/webcompat/data/injections.js | 14 +++++++++ ...1-la-vache-noire.com-cookie-banner-fix.css | 15 ++++++++++ .../tests/test_1886591_la-vache-noire_com.py | 29 +++++++++++++++++++ 6 files changed, 88 insertions(+) create mode 100644 browser/extensions/webcompat/injections/css/bug1886591-la-vache-noire.com-cookie-banner-fix.css create mode 100644 mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1886591-la-vache-noire.com-cookie-banner-fix.css create mode 100644 testing/webcompat/interventions/tests/test_1886591_la-vache-noire_com.py diff --git a/browser/extensions/webcompat/data/injections.js b/browser/extensions/webcompat/data/injections.js index ff56af58d666..052c3ebc8c8d 100644 --- a/browser/extensions/webcompat/data/injections.js +++ b/browser/extensions/webcompat/data/injections.js @@ -1185,6 +1185,20 @@ const AVAILABLE_INJECTIONS = [ ], }, }, + { + id: "1886591", + platform: "all", + domain: "la-vache-noire.com", + bug: "1886591", + contentScripts: { + matches: ["*://la-vache-noire.com/*"], + css: [ + { + file: "injections/css/bug1886591-la-vache-noire.com-cookie-banner-fix.css", + }, + ], + }, + }, ]; module.exports = AVAILABLE_INJECTIONS; diff --git a/browser/extensions/webcompat/injections/css/bug1886591-la-vache-noire.com-cookie-banner-fix.css b/browser/extensions/webcompat/injections/css/bug1886591-la-vache-noire.com-cookie-banner-fix.css new file mode 100644 index 000000000000..759d143e9bf5 --- /dev/null +++ b/browser/extensions/webcompat/injections/css/bug1886591-la-vache-noire.com-cookie-banner-fix.css @@ -0,0 +1,15 @@ +/* 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/. */ + +/** + * la-vache-noire.com - Cookie banner is invisible + * Bug #1886591 - https://bugzilla.mozilla.org/show_bug.cgi?id=1886591 + * WebCompat issue #131867 - https://webcompat.com/issues/131867 + * + * The site nests position:sticky elements, which renders the inner one + * as invisible. We set the inner one to position:fixed as a workaround. + */ +#cookie-bar { + position: fixed; +} diff --git a/browser/extensions/webcompat/moz.build b/browser/extensions/webcompat/moz.build index 508e14d8d161..b1ea87041221 100644 --- a/browser/extensions/webcompat/moz.build +++ b/browser/extensions/webcompat/moz.build @@ -72,6 +72,7 @@ FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["css"] += [ "injections/css/bug1879879-developers.pinterest.com-list-alignment-fix.css", "injections/css/bug1886293-futurePLC-sites-trending_scrollbars.css", "injections/css/bug1886566-quezoncity.gov.ph-iframe-height.css", + "injections/css/bug1886591-la-vache-noire.com-cookie-banner-fix.css", "injections/css/bug1886616-www.six-group.com-select-fix.css", "injections/css/bug1895051-www.zhihu.com-broken-button-fix.css", "injections/css/bug1895994-softtrans.ro-unlock-scrolling.css", diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/data/injections.js b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/data/injections.js index ff56af58d666..052c3ebc8c8d 100644 --- a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/data/injections.js +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/data/injections.js @@ -1185,6 +1185,20 @@ const AVAILABLE_INJECTIONS = [ ], }, }, + { + id: "1886591", + platform: "all", + domain: "la-vache-noire.com", + bug: "1886591", + contentScripts: { + matches: ["*://la-vache-noire.com/*"], + css: [ + { + file: "injections/css/bug1886591-la-vache-noire.com-cookie-banner-fix.css", + }, + ], + }, + }, ]; module.exports = AVAILABLE_INJECTIONS; diff --git a/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1886591-la-vache-noire.com-cookie-banner-fix.css b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1886591-la-vache-noire.com-cookie-banner-fix.css new file mode 100644 index 000000000000..759d143e9bf5 --- /dev/null +++ b/mobile/android/android-components/components/feature/webcompat/src/main/assets/extensions/webcompat/injections/css/bug1886591-la-vache-noire.com-cookie-banner-fix.css @@ -0,0 +1,15 @@ +/* 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/. */ + +/** + * la-vache-noire.com - Cookie banner is invisible + * Bug #1886591 - https://bugzilla.mozilla.org/show_bug.cgi?id=1886591 + * WebCompat issue #131867 - https://webcompat.com/issues/131867 + * + * The site nests position:sticky elements, which renders the inner one + * as invisible. We set the inner one to position:fixed as a workaround. + */ +#cookie-bar { + position: fixed; +} diff --git a/testing/webcompat/interventions/tests/test_1886591_la-vache-noire_com.py b/testing/webcompat/interventions/tests/test_1886591_la-vache-noire_com.py new file mode 100644 index 000000000000..608ada50aaba --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1886591_la-vache-noire_com.py @@ -0,0 +1,29 @@ +import pytest + +URL = "https://la-vache-noire.com/" + +COOKIES_CSS = "#cookie-bar" + + +async def is_cookie_banner_visible(client): + await client.navigate(URL, wait="none") + cookies = client.await_css(COOKIES_CSS, is_displayed=True) + return client.execute_script( + """ + const b = arguments[0].getBoundingClientRect(); + return window.innerHeight - b.y == b.height; + """, + cookies, + ) + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert await is_cookie_banner_visible(client) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert not await is_cookie_banner_visible(client)