From 8d56d6ffcb0f02e1edaf4193e182e95bfe7d22c5 Mon Sep 17 00:00:00 2001 From: siikamiika Date: Sun, 2 Feb 2020 14:58:31 +0200 Subject: [PATCH] handle closing already closed popup --- ext/bg/js/backend.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 06010a95..a9f2385b 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -628,7 +628,8 @@ class Backend { return; case 'popup': if (this.popupWindow !== null) { - chrome.windows.remove(this.popupWindow.id); + const callback = () => this.checkLastError(chrome.runtime.lastError); + chrome.windows.remove(this.popupWindow.id, callback); } this.popupWindow = await new Promise((resolve) => chrome.windows.create( {url, width: popupWidth, height: popupHeight, type: 'popup'},