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

Fix MV3 on Firefox for Android #7464

Merged
merged 8 commits into from
May 29, 2024

Conversation

Samq64
Copy link
Member

@Samq64 Samq64 commented May 24, 2024

Resolves #6976
Resolves #7461

Changes

Sets the viewport on the popup and checks if chrome.contextMenus is defined before using it since it errors on Firefox for Android now.

Also removes some weird icon handling I added back in #4810. Now it always uses the icons set in the extension's manifest.

Reason for changes

The popup wasn't scaling correctly and after MV3 the extension completely broke. It's also nice to be able distinguish Git versions even if they're stable.

Tests

Tested on Andorid Firefox Beta, desktop Firefox and Chromium. The viewport doesn't seem to change the popup on Desktop and Firefox works on Android again including Scratch notifier.

@Samq64 Samq64 added platform: firefox Related to Firefox (All those darn bugs only on firefox) scope: webpages Related to the web pages (settings page, pop-up, etc) scope: core Related to the core script/extension workings platform: mobile Related to compatibility with touch screen devices labels May 24, 2024
@Samq64 Samq64 changed the title Fix on Firefox for Android Fix MV3 on Firefox for Android May 24, 2024
@Samq64
Copy link
Member Author

Samq64 commented May 25, 2024

To test on Android:

  1. Install ADB and web-ext
  2. On Android install Firefox beta
  3. Enable the developer options by repeatedly tapping the build number in Android OS settings
  4. Enable USB debugging in the developer options (still in device settings!)
  5. In Firefox beta enable remote debugging via USB
  6. Plug the Android device into the computer and tap allow every time it asks
  7. Open a terminal in the Scratch Addons directory
  8. Run adb devices
  9. Run web-ext run -t firefox-android --adb-device ABC123 --firefox-apk org.mozilla.firefox_beta with ABC123 being the device ID from the previous command
  10. The extension should install. Tap OK.
  11. If it doesn't, completely close Firefox Beta and run the command again.
  12. If a purple message appears it has to be dismissed since it steals all focus.

To inspect the extension:

  1. On desktop Firefox open about:debugging
  2. Click enable USB debugging
  3. Click connect on the device in the sidebar
  4. If it doesn't show up restart desktop Firefox
  5. The extension card should show up similar a desktop one.

@Samq64 Samq64 added the priority: 2 High priority. Includes crashes, major bugs and important features label May 25, 2024
@BroJac5246
Copy link
Contributor

On Android install Firefox beta

This also works on regular Firefox, you just have to change the package name in the web-ext command to org.mozilla.firefox.
They need a better way to do this than using ADB but at least it works...

Anyhoo, can confirm the extension now works (Firefox for Android Stable 126.0; Android 14 QPR2 on Google Pixel 7a). I can't test everything but the extension loads correctly and the addons I try seem to work correctly (at least as well as they can on mobile).

The initial permissions page didn't display correctly in either orientation but was usable exclusively in portrait mode. I don't know if that's a new development, however. Either way, we should get this out as soon as possible as long as it's confirmed this won't break anything on desktop browsers.

@WorldLanguages
Copy link
Member

Thanks for figuring out how to test on mobile Firefox, I wasn't that lucky as I got some weird error when trying to run the web-ext command.

@@ -2,6 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this cause some issues on desktop? 🤔 The size of the popup has frequently created problems.
Maybe to be on the safe side we should add this dynamically with JavaScript if the user agent matches mobile Chromium or mobile Firefox?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't noticed any problems so far and Vue 3 also adds it but it's better to be safe I guess.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless it's handled differently in extension popups for some reason, the viewport tag has no effect on desktop.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then let's assume this didn't break anything unless we've got proof otherwise

@WorldLanguages WorldLanguages merged commit 90e0675 into ScratchAddons:master May 29, 2024
2 checks passed
@Samq64 Samq64 deleted the fix-firefox-android branch May 29, 2024 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: firefox Related to Firefox (All those darn bugs only on firefox) platform: mobile Related to compatibility with touch screen devices priority: 2 High priority. Includes crashes, major bugs and important features scope: core Related to the core script/extension workings scope: webpages Related to the web pages (settings page, pop-up, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Doesn't work on Android Firefox since the recent update Popup very zommed out on Firefox Android
4 participants