Skip to content

Fix FCM in Chrome Extensions #1597

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 12, 2019
Merged

Fix FCM in Chrome Extensions #1597

merged 2 commits into from
Mar 12, 2019

Conversation

mmermerkaya
Copy link
Contributor

Prevents sending messages to Chrome Extension background pages, which are always considered visible in Chrome. That causes our SDK try to send the message to the background page and to not show the notification.

I'll also investigate if background page being considered a visible client is a bug in Chrome itself, and try to get it fixed if I can. But for now this seems like a good workaround.

Prevents sending messages to Chrome Extension background pages, which are always considered visible.
@mmermerkaya mmermerkaya requested a review from pinarx March 12, 2019 15:17
@mmermerkaya mmermerkaya requested a review from dwoffinden as a code owner March 12, 2019 15:17
@dwoffinden
Copy link

Is there a use-case for extensions handling the message themselves in the background page?

Is CI just broken? :P

@mmermerkaya
Copy link
Contributor Author

extensions handling the message themselves in the background page

The event handler doesn't get triggered when you try to do that. I'm not yet sure why.

I fixed the tests.

@mmermerkaya mmermerkaya merged commit 71b7abf into master Mar 12, 2019
@mmermerkaya mmermerkaya deleted the mmermerkaya-fix-extensions branch March 12, 2019 17:10
@evanfrawley
Copy link

Hi @mmermerkaya & @dwoffinden!

I have a use case that this change broke. My use case is: Using a background script in a Chrome extension that listens for messages from FCM and when the user is using Chrome in the foreground, I relay the data in a customized way through the web page itself (think similarly to Honey's modifications to an Amazon product detail page).

Screen Shot 2019-03-29 at 1 42 03 PM

Would it be possible to opt-in allowing Chrome extension background scripts to receive FCM messages? It would be awesome to stay up to date with the newest versions of the JS SDK and not be stuck on the version before this fix forever!

I'd be happy to open a PR for this as well, but it may take some time since I'm unfamiliar with the tests & CI/CD system that is being used.

@mmermerkaya
Copy link
Contributor Author

Hi @evanfrawley, thanks for the report. Could you open an issue with this information? And could you also include a notification payload example please?

@firebase firebase locked and limited conversation to collaborators Oct 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants