mozilla / web-ext

A command line tool to help build, run, and test web extensions
Mozilla Public License 2.0
2.7k stars 338 forks source link

web-ext lint doesn't catch empty directories in _locales #3282

Open hachi opened 1 day ago

hachi commented 1 day ago

Is this a feature request or a bug?

Bug... ish?

What is the current behavior?

mkdir _locales/en_AQ

web-ext lint gives no warnings or errors, but web-ext run is unable to launch firefox

Running web extension from /home/hachi/src/stream-notifier-picarto
Profile directory /home/hachi/.web-ext-profile already exists
More info about WebExtensions debugging:
https://extensionworkshop.com/documentation/develop/debugging/

WebExtError: installTemporaryAddon: Error: Error: Could not install add-on at '/home/hachi/src/stream-notifier-picarto': Error: Extension is invalid
    at RemoteFirefox.installTemporaryAddon (file:///home/hachi/src/stream-notifier-picarto/node_modules/web-ext/lib/firefox/remote.js:94:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async FirefoxDesktopExtensionRunner.startFirefoxInstance (file:///home/hachi/src/stream-notifier-picarto/node_modules/web-ext/lib/extension-runners/firefox-desktop.js:215:27)
    at async FirefoxDesktopExtensionRunner.run (file:///home/hachi/src/stream-notifier-picarto/node_modules/web-ext/lib/extension-runners/firefox-desktop.js:48:5)
    at async Promise.all (index 0)
    at async MultiExtensionRunner.run (file:///home/hachi/src/stream-notifier-picarto/node_modules/web-ext/lib/extension-runners/index.js:67:5)
    at async run (file:///home/hachi/src/stream-notifier-picarto/node_modules/web-ext/lib/cmd/run.js:173:3)
    at async Program.execute (file:///home/hachi/src/stream-notifier-picarto/node_modules/web-ext/lib/program.js:270:7)
    at async file:///home/hachi/src/stream-notifier-picarto/node_modules/web-ext/bin/web-ext.js:13:1

No indication is given from firefox on why the extension is invalid... I cannot find where a person might even begin to report this bug in firefox too.

What is the expected or desired behavior?

Some sort of lint output to tell you that an empty locale directory is invalid and will not work at all.

It's also possible that runtime reload errors need to be exposed to the user somehow, there is no output from web-ext if you create an empty locales directory, but reloading stops.

Version information (for bug reports)

hachi commented 7 hours ago

Another note, possibly should be in another ticket... there is no validation that the directory names are well formed names (the locales standards say dashes, but firefox specifically or browsers in general want underscore and disallow dashes)

This does not result in a startup error, but the locales just "don't work" in that case, which could be unexpected behavior when browser.i18n.*Language functions all return the locale strings with dashes.