Closed Bug 1893471 Opened 5 months ago Closed 5 months ago

Ensure that the translate-full-page button is hidden on sites where full-page translations is restricted

Categories

(Firefox :: Translations, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
127 Branch
Tracking Status
firefox127 --- fixed

People

(Reporter: nordzilla, Assigned: nordzilla)

References

Details

Attachments

(5 files, 1 obsolete file)

Description

There are cases in which Select Translations will work but Full Page Translations will not. Such cases include documents where the DOM nodes are not mutable, such as PDFs, and we cannot translate the full page, but we can translate selected text.


Steps to implement

  • Check if the current page is restricted to FullPageTranslations and hide the button if so.

Tests to implement

  • Add test cases on restricted pages to ensure that the button is not visible.
Attachment #9398751 - Attachment description: WIP: Bug 1893471 - WIP → Bug 1893471 - Rename isFullPageTranslationsRestrictedForPage r=#translations-reviewers!

Renames the TranslationsParent.isTranslationsActor function
to getFullPageTranslationsActor to be more clear about the
functionality and purpose of the actor being retrieved.

Ensures that all locations where the SelectTranslationsPanel
would attempt to retrieve the FullPageTranslations actor
are handled gracefully if the FullPageTranslations actor
cannot be retrieved.

Ensures that the translate-full-page button is hidden
from the SelectTranslationsPanel when Full Page Translations
is not available on the active page.

The existing PDF file in the Translations test suite
has no content. Now that we're testing Select Translations
with PDFs, we need one with content.

Adds test infrastructure and a test case to test the
SelectTranslationsPanel functionality when a PDF
is the current page.

Attachment #9398765 - Attachment is obsolete: true
Attachment #9398766 - Attachment description: Bug 1893471 - Handle failure to retrieve FullPageTranslations actor r=#translations-reviewers! → Bug 1893471 - Handle failure to retrieve Translations actor r=#translations-reviewers!
Attachment #9398751 - Attachment description: Bug 1893471 - Rename isFullPageTranslationsRestrictedForPage r=#translations-reviewers! → Bug 1893471 - Rename TranslationsParent.isRestrictedPage r=#translations-reviewers!
Pushed by enordin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ff250016a247 Rename TranslationsParent.isRestrictedPage r=translations-reviewers,gregtatum https://hg.mozilla.org/integration/autoland/rev/11c0eba9a87b Handle failure to retrieve Translations actor r=translations-reviewers,gregtatum https://hg.mozilla.org/integration/autoland/rev/f854ec46d8a8 Ensure translate-full-page button is properly hidden r=translations-reviewers,gregtatum https://hg.mozilla.org/integration/autoland/rev/a72fc18e10be Ensure Translations PDF test file has content r=translations-reviewers,gregtatum https://hg.mozilla.org/integration/autoland/rev/85b0e38344fa Add test for Select Translations with PDFs r=translations-reviewers,gregtatum

Tested on Windows 11, Ubuntu 22 and macOS 12, I can confirm this issue is fixed, I verified with Firefox 128.0a1.
I will verify in Firefox beta, when the feature will be enabled there.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: