Handle postMessage() errors
This commit is contained in:
1 parent
ece89e3b66
commit
da5ca2e188
1 file changed
+10
-3
@@ -15,9 +15,16 @@ const importProjectFromOpener = ({
|
||||
return;
|
||||
}
|
||||
|
||||
const post = (data) => opener.postMessage({
|
||||
p4: data
|
||||
}, origin);
|
||||
const post = (data) => {
|
||||
// postMessage could throw if origin is invalid
|
||||
try {
|
||||
opener.postMessage({
|
||||
p4: data
|
||||
}, origin);
|
||||
} catch (e) {
|
||||
console.warn('Cannot post message', e);
|
||||
}
|
||||
};
|
||||
|
||||
let hasStarted = false;
|
||||
let hasFinishedOrCancelled = false;
|
||||
|
||||
Reference in new issue
Block a user