source
may be null
This commit is contained in:
parent
8f519f8494
commit
7d54d908a2
|
@ -29,9 +29,9 @@
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener('message', ({data, source}) => {
|
window.addEventListener('message', ({data, source, origin}) => {
|
||||||
// Accepting events only from this page.
|
// Some browser don't reveal `source` to extensions e.g. Firefox
|
||||||
if (data && source === window) {
|
if (data && (source ? source === window : origin === ORIGIN)) {
|
||||||
const fn = HANDLERS[data.type];
|
const fn = HANDLERS[data.type];
|
||||||
if (fn) fn(data);
|
if (fn) fn(data);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user