Fix Firefox native messaging: separate manifests and expose disconnect reason
CI / Build & Test (push) Successful in 3m9s
CI / Build & Test (push) Successful in 3m9s
- Firefox rejects native messaging manifest if allowed_origins is present. Install script now writes Chrome-only manifest (allowed_origins) and Firefox-only manifest (allowed_extensions) to their respective locations. - Fix local Firefox manifest by removing allowed_origins. - Log disconnect reason from port.error (Firefox) in addition to runtime.lastError (Chrome) so native messaging failures are visible. - Log getState failures on disconnect for easier debugging.
This commit is contained in:
+26
-6
@@ -164,35 +164,55 @@ curl -fsSL "${RELEASE_BASE}/${EXT_XPI}" -o "${DOWNLOADS}/${EXT_XPI}" 2>/dev/null
|
||||
# ── Native messaging manifest ──────────────────────────────────────────────────
|
||||
echo "Installing native messaging manifest..."
|
||||
|
||||
MANIFEST=$(cat <<JSON
|
||||
MANIFEST_CHROME=$(cat <<JSON
|
||||
{
|
||||
"name": "com.holesail.browser",
|
||||
"description": "Holesail Browser native host",
|
||||
"path": "${HOST_BIN}",
|
||||
"type": "stdio",
|
||||
"allowed_origins": ["chrome-extension://fmcenppcipeikpnpopolicnllljclmmi/"]
|
||||
}
|
||||
JSON
|
||||
)
|
||||
|
||||
MANIFEST_FIREFOX=$(cat <<JSON
|
||||
{
|
||||
"name": "com.holesail.browser",
|
||||
"description": "Holesail Browser native host",
|
||||
"path": "${HOST_BIN}",
|
||||
"type": "stdio",
|
||||
"allowed_origins": ["chrome-extension://fmcenppcipeikpnpopolicnllljclmmi/"],
|
||||
"allowed_extensions": ["[email protected]"]
|
||||
}
|
||||
JSON
|
||||
)
|
||||
|
||||
if [[ "$PLATFORM" == "darwin" ]]; then
|
||||
DIRS=(
|
||||
CHROME_DIRS=(
|
||||
"$HOME/Library/Application Support/Google/Chrome/NativeMessagingHosts"
|
||||
"$HOME/Library/Application Support/Chromium/NativeMessagingHosts"
|
||||
)
|
||||
FIREFOX_DIRS=(
|
||||
"$HOME/Library/Application Support/Mozilla/NativeMessagingHosts"
|
||||
)
|
||||
else
|
||||
DIRS=(
|
||||
CHROME_DIRS=(
|
||||
"$HOME/.config/google-chrome/NativeMessagingHosts"
|
||||
"$HOME/.config/chromium/NativeMessagingHosts"
|
||||
)
|
||||
FIREFOX_DIRS=(
|
||||
"$HOME/.mozilla/native-messaging-hosts"
|
||||
)
|
||||
fi
|
||||
|
||||
for dir in "${DIRS[@]}"; do
|
||||
for dir in "${CHROME_DIRS[@]}"; do
|
||||
mkdir -p "$dir"
|
||||
echo "$MANIFEST" > "${dir}/${MANIFEST_NAME}.json"
|
||||
echo "$MANIFEST_CHROME" > "${dir}/${MANIFEST_NAME}.json"
|
||||
echo " Wrote: ${dir}/${MANIFEST_NAME}.json"
|
||||
done
|
||||
|
||||
for dir in "${FIREFOX_DIRS[@]}"; do
|
||||
mkdir -p "$dir"
|
||||
echo "$MANIFEST_FIREFOX" > "${dir}/${MANIFEST_NAME}.json"
|
||||
echo " Wrote: ${dir}/${MANIFEST_NAME}.json"
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user