Skip to content

Add Firefox support for CharacterSync extension#325

Open
HarmlessHarm wants to merge 1 commit intodevelopfrom
feature/firefox-extension-support
Open

Add Firefox support for CharacterSync extension#325
HarmlessHarm wants to merge 1 commit intodevelopfrom
feature/firefox-extension-support

Conversation

@HarmlessHarm
Copy link
Collaborator

Summary

  • Extracts a shared sendExtensionMessage() helper in generalFunctions.js that detects Firefox via user agent
  • On Firefox, uses window.postMessage with the CS_BRIDGE protocol to communicate with the CharacterSync extension's bridge content script
  • On Chrome, continues using chrome.runtime.sendMessage unchanged
  • Refactors extensionInstalled(), getCharacterSyncStorage(), and getCharacterSyncCharacter() to use the shared helper

Test plan

  • Verify CharacterSync extension detection works in Chrome (no behavior change)
  • Verify CharacterSync bridge messaging works in Firefox with the extension installed
  • Verify graceful timeout when extension is not installed on both browsers

Firefox does not support externally_connectable / chrome.runtime.sendMessage
for external messaging. The Firefox build of CharacterSync injects a bridge
content script that relays messages via window.postMessage. This extracts a
shared sendExtensionMessage() helper that detects Firefox and uses the
postMessage bridge, keeping the Chrome path unchanged.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@HarmlessHarm HarmlessHarm force-pushed the feature/firefox-extension-support branch from e103de9 to 2d60432 Compare February 22, 2026 19:54
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
D Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

window.removeEventListener("message", handler);
resolve(event.data);
}
window.addEventListener("message", handler);

Check failure

Code scanning / SonarCloud

Origins should be verified during cross-origin communications High

Verify the origin of the received message. See more on SonarQube Cloud
resolve(event.data);
}
window.addEventListener("message", handler);
window.postMessage({ CS_BRIDGE: true, requestId, request_content }, "*");

Check failure

Code scanning / SonarCloud

Origins should be verified during cross-origin communications High

Specify a target origin for this message. See more on SonarQube Cloud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant