Repository navigation
Improve support for mobile Firefox - #7480
Conversation
remove uneeded console log
fregante
left a comment
There was a problem hiding this comment.
Good idea. I think the detection should look like "does this device have context menus"? This should probably also cover iPadOS. Ideally the chrome API can answer this question, but further exploration would be needed.
| { | ||
| // GHE support | ||
| addPermissionToggle(); | ||
| addPermissionToggle(); |
There was a problem hiding this comment.
Hm, i don't believe browser.contextMenus is defined on browsers that don't support them, so maybe a check to see if it is undefined or not could be useful, if there isn't a chrome api solution available?
There was a problem hiding this comment.
That appears to be accurate: fregante/webext-permission-toggle#26
So you can just drop the mobile/safari check and replace it with !chrome.contextMenus
addPermissionToggle has its own check inside so this specific change isn't needed here
There was a problem hiding this comment.
The following error gets thrown on Firefox for android with the doesBrowserActionOpenOptions check removed on addPermissionToggle
00:13:02.267 Uncaught Error: webext-permission-toggle requires the `contextMenus` permission
addPermissionToggle moz-extension://24fb74ed-aa72-4132-a59d-33a31291dced/assets/background.js:5183
<anonymous> moz-extension://24fb74ed-aa72-4132-a59d-33a31291dced/assets/background.js:5857
<anonymous> moz-extension://24fb74ed-aa72-4132-a59d-33a31291dced/assets/background.js:5961
<anonymous> moz-extension://24fb74ed-aa72-4132-a59d-33a31291dced/assets/background.js:5963
background.js:5183:15
addPermissionToggle moz-extension://24fb74ed-aa72-4132-a59d-33a31291dced/assets/background.js:5183
<anonymous> moz-extension://24fb74ed-aa72-4132-a59d-33a31291dced/assets/background.js:5857
<anonymous> moz-extension://24fb74ed-aa72-4132-a59d-33a31291dced/assets/background.js:5961
<anonymous> moz-extension://24fb74ed-aa72-4132-a59d-33a31291dced/assets/background.js:5963
This prevents the action button from doing anything when pressed.
There was a problem hiding this comment.
Thanks for checking 🙏
What does the permissions array looks like there? The getter should return the manifest as is, is Firefox altering the manifest and removing the permission that does exist in the manifest?
Can you try console.log(chrome.runtime.getManifest())?
There was a problem hiding this comment.
fregante
left a comment
There was a problem hiding this comment.
This is good here, I'll send a PR to the other package and then publish it. It can then be installed here and merged
|
Does it work in both FirefoxAndroid and Kiwi? |
|
I just realized, if |
Yep, it works on firefox for android with that change. Attempted to load it on kiwi, and it looks like it can't install the extension at the moment, probably due to this issue. https://github.com/kiwibrowser/src.next/issues/1138 |
|
Thank you! If you’re installing a local build, you can change the manifest locally and double-check. But yeah they still wouldn’t be able to install 24.6.21 and future updates. However… as part of #7477 I can remove the |
removing when tapping the action button, it takes me to github, like the desktop version does. I guess the contextMenus check doesn't work as intended on kiwi, but the background script isn't getting killed, at least. Maybe it supports the contextMenus permission and chrome.contextMenus isn't undefined, but It doesn't seem like long pressing the button or anything triggers it. Heading to bed, so i won't be able to narrow down that issue, at the moment. |
|
A couple of things:
The lack of updates also explains why a v121 feature still isn't available ( I'm going to keep dropping |



Description
This change is made to detect if the user is on a mobile platform (ios or android), instead of just looking for mobile Safari, or explicitly checking for user agents of mobile browsers.
Mobile safari, and other mobile browsers like Kiwi and Firefox for Android do not support context menus.
This change allows android browsers to access the options page.
getPlatformInfoseems to have fairly wide browser support, so it should be fine to use, instead of checking the user agent, likewebext-detect-pagedoes.https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/getPlatformInfo
This method is used, because
webext-detect-pagedoes not seem to have functions to detect mobile browsers other than Safari.This has only been tested on Firefox for android, and Firefox on windows. Kiwi on android should behave similarly, but i do not have an ios device to test mobile Safari.
Test URLs
Affects browser action button on mobile browsers, not URLs.
Screenshot