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