Skip to content

Background to Content-Script Communications failing on Safari #102

@bishoym

Description

@bishoym

Version

6.0.1

Current Behavior

I'm working on a MV3 extension built using WXT and Webext-bridge, and can confirm everything is working as expected on Chrome and Firefox.

My main issue is with Safari.

This is the only error in the background script console:
Unhandled Promise Rejection: SyntaxError: The string did not match the expected pattern.

As mentioned in the title it primarily happens in Background -> content-script messages.

I was able to temporarily work around this by reverting back to the native approach (i.e. browser.runtime.addEventListener() and browser.tabs.sendMessage()).

I've come to really appreciate the lack of boilerplate of this library though, and would love to continue using it.

Expected Behavior

sendMessage() should work as expected regardless of direction and scripting context.

Steps To Reproduce

  1. use sendMessage() in background.ts
  2. Expect a message in the onMessage() handler in a content-script.ts

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    🧐 Bug: Needs ConfirmationSomething isn't working, but needs to be confirmed by a team member.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions