From 30d2e61a0dc3665698da03d4368c20d2936190b5 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 28 Sep 2020 10:50:31 +0100 Subject: [PATCH] Continuation Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/FromWidgetPostMessageApi.js | 1 + .../views/dialogs/ModalWidgetDialog.tsx | 12 +-- src/widgets/WidgetApi.ts | 73 ++++++++++--------- 3 files changed, 46 insertions(+), 40 deletions(-) diff --git a/src/FromWidgetPostMessageApi.js b/src/FromWidgetPostMessageApi.js index f41cf0543d..00e5588ec0 100644 --- a/src/FromWidgetPostMessageApi.js +++ b/src/FromWidgetPostMessageApi.js @@ -259,6 +259,7 @@ export default class FromWidgetPostMessageApi { sendResponse(event, res) { const data = objectClone(event.data); data.response = res; + if (!event.source) return; // source may have gone away since event.source.postMessage(data, event.origin); } diff --git a/src/components/views/dialogs/ModalWidgetDialog.tsx b/src/components/views/dialogs/ModalWidgetDialog.tsx index f17b1ec27a..60f5a09666 100644 --- a/src/components/views/dialogs/ModalWidgetDialog.tsx +++ b/src/components/views/dialogs/ModalWidgetDialog.tsx @@ -83,9 +83,11 @@ export default class ModalWidgetDialog extends React.PureComponent