Browse code

[tbird] BM-15574 Fix: Tbird 68.3.1 support, clear indexed DB on reset

Nicolas Lascombes authored on 09/01/2020 11:08:47
Showing 2 changed files
... ...
@@ -352,7 +352,9 @@ var gBMOverlay = {
352 352
 					});
353 353
 				}
354 354
 			}, this);
355
-			this.openBmApps(toReOpen);
355
+			if (toReOpen.length > 0) {
356
+				this.openBmApps(toReOpen);
357
+			}
356 358
 		}
357 359
     },
358 360
     _closeBmTabs: function() {
... ...
@@ -58,11 +58,11 @@ var gBMPreferences = {
58 58
     reset: function() {
59 59
         this._logger.info("RESET");
60 60
         bmService.reset();
61
+        this._clearCacheAndCookies();
62
+        this._clearIndexedDB();
61 63
         let observerService = Components.classes["@mozilla.org/observer-service;1"]
62 64
                         .getService(Components.interfaces.nsIObserverService);
63 65
         observerService.notifyObservers(null, "reload-bm-tabs", "please");
64
-        this._clearCacheAndCookies();
65
-        this._clearIndexedDB();
66 66
     },
67 67
     _clearCacheAndCookies: function() {
68 68
         this._logger.info("Clear cookies and cache");
... ...
@@ -86,7 +86,12 @@ var gBMPreferences = {
86 86
 				this._logger.info("Clear indexedDB for uri:" + serverUrl);
87 87
 				let baseURI = Services.io.newURI(serverUrl, null, null);
88 88
 				let principal = Services.scriptSecurityManager.createCodebasePrincipal(baseURI, {});
89
-				Services.qms.clearStoragesForPrincipal(principal, null, true);
89
+                try {
90
+                    Services.qms.clearStoragesForPrincipal(principal, null, true);
91
+                } catch(e) {
92
+                    //TB 68.3.1
93
+                    Services.qms.clearStoragesForPrincipal(principal);
94
+                }
90 95
 			}
91 96
 		} catch(e) {
92 97
 			this._logger.error(e);