Closed gregglind closed 8 years ago
Note that you could technically use localStorage itself to check if localStorage works. Let's say you create a new property "heartbeat-localstorage-check", and you do the following:
var haveChecked = localStorage.getItem("heartbeat-localstorage-check");
if (!haveChecked || haveChecked < 3) {
localStorage.setItem("heartbeat-localstorage-check", ++haveChecked);
return;
}
// if we get here, we know that this is the third session since we started saving to
// localStorage, and it persisted across sessions (assuming I didn't make an off-by-one
// error). (note that certain things like crash recovery and other immediate restarts
// like version upgrades (which preserve all state across a shutdown, irrespective
// of prefs) could make it seem to work 1 session and still break the next)
This is essentially what I meant by (2), though I erroneously said "cookie" rather than "localStorage". The concept is the same, though.
Thanks for the clarification!
Under this system, we have to see you multiple times before we do any work that involves anything around persistence. That would totally allow 'nth time' to work right.
This is obviously much much Hardened.
Re: localStorage
I am leaning toward a Privacy API that reflects (into Tour) or via some other "Permission".
Also possible: if you turn on privacy prefs (or turn off telemetry), then Heartbeat / Self-Repair just doesnt work.
I like the thinking here, but I think we should be cautious. If you turn on privacy prefs I think we should disable SOME of the hb/self repair features. If you go into about:config and turn it off then it's all gone.
My thinking is that you might not want to hear about keyboard shortcuts or have us tell you about addons (totally understandable), but if you update and lose your bookmarks you'd still be a sad panda knowing that we COULD have retrieved them for you. I think this is something we can discuss further down the road, but just my 2 cents.
Re: localStorage
- it only says the have EVER stored localStorage
- doesn't reflect current privacy prefs.
If they start clearing localStorage, that will remove the value you have, and you would never reach the bit after the return;
, right? That would effectively achieve "heartbeat doesn't work" in the sense that you wouldn't prompt them for stuff, ever. Am I misunderstanding what you mean?
bool personinfo.isLocalstoragePersistent(store=localStorage)
. This would use the algorithm above.localStorage
to only run if localStorage is reliable.
local
version of this to main.js
README.md
to reflect sampling changespackage.json
to 0.12.0
. This is a 'major change' due to sampling changes.self-repair
page js being called ONCE PER DAY. If that assumption changes, this breaks again. Amended:
@gijsk , please take a look over this. It solves some of the issues.
Issue: localStorage
Ideas:
Each of these introduces new problems and trade-offs.