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

Ignore messages other than from iframe parent #249

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lukaw3d
Copy link

@lukaw3d lukaw3d commented Oct 15, 2021

Malformed messages from extensions throw errors (though download still works). This filters out messages, except those coming from iframe parent.

To reproduce errors:

Uncaught TypeError: [StreamSaver] You didn't send a messageChannel    at onMessage (mitm.html?version=2.0.0:66)
Uncaught TypeError: [StreamSaver] You didn't send a messageChannel    at onMessage (mitm.html?version=2.0.0:66)
Uncaught (in promise) TypeError: [StreamSaver] You didn't send a messageChannel    at onMessage (mitm.html?version=2.0.0:66)
Uncaught TypeError: [StreamSaver] You didn't send a messageChannel    at onMessage (mitm.html?version=2.0.0:66)
Uncaught TypeError: [StreamSaver] You didn't send a messageChannel    at onMessage (mitm.html?version=2.0.0:66)

@numairawan numairawan mentioned this pull request Feb 25, 2022
@AmilKey
Copy link

AmilKey commented Feb 13, 2024

@jimmywarting do you have plans to merge? this PR also works for other extensions

@RndUsername
Copy link

+1 this fixed my issues when self hosting the mitm script

@PekingSpades
Copy link

Note that this workaround does not work across domains.
Cross-domain means that mitm.html and the page using streamSaver.js are not on the same domain. For this project, if the page using streamSaver.js is under HTTP, it will inevitably use the third-party hosted mitm.html.
If you are using it under HTTP, it is not recommended that you merge the code above.

There is, of course, a compromise. When using mitm.html under the same site, ignore messages from other sources. When hosting mitm.html under another domain, keep it the same.

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.

4 participants