]> git.wh0rd.org Git - chrome-ext/tabs-backup.git/commitdiff
backup: filter out chrome-untrusted:// windows
authorMike Frysinger <vapier@gentoo.org>
Sun, 10 Dec 2023 03:07:28 +0000 (20:07 -0700)
committerMike Frysinger <vapier@gentoo.org>
Sun, 10 Dec 2023 03:07:28 +0000 (20:07 -0700)
I don't think any of these should be backed up.

background.js

index 4ba12fa3db836b144cc10e1203cd25ed2f5ef3a1..da06677b5679cb582fb2c23c59d1565b4b1facbd 100644 (file)
@@ -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)