From 683e73ceb9fc43ce15b2929bc572d5de9ba5abaa Mon Sep 17 00:00:00 2001 From: tophf Date: Thu, 15 Feb 2018 16:47:42 +0300 Subject: [PATCH] close the source tab in case the port didn't report onDisconnect fixes #349 --- install-usercss/install-usercss.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/install-usercss/install-usercss.js b/install-usercss/install-usercss.js index bf1e2d3c..b061af46 100644 --- a/install-usercss/install-usercss.js +++ b/install-usercss/install-usercss.js @@ -59,6 +59,12 @@ id === tabId && url && url !== tabUrl && closeCurrentTab()); + // close the tab in case the port didn't report onDisconnect + chrome.tabs.onRemoved.addListener(id => { + if (id === tabId) { + closeCurrentTab(); + } + }); function liveReloadUpdate(sourceCode) { liveReloadPending = liveReloadPending.then(() => {