tor-browser

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

commit fa9c5cdb882ab842125b67c0238b94b24387d0c9
parent c19e111530352ec43e513d5e40f8a9c9846a2b27
Author: Thomas Wisniewski <twisniewski@mozilla.com>
Date:   Fri, 31 Oct 2025 15:54:28 +0000

Bug 1967510 - remove our webcompat copy/paste intervention for gemini.google.com; r=webcompat-reviewers,ksenia

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

Diffstat:
Mbrowser/extensions/webcompat/data/interventions.json | 19-------------------
Dbrowser/extensions/webcompat/injections/js/bug1967510-gemini.google.com-fix-copy-pasting-between-inputs.js | 31-------------------------------
Mtesting/webcompat/interventions/tests/test_1967510_gemini_google_com.py | 59++---------------------------------------------------------
3 files changed, 2 insertions(+), 107 deletions(-)

diff --git a/browser/extensions/webcompat/data/interventions.json b/browser/extensions/webcompat/data/interventions.json @@ -5035,25 +5035,6 @@ } ] }, - "1967510": { - "label": "gemini.google.com", - "bugs": { - "1967510": { - "issue": "broken-editor", - "matches": ["*://gemini.google.com/*"] - } - }, - "interventions": [ - { - "platforms": ["desktop"], - "content_scripts": { - "js": [ - "bug1967510-gemini.google.com-fix-copy-pasting-between-inputs.js" - ] - } - } - ] - }, "1967694": { "label": "onlyfaucet.com", "bugs": { diff --git a/browser/extensions/webcompat/injections/js/bug1967510-gemini.google.com-fix-copy-pasting-between-inputs.js b/browser/extensions/webcompat/injections/js/bug1967510-gemini.google.com-fix-copy-pasting-between-inputs.js @@ -1,31 +0,0 @@ -/* 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/. */ - -"use strict"; - -/* - * Bug 1967510 - gemini.google.com copy-pasting between inputs does not work - * - * When editing a prompt and copying some text, they call setData with an empty string - * for text/html. Firefox dutifully sets that value, other browsers ignore it. Then when - * trying to paste, they check if it's an empty string and ignore it, so pasting the value - * does nothing. We can work around this interop quirk by just clearing that empty data. - */ - -/* globals exportFunction, cloneInto */ - -console.info( - "Overriding DataTransfer.setData compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1967510 for details." -); - -const { prototype } = DataTransfer.wrappedJSObject; -const desc = Object.getOwnPropertyDescriptor(prototype, "setData"); -const { value } = desc; -desc.value = exportFunction(function (format, data) { - value.call(this, format, data); - if (data === "") { - this.clearData("text/html"); - } -}, window); -Object.defineProperty(prototype, "setData", desc); diff --git a/testing/webcompat/interventions/tests/test_1967510_gemini_google_com.py b/testing/webcompat/interventions/tests/test_1967510_gemini_google_com.py @@ -38,63 +38,8 @@ async def check_paste_works(client): ) -async def check_addons_work(client): - # This is a regression test for the issue described in - # https://bugzilla.mozilla.org/show_bug.cgi?id=1967510#c25. - client.install_addon( - { - "manifest.json": """{ - "manifest_version": 2, - "name": "Pasting Test", - "version": "1.0", - "content_scripts": [ - { - "matches": ["*://gemini.google.com/*"], - "js": ["test.js"] - } - ] - } - """, - "test.js": """ - document.addEventListener("paste", e => { - const clipboardInit = cloneInto({}, window); - clipboardInit.clipboardData = new DataTransfer(); - const newEvent = new wrappedJSObject.ClipboardEvent(e.type, clipboardInit); - try { - newEvent.clipboardData.setData("text/plain", e.clipboardData.getData("text/plain")); - console.error("Test result: success"); - } catch (_) { - console.error("Test result: failed"); - } - }); - """, - } - ) - await client.navigate(URL) - client.set_clipboard("test") - client.await_css(ADD_PROMPT_CSS, is_displayed=True).click() - promise = await client.promise_console_message_listener("Test result:") - client.do_paste() - msg = (await promise)["args"][0]["value"] - assert msg == "Test result: success" - - -@pytest.mark.skip_platforms("android") -@pytest.mark.asyncio -@pytest.mark.with_interventions -async def test_enabled(client): - assert await check_paste_works(client) - - -@pytest.mark.skip_platforms("android") -@pytest.mark.asyncio -@pytest.mark.with_interventions -async def test_addons_works(client): - await check_addons_work(client) - - @pytest.mark.skip_platforms("android") @pytest.mark.asyncio @pytest.mark.without_interventions -async def test_disabled(client): - assert not await check_paste_works(client) +async def test_regression(client): + assert await check_paste_works(client)