Skip to content

Commit

Permalink
Added try, catch for postMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
Booyoun-Kim committed Oct 15, 2019
1 parent 0e20bc0 commit 847fef9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
12 changes: 10 additions & 2 deletions www/js/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,18 @@
}

cosmos.broadcast(signedTx).then(response => {
window.opener.postMessage(response, "*");
try {
window.opener.postMessage(response, "*");
} catch(event) {
console.log(event);
}
window.close();
}).catch(error => {
window.opener.postMessage(error.message, "*");
try {
window.opener.postMessage(error.message, "*");
} catch(event) {
console.log(event);
}
window.close();
})
}
Expand Down
6 changes: 5 additions & 1 deletion www/js/pin.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,11 @@
}

setTimeout(function () {
window.opener.postMessage(msgObj, "*");
try {
window.opener.postMessage(msgObj, "*");
} catch(event) {
console.log(event);
}
window.close();
}, 500);
} else if (window.pinType == "tx") {
Expand Down
6 changes: 5 additions & 1 deletion www/session.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
"address": address,
"account": account
}
window.opener.postMessage(msgObj, "*");
try {
window.opener.postMessage(msgObj, "*");
} catch(event) {
console.log(event);
}
window.close();
}
</script>
Expand Down

0 comments on commit 847fef9

Please sign in to comment.