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
This commit is contained in:
Thomas Wisniewski 2024-11-20 14:07:40 +00:00
parent 971f152c84
commit aab92dc17a
6 changed files with 88 additions and 0 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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",

View File

@ -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;

View File

@ -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;
}

View File

@ -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)