Repository navigation
Firefox support for addons.mozilla.org - #4
Merged
Merged
Conversation
`node scripts/build.mjs --firefox` writes dist/firefox with a Firefox manifest: an event-page background, no offscreen permission, a gecko id, Firefox 140 as the minimum and data_collection_permissions "none", which addons.mozilla.org now requires of new add-ons. An esbuild __FIREFOX__ define selects the Firefox code paths, so the Chrome bundles drop them. `package.mjs --firefox` zips it, and package-source.mjs builds the source archive AMO asks for when the bundle is minified. It uses git archive through a throwaway index, so uncommitted files are included and ignored files (node_modules, dist, model weights) are not. Refs: #3
- Model: Firefox has no offscreen documents, but its background page has a DOM. The model page runs there in an iframe and gets the same runtime messages. Its idle timer removes the frame, since an iframe can't close itself. - Vault: content scripts can't read storage.session in Firefox (setAccessLevel is unsupported). The background answers pg:vault:get with the sender's own site's vault only, and sends pg:vault:changed to that site's tabs when it changes. - Rich editors: Firefox ignores clipboardData in a synthetic paste's init and hides data a content script sets from the page. Write it through the event's wrappedJSObject, or ProseMirror composers drop line breaks. - Extra sites: Firefox match patterns with a port never match, so the pattern covers the host on any port. permissions.onAdded finishes adding the site in case the popup closes when the permission prompt opens. Refs: #3
Loads the Firefox test build over WebDriver BiDi and covers the paths that differ from Chrome: model redaction from the background-page iframe, vault handoff and copy restore, forget from the options page, sites added through permissions.onAdded, the model reloading after the background page suspends, and console errors from every context. Refs: #3
BUILD_FIREFOX.md gives addons.mozilla.org reviewers the environment, the three commands that rebuild the submitted package file for file, what fetch:model downloads, where each packaged file comes from, and why the lint warnings in onnxruntime-web's bundle are harmless. Refs: #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3
Changes
node scripts/build.mjs --firefoxwritesdist/firefox. The manifest gets an event-page background, nooffscreenpermission, gecko idpasteguard@dhiva-labs, Firefox 140 minimum anddata_collection_permissions: none. An esbuild__FIREFOX__define removes the Firefox code from the Chrome bundles.npm run package:firefoxmakesdist/pasteguard-firefox-<v>.zip.npm run package:sourcemakes the source archive that AMO requires for minified code.pg:vault:getand are told when it changes, becausestorage.sessionis closed to them there.permissions.onAddedfinishes adding a site if the popup closes during the permission prompt.npm run test:e2e:firefox),docs/BUILD_FIREFOX.mdfor AMO reviewers, and README and architecture notes.The Chrome build has the same behaviour as before. Rebuilt without identifier minification,
content.js,offscreen.jsandoptions.jsmatchmainexactly.service-worker.jsandpopup.jsdiffer only by a helper that returns the same${origin}/*string.Testing
npm test, 26/26.npm run build:test && npm run test:e2e, 12/12.npm run test:e2e:firefoxon Firefox 157, 12/12. It checks:permissions.onAddedweb-ext lintgives 0 errors and 3 warnings. Two are in onnxruntime-web's bundle; the third is the Android minimum version. All three are explained inBUILD_FIREFOX.md.npm ci,fetch:model,build.mjs --firefox), matches the Firefox zip file for file.pasteguard-ai, version 0.1.0, awaiting review.