null-dev / firefox-profile-switcher-connector

Native connector software for the 'Profile Switcher for Firefox' extension.
GNU General Public License v3.0
125 stars 25 forks source link

Starts new instances in Rossetta on M1 macs #4

Closed MattHardcastle closed 3 years ago

MattHardcastle commented 3 years ago

When I open a new profile on an M1 Mac the Firefox instance is running with Intel emulation. I'd expect it to be running natively. My original Firefox instance is running natively.

The ff-pswitch-connector on my machine is X86_64.

% file /usr/local/bin/ff-pswitch-connector
/usr/local/bin/ff-pswitch-connector: Mach-O 64-bit executable x86_64
MattHardcastle commented 3 years ago

I compiled ff-pswitch-connector for m1 but Firefox is not refusing to run connector. It's failing with the follow error:

Promise rejected after context unloaded: Actor 'Conduits' destroyed before query 'RuntimeMessage' was resolved
native.js:96
    nativeRequest moz-extension://6366f366-bfca-6e49-9b4c-cf4fade11c7d/js/native.js:96
Screen Shot 2021-06-19 at 12 00 05 AM
null-dev commented 3 years ago

You built the connector using the homebrew tap right? Can you check if the rust toolchain on your system is native?

MattHardcastle commented 3 years ago

Yeah, I used the tap. It was using the Intel toolchain, which explains why its launching the Intel Firefox. I built it on m1 and ran into two issues: 1) Firefox (running on m1) isn't connecting to the m1 version of the connector. There's a screenshot of that error in the comment above. 2) m1 homebrew no longer defaults to /usr/local, so when you brew install the connector Firefox can't find it.

I was also able to create a universal binary for the connector but it had the some launching issue that the m1 only version did. (I haven't tested it on Intel yet.)

null-dev commented 3 years ago

Hmm, I believe that's actually a warning disguised as an error so I don't think it's the cause of the issue. Can you go to this URL: about:debugging#/runtime/this-firefox and inspect the extension? There might be better logs in there.

MattHardcastle commented 3 years ago

Hmm, I believe that's actually a warning disguised as an error so I don't think it's the cause of the issue. Can you go to this URL: about:debugging#/runtime/this-firefox and inspect the extension? There might be better logs in there.

Thank you! I was wondering where the full logs were. This helped me find my issue. The M1 version was failing on my machine because the manifest was missing. When I moved to the M1 native brew I uninstalled the Intel brew which removed the manifest file. With no manifest file Firefox couldn't find the native app. The problem was between the keyboard and chair. 😉

The universal app version I built is working on M1 and Intel Macs.