Skip to content

Add compatibility layer for Firefox Android#5215

Draft
bovine3dom wants to merge 5 commits into
masterfrom
android_gates
Draft

Add compatibility layer for Firefox Android#5215
bovine3dom wants to merge 5 commits into
masterfrom
android_gates

Conversation

@bovine3dom
Copy link
Copy Markdown
Member

In theory #4413 should just become a game of whack-a-mole now working through the errors and adding compat / notImplemented to them

@bovine3dom
Copy link
Copy Markdown
Member Author

~/p/tridactyl (android_gates|✔) $ node_modules/.bin/eslint --rulesdir custom-eslint-rules --ext .ts . | awk '{print $3}' | sort | uniq

bookmarks.create
bookmarks.getTree
bookmarks.remove
bookmarks.search
commands.getAll
commands.onCommand
commands.update
find.find
history.search
omnibox.onInputEntered
omnibox.setDefaultSuggestion
problems
runtime.sendNativeMessage
search.get
search.search
sessions.getRecentlyClosed
sessions.getTabValue
sessions.getWindowValue
sessions.removeTabValue
sessions.removeWindowValue
sessions.restore
sessions.setTabValue
sessions.setWindowValue
sidebarAction.close
sidebarAction.open
sidebarAction.setPanel
sidebarAction.toggle
tabs.discard
tabs.duplicate
tabs.getZoom
tabs.hide
tabs.move
tabs.onMoved
tabs.setZoom
tabs.show
tabs.toggleReaderMode
windows.get
windows.getAll
windows.getCurrent
windows.getLastFocused
windows.remove
windows.update

@bovine3dom
Copy link
Copy Markdown
Member Author

it looks like Firefox Android doesn't support history.search, lol, so i am wondering what the point of doing this is

i swear i remember using it before so i guess they tore it out when they quantum-ified it

Comment thread src/lib/compat.ts
export const windows = {
create: async (props: browser.windows._CreateCreateData) => {
if (!(await isAndroid())) {
// eslint-disable-next-line unsupported-apis
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

one problem with this pattern is that we're promising to support all browsers that reach this line

not sure if there's an obvious fix?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It might be useful to simply put such questions on https://support.mozilla.org/

@bovine3dom
Copy link
Copy Markdown
Member Author

Made some decent progress on this

two things are annoying me:

  • eslint-disable unsupported-apis disables the rules totally - i.e. we are claiming that the code is safe to run in all browsers, i would like to be able only disable it for firefox_android and/or chrome

  • i should make compat work with browserBg because at the moment all the compat workarounds that apply to browserBg are outside of lib/compat.ts. ideally, unsupported-apis should only ever be disabled in lib/compat.ts

@bovine3dom
Copy link
Copy Markdown
Member Author

  /home/runner/work/tridactyl/tridactyl/src/lib/compat.ts:11
          return browser.runtime.getPlatformInfo().then(info => {
                                 ^
  
  TypeError: browser.runtime.getPlatformInfo is not a function

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/getPlatformInfo

i guess we need to add a mock for it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants