### Description After discussing with community members and some of the Mozilla Addons folks, we have decided that Full Page Translations should be supported on `moz-extension://` URLs. This has the potential to be a good first bug, since the primary updates are not around core, critical functionality, but around allow-list behavior. It should be relatively few lines of code. Note, however, that there may be complexities in setting up automated testing for this bug that are not as simple. I'm going to go ahead and mark this as `good-next-bug` instead of `good-first-bug`. --- ### Steps to Implement 1) You should first verify that Full Page Translations is _not_ available in the current state of their local Firefox build. I recommend manual testing with the the Remote Settings Devtools extension. You can download the `remote-settings-devtools.xpi` file from the [releases page](https://github.com/mozilla-extensions/remote-settings-devtools/releases). Once installed, you can open the extension page by clicking on the puzzle-piece button near the top-right of the browser. Once open, you can access Full Page Translations by clicking the three-line Application Menu directly next to the extensions button. You should see that the "Translate page..." option is disabled. 2) You will have to update which URL schemes are allowed within the [TranslationsParent](https://searchfox.org/mozilla-central/rev/ae658df8b2e28234092cec19d3f07e32e119924e/toolkit/components/translations/actors/TranslationsParent.sys.mjs#832-857) JS actor, adding `moz-extension` to the list of allowed schemes. Take careful note of the comments within this function, since there is another place within the code base where this logic will have to be updated. 3) If done correctly, you should be able to rebuild and launch Firefox, then test that you now have access to translate the extension page. 4) At this point the implementation is complete. It's always a good idea to run the full Translations test suite to ensure that you haven't regressed anything. ``` ❯ python3 toolkit/components/translations/tests/scripts/download-translations-artifacts.py (Then follow the next steps outline by this script's output.) ❯ ./mach test --headless toolkit/components/translations/tests browser/components/translations/tests ``` Ideally this change has not regressed any tests in our test suite. ### Tests to Implement Now that it's working, we still can't land the functionality until it is tested. You will have to add a new test page to the Translations test suite that uses a `moz-extension` URL. I have not personally done this before, and it may prove to have some hidden complexity compared to the implementation portion. At a glance, it looks like you may be able to [import ExtensionTestUtils](https://searchfox.org/mozilla-central/rev/ae658df8b2e28234092cec19d3f07e32e119924e/devtools/client/shared/remote-debugging/adb/xpcshell/test_adb.js#6-7) like so. You will want to add this to the rest of our imports in [shared-head.js](https://searchfox.org/mozilla-central/rev/ae658df8b2e28234092cec19d3f07e32e119924e/toolkit/components/translations/tests/browser/shared-head.js#6-17). You would then need to look into getting an actual `moz-extension://` page to load in a mochitest within the Translations test suite. Alternatively, if that proves to be difficult, we could try adding a test to an area of the code base that already tests extension pages, and instead trigger the full-page translation there.
Bug 1948995 Comment 0 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
### Description After discussing with community members and some of the Mozilla Addons folks, we have decided that Full Page Translations should be supported on `moz-extension://` URLs. This has the potential to be a good first bug, since the primary updates are not around core, critical functionality, but around allow-list behavior. It should be relatively few lines of code. Note, however, that there may be complexities in setting up automated testing for this bug that are not as simple. I'm going to go ahead and mark this as `good-next-bug` instead of `good-first-bug`. --- ### Steps to Implement 1) You should first verify that Full Page Translations is _not_ available in the current state of their local Firefox build. I recommend manual testing with the the Remote Settings Devtools extension. You can download the `remote-settings-devtools.xpi` file from the [releases page](https://github.com/mozilla-extensions/remote-settings-devtools/releases). Once installed, you can open the extension page by clicking on the puzzle-piece button near the top-right of the browser. Once open, you can access Full Page Translations by clicking the three-line Application Menu directly next to the extensions button. You should see that the "Translate page..." option is disabled. 2) You will have to update which URL schemes are allowed within the [TranslationsParent](https://searchfox.org/mozilla-central/rev/ae658df8b2e28234092cec19d3f07e32e119924e/toolkit/components/translations/actors/TranslationsParent.sys.mjs#832-857) JS actor, adding `moz-extension` to the list of allowed schemes. Take careful note of the comments within this function, since there is another place within the code base where this logic will have to be updated. 3) If done correctly, you should be able to rebuild and launch Firefox, then test that you now have access to translate the extension page. 4) At this point the implementation is complete. It's always a good idea to run the full Translations test suite to ensure that you haven't regressed anything. ``` ❯ python3 toolkit/components/translations/tests/scripts/download-translations-artifacts.py (Then follow the next steps outline by this script's output.) ❯ ./mach test --headless toolkit/components/translations/tests browser/components/translations/tests ``` Ideally this change has not regressed any tests in our test suite. --- ### Tests to Implement Now that it's working, we still can't land the functionality until it is tested. You will have to add a new test page to the Translations test suite that uses a `moz-extension` URL. I have not personally done this before, and it may prove to have some hidden complexity compared to the implementation portion. At a glance, it looks like you may be able to [import ExtensionTestUtils](https://searchfox.org/mozilla-central/rev/ae658df8b2e28234092cec19d3f07e32e119924e/devtools/client/shared/remote-debugging/adb/xpcshell/test_adb.js#6-7) like so. You will want to add this to the rest of our imports in [shared-head.js](https://searchfox.org/mozilla-central/rev/ae658df8b2e28234092cec19d3f07e32e119924e/toolkit/components/translations/tests/browser/shared-head.js#6-17). You would then need to look into getting an actual `moz-extension://` page to load in a mochitest within the Translations test suite. Alternatively, if that proves to be difficult, we could try adding a test to an area of the code base that already tests extension pages, and instead trigger the full-page translation there.