Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v117.0 #28

Merged
merged 13 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .hgtags
Original file line number Diff line number Diff line change
Expand Up @@ -4469,3 +4469,5 @@ b6ac990feb967837e10ccf2232c15c9acc4542db FIREFOX_117_0b7_RELEASE
95093682c2bb0242a3f1016d06ee0e2d33385e4b FIREFOX_RELEASE_117_BASE
e757ad893b41c97a91f46c6f3910a90738b7acb1 FIREFOX_RELEASE_116_END
49c873280890b4f137b1456cdd039814c7959a95 FIREFOX_117_0_BUILD1
27de51e74c19186044da535125895c96fc3a0f23 FIREFOX_117_0_BUILD2
27de51e74c19186044da535125895c96fc3a0f23 FIREFOX_117_0_RELEASE
2 changes: 1 addition & 1 deletion browser/app/profile/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -1857,7 +1857,7 @@ pref("browser.translation.neverForLanguages", "");

// Enable Firefox translations powered by the Bergamot translations
// engine https://browser.mt/.
pref("browser.translations.enable", true);
pref("browser.translations.enable", false);

// Telemetry settings.
// Determines if Telemetry pings can be archived locally.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
</menulist>
</vbox>

<vbox id="translations-panel-error">
<vbox id="translations-panel-error" hidden="true">
<hbox class="translations-panel-error-header">
<image class="translations-panel-error-icon translations-panel-error-header-icon" />
<description id="translations-panel-error-message"></description>
Expand Down
34 changes: 14 additions & 20 deletions browser/components/translations/content/translationsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,6 @@ var TranslationsPanel = new (class {
*/
#isPopupOpen = false;

/**
* Show the introductory message on the first load, and keep on showing it for
* this URI, until the user navigates away.
*
* @type {string | null}
*/
#firstShowUriSpec = null;

/**
* Where the lazy elements are stored.
*
Expand Down Expand Up @@ -303,7 +295,6 @@ var TranslationsPanel = new (class {
"changeSourceLanguageButton",
"translations-panel-change-source-language"
);
getter("defaultTranslate", "translations-panel-translate");
getter("dismissErrorButton", "translations-panel-dismiss-error");
getter("error", "translations-panel-error");
getter("errorMessage", "translations-panel-error-message");
Expand Down Expand Up @@ -521,7 +512,7 @@ var TranslationsPanel = new (class {
#updateViewFromTranslationStatus(
languageState = this.#getTranslationsActor().languageState
) {
const { defaultTranslate, toMenuList, fromMenuList, header, cancelButton } =
const { translateButton, toMenuList, fromMenuList, header, cancelButton } =
this.elements;
const { requestedTranslationPair, isEngineReady } = languageState;

Expand All @@ -533,18 +524,18 @@ var TranslationsPanel = new (class {
) {
// A translation has been requested, but is not ready yet.
document.l10n.setAttributes(
defaultTranslate,
translateButton,
"translations-panel-translate-button-loading"
);
defaultTranslate.disabled = true;
translateButton.disabled = true;
cancelButton.hidden = false;
this.updateUIForReTranslation(false /* isReTranslation */);
} else {
document.l10n.setAttributes(
defaultTranslate,
translateButton,
"translations-panel-translate-button"
);
defaultTranslate.disabled =
translateButton.disabled =
// The translation languages are the same, don't allow this translation.
toMenuList.value === fromMenuList.value ||
// No "to" language was provided.
Expand Down Expand Up @@ -617,7 +608,7 @@ var TranslationsPanel = new (class {
panel,
error,
toMenuList,
defaultTranslate,
translateButton,
langSelection,
intro,
header,
Expand All @@ -640,7 +631,7 @@ var TranslationsPanel = new (class {
actionCommand: () => this.#reloadLangList(),
});

defaultTranslate.disabled = true;
translateButton.disabled = true;
this.updateUIForReTranslation(false /* isReTranslation */);
cancelButton.hidden = false;
langSelection.hidden = true;
Expand Down Expand Up @@ -671,17 +662,19 @@ var TranslationsPanel = new (class {
this.updateUIForReTranslation(false /* isReTranslation */);
cancelButton.hidden = false;
multiview.setAttribute("mainViewId", "translations-panel-view-default");
let actor = this.#getTranslationsActor();

if (!this._hasShownPanel) {
this.#firstShowUriSpec = gBrowser.currentURI.spec;
actor.firstShowUriSpec = gBrowser.currentURI.spec;
}

if (
this._hasShownPanel &&
gBrowser.currentURI.spec !== this.#firstShowUriSpec
gBrowser.currentURI.spec !== actor.firstShowUriSpec
) {
document.l10n.setAttributes(header, "translations-panel-header");
this.#firstShowUriSpec === null;
actor.firstShowUriSpec = null;
intro.hidden = true;
} else {
Services.prefs.setBoolPref("browser.translations.panelShown", true);
intro.hidden = false;
Expand Down Expand Up @@ -1507,7 +1500,8 @@ var TranslationsPanel = new (class {
// button's accessible tooltip label.
if (
this._hasShownPanel &&
gBrowser.currentURI.spec !== this.#firstShowUriSpec
gBrowser.currentURI.spec !==
this.#getTranslationsActor().firstShowUriSpec
) {
document.l10n.setAttributes(
button,
Expand Down
4 changes: 4 additions & 0 deletions browser/components/translations/tests/browser/browser.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[DEFAULT]
prefs =
browser.translations.enable=true
browser.translations.automaticallyPopup=true
support-files =
head.js
!/toolkit/components/translations/tests/browser/shared-head.js
Expand All @@ -16,6 +19,7 @@ support-files =
[browser_translations_panel_engine_unsupported.js]
[browser_translations_panel_engine_unsupported_lang.js]
[browser_translations_panel_firstrun.js]
[browser_translations_panel_firstrun_revisit.js]
[browser_translations_panel_gear.js]
[browser_translations_panel_never_translate_language.js]
[browser_translations_panel_never_translate_site.js]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ add_task(async function test_translations_panel_a11y_focus() {
"The button is available."
);

await waitForTranslationsPopupEvent("popupshown", () => {
hitEnterKey(button, "Opening the popup with the Enter key.");
});
await waitForTranslationsPopupEvent(
"popupshown",
() => {
hitEnterKey(button, "Opening the popup with the Enter key.");
},
assertPanelDefaultView
);

is(
document.activeElement.getAttribute("data-l10n-id"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,13 @@ add_task(
);
});

await waitForTranslationsPopupEvent("popupshown", () => {
click(button, "Opening the popup");
});
await waitForTranslationsPopupEvent(
"popupshown",
() => {
click(button, "Opening the popup");
},
assertPanelDefaultView
);

await waitForTranslationsPopupEvent("popuphidden", () => {
click(
Expand Down Expand Up @@ -352,9 +356,13 @@ add_task(
);
});

await waitForTranslationsPopupEvent("popupshown", () => {
click(button, "Re-opening the popup");
});
await waitForTranslationsPopupEvent(
"popupshown",
() => {
click(button, "Re-opening the popup");
},
assertPanelRevisitView
);

await waitForTranslationsPopupEvent("popuphidden", () => {
click(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ add_task(
);
});

assertPanelErrorView();
info("Waiting to find the translations panel default header.");
const header = await waitForCondition(() =>
maybeGetByL10nId("translations-panel-header")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ add_task(async function test_translations_panel_basics() {
);
});

await waitForTranslationsPopupEvent("popupshown", () => {
click(button, "Opening the popup");
});
await waitForTranslationsPopupEvent(
"popupshown",
() => {
click(button, "Opening the popup");
},
assertPanelDefaultView
);

const panel = document.getElementById("translations-panel");
const label = document.getElementById(panel.getAttribute("aria-labelledby"));
Expand Down Expand Up @@ -59,9 +63,13 @@ add_task(async function test_translations_panel_basics() {

is(button.getAttribute("data-l10n-id"), "urlbar-translations-button-loading");

await waitForTranslationsPopupEvent("popupshown", () => {
click(button, "Open the popup again");
});
await waitForTranslationsPopupEvent(
"popupshown",
() => {
click(button, "Open the popup again");
},
assertPanelDefaultView
);

const loadingButton = getByL10nId(
"translations-panel-translate-button-loading"
Expand Down Expand Up @@ -103,9 +111,13 @@ add_task(async function test_translations_panel_basics() {
);
});

await waitForTranslationsPopupEvent("popupshown", () => {
click(button, "Re-opening the popup");
});
await waitForTranslationsPopupEvent(
"popupshown",
() => {
click(button, "Re-opening the popup");
},
assertPanelRevisitView
);

ok(
getByL10nId("translations-panel-translate-button").disabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ add_task(async function test_translations_panel_cancel() {
"The button is available."
);

await waitForTranslationsPopupEvent("popupshown", () => {
click(button, "Opening the popup");
});
await waitForTranslationsPopupEvent(
"popupshown",
() => {
click(button, "Opening the popup");
},
assertPanelDefaultView
);

await waitForTranslationsPopupEvent("popuphidden", () => {
click(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ add_task(async function test_unsupported_lang() {
click(appMenuButton, "Opening the app menu");
await BrowserTestUtils.waitForEvent(window.PanelUI.mainView, "ViewShown");

await waitForTranslationsPopupEvent("popupshown", () => {
click(getByL10nId("appmenuitem-translate"), "Opening the popup");
});
await waitForTranslationsPopupEvent(
"popupshown",
() => {
click(getByL10nId("appmenuitem-translate"), "Opening the popup");
},
assertPanelUnsupportedLanguageView
);

ok(
getByL10nId("translations-panel-error-unsupported"),
Expand All @@ -39,9 +43,15 @@ add_task(async function test_unsupported_lang() {
"The learn more link is available"
);

click(
getByL10nId("translations-panel-error-change-button"),
"Change the languages."
await waitForTranslationsPopupEvent(
"popupshown",
() => {
click(
getByL10nId("translations-panel-error-change-button"),
"Change the languages."
);
},
assertPanelDefaultView
);

info("Waiting to find the translations panel header.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ add_task(async function test_translations_panel_firstrun() {
"The intro message is displayed."
);

await waitForTranslationsPopupEvent("popupshown", () => {
click(button, "Opening the popup");
});
await waitForTranslationsPopupEvent(
"popupshown",
() => {
click(button, "Opening the popup");
},
assertPanelFirstShowView
);

ok(
getByL10nId("translations-panel-intro-description"),
Expand All @@ -50,9 +54,13 @@ add_task(async function test_translations_panel_firstrun() {
"The intro message is no longer there."
);

await waitForTranslationsPopupEvent("popupshown", () => {
click(button, "Opening the popup");
});
await waitForTranslationsPopupEvent(
"popupshown",
() => {
click(button, "Opening the popup");
},
assertPanelDefaultView
);

info("Checking for the intro text to be hidden.");
await waitForCondition(
Expand Down
Loading
Loading