From e11f333839482b8ae67de1f4a8273b0eb058ef1b Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sat, 9 Dec 2023 20:07:28 -0700
Subject: [PATCH] backup: filter out chrome-untrusted:// windows

I don't think any of these should be backed up.
---
 background.js | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/background.js b/background.js
index 4ba12fa..da06677 100644
--- a/background.js
+++ b/background.js
@@ -193,6 +193,11 @@ function backupNow(isAutomatic, backupName, callbackDone) {
 
 				//console.log("==> Tab " + j + " (" + tab.index + "): " + tabUrl);
 
+				// Ignore windows that we can't/shouldn't backup.
+				if (tab.url.startsWith('chrome-untrusted://')) {
+					continue;
+				}
+
 				var bkpTab = {
 					url: tab.url,
 					title: tab.title,
@@ -204,9 +209,11 @@ function backupNow(isAutomatic, backupName, callbackDone) {
 				bkpWindow.tabs.push(bkpTab);
 			}
 
-			totNumTabs += windowTabs.length;
+			if (bkpWindow.tabs.length) {
+				totNumTabs += bkpWindow.tabs.length;
 
-			fullBackup.windows.push(bkpWindow);
+				fullBackup.windows.push(bkpWindow);
+			}
 		}
 
 		if (totNumTabs == 0)
-- 
2.39.5