Ignore messages posted to onmessage that aren't data urls

This commit is contained in:
Donovan Preston 2018-09-07 13:21:30 -04:00
parent 17ee4e0058
commit 76f9d3ee35
No known key found for this signature in database
GPG Key ID: B43EF44E428C806E
2 changed files with 4 additions and 1 deletions

View File

@ -4,6 +4,9 @@ export default function intentHandler(state, emitter) {
window.addEventListener( window.addEventListener(
'message', 'message',
event => { event => {
if (typeof event.data !== 'string' || !event.data.startsWith('data:')) {
return;
}
fetch(event.data) fetch(event.data)
.then(res => res.blob()) .then(res => res.blob())
.then(blob => { .then(blob => {

2
package-lock.json generated
View File

@ -14418,7 +14418,7 @@
}, },
"sax": { "sax": {
"version": "1.2.1", "version": "1.2.1",
"resolved": "http://registry.npmjs.org/sax/-/sax-1.2.1.tgz", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz",
"integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=" "integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o="
}, },
"schema-utils": { "schema-utils": {