joue-quroi / spoof-timezone

A privacy related add-on to spoof the timezone that is returned by your browser
http://add0n.com/spoof-timezone.html
Mozilla Public License 2.0
66 stars 14 forks source link

FF - option to preserve toString between browser restarts #8

Closed ghost closed 6 years ago

ghost commented 6 years ago

FF 61.0.1 (64-bit) with ST 0.2.2 on W10 1709 b16299.579

Similar to #3 toString is not preserved between browser restarts and needs to be set again on each browser start. That can be tedious at times.

joue-quroi commented 6 years ago

Mine keeps the settings as expected after a browser restart. Are you sure you don't have the update from IP address setting enabled?

ghost commented 6 years ago

Automatically update timezone based on my IP is unchecked/disabled.

Tried with a maiden profile and toString as well as the TZ set prior to the browser restart are preserved after browser restart.

Are those STZ settings retained via local storage?

I am using a FF WE named Cookie AutoDelete with a setting enabled Localstorage Cleanup which would clean up the local storage at browser restart. It does not provide an option to be selective about local storage used by other WE and content recceived from the Web. To my understanding that is the current design of the governing WE API for FF 61 but may change (protect local storage utilized by WE) in upcoming beta/nightly. If not mistaken I read something about it but cannot recall where right now.

If that is being the case than apparently STZ is working as intended and being impacted however by another WE and thus this ticket and likely #3 as well are obsolote and can be closed.

Cleaning Local Storage between broswer restarts would be the most obvious cause. Else I would not expect using containers and having FPI (First Party Isolation) enabled to be the cause.

joue-quroi commented 6 years ago

Firefox should to keep the localStroage for addons and delete page related storage area, like what Chrome does. Unfortunately there is no fix for this.

ghost commented 6 years ago

Reckon these are the bugs covering the matter

https://bugzilla.mozilla.org/show_bug.cgi?id=1416219 https://bugzilla.mozilla.org/show_bug.cgi?id=1313401

Activity/interest seems pretty (s)low on either.

There is a Next-generation LocalStorage (DOMStorage) implementation in the works and currently slated to land in FF 64.

Part 15: Fix clearLocalStorage() in browser extensions may fix this, but I am not versed to interpret that code snippet

+  if (Services.lsm.nextGenLocalStorageEnabled) {
+    let promises = [];
+    await new Promise(resolve => {
+      quotaManagerService.getUsage(request => {
+        if (request.resultCode != Cr.NS_OK) {
+          // We are probably shutting down. We don't want to propagate the error,
+          // rejecting the promise.
+          resolve();
+          return;
+        }
+
+        for (let item of request.result) {
+          let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(item.origin);
+          let host = principal.URI.hostPort;
+          if (!options.hostnames || options.hostnames.includes(host)) {
+            promises.push(new Promise(r => {
+              let req = quotaManagerService.clearStoragesForPrincipal(principal, "default", "ls");
+              req.callback = () => { r(); };
+            }));
+          }
+        }
+
+        resolve();
+      });
+    });
+
+    return Promise.all(promises);
+  }