Skip to content
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

Don't throw an error when receiving a message from popup #2506

Merged
merged 1 commit into from
Mar 18, 2022

Conversation

private-face
Copy link
Contributor

@cliqz/adblocker-webextension breaks message passing from popup to background page. handleRuntimeMessage always throws an error here, because sender from popup never contains tab and frameId:

if (sender.tab === undefined) {
throw new Error('required "sender.tab" information is not available');
}
if (sender.tab.id === undefined) {
throw new Error('required "sender.tab.id" information is not available');
}
if (sender.frameId === undefined) {
throw new Error('required "sender.frameId" information is not available');
}

This stops other async message listeners from executing.

This PR fixes it by checking for correct message action before sender.tab/frameId.

@remusao remusao added the PR: Bug Fix 🐛 Increment patch version when merged label Mar 18, 2022
Copy link
Collaborator

@remusao remusao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks for fixing @private-face!

@remusao remusao merged commit 83871a1 into ghostery:master Mar 18, 2022
@remusao
Copy link
Collaborator

remusao commented Mar 18, 2022

Looks like there is an issue while publishing the package, I'll have another look over the weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Bug Fix 🐛 Increment patch version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants