mozilla / node-fx-runner

Node API to control Firefox
Mozilla Public License 2.0
12 stars 21 forks source link

`firefoxdeveloperedition` alias resolves surprisingly on macOS #47

Closed watters closed 4 years ago

watters commented 4 years ago

Line 117 of lib/utils.js:

"deved on osx": "/Applications/FirefoxDeveloperEdition.app/Contents/MacOS/firefox-bin",

However, when downloading Firefox Developer Edition from the official download link on mozilla.org, the application downloaded is named 'Firefox Developer Edition.app' (with spaces). As such, if someone downloads Firefox Developer Edition and attempts to use the firefoxdeveloperedition alias, out of the box, it will fail with an error message like:

Error: spawn /Applications/FirefoxDeveloperEdition.app/Contents/MacOS/firefox-bin ENOENT

(This particular error occurs when passing the alias to the --firefox option to web-ext, which delegates alias resolution to fx-runner)

This can be naively fixed by adding spaces to the path noted above, but that would break backwards compat for anyone who has adjusted to the current behavior.

Happy to take a run at doing the work to fix this myself, but thought it better to seek basic assent via Issue before submitting a PR.

watters commented 4 years ago

It looks like the combined logic of normalizeBinary (binaryPath, platform, arch) and findMacAppByChannel(channel, opt) with respect to the 'firefoxdeveloperedition' alias may be broken as well.

As currently written, it appears to look for a bundle with a kMDItemCFBundleIdentifier of org.mozilla.deved, but the actual value is:

kMDItemCFBundleIdentifier = "org.mozilla.firefoxdeveloperedition"

Upon further review, I suspect #44 introduced a regression by changing firefoxdeveloperedition to deved. That change prevented the call to findMacAppByChannel(channel, opt) from successfully finding installed an installed copy of Firefox Developer Edition via mdfind.

Rob--W commented 4 years ago

The paths used to be correct, but 3 years ago the spaces were added in https://bugzilla.mozilla.org/show_bug.cgi?id=1404796

In https://github.com/mozilla/web-ext/issues/1960 you mentioned that you'd be interested in putting up a patch. I would gladly review it.

watters commented 4 years ago

I'll get something submitted for review ASAP.