Giter Club home page Giter Club logo

Comments (2)

kwaschny avatar kwaschny commented on June 1, 2024

Is there some way the list can get wiped out? Some weird case viewing the blacklist, or some one in a million threading thing?

Absolutely. Both storage mechanisms for Chrome/WebExtensions are asynchronous by design. The sync storage (a.k.a. "cloud") sends the data via network with a corresponding roundtrip (latency will vary) while local storage (a.k.a. "save on local disk") asynchronously queues to reduce the blocking nature of the single JS engine thread that executes the extension. The integrity is kept by waiting on the callbacks before doing another access. However, due to multiple browser tabs, these callbacks/states have to be passed around as message to each tab, so every tab is up-to-date with the current blacklist state. And here is the part that might break. If an already outdated tab is broadcasting a message after the broadcast of a freshly updated tab was already processed, it will override the new with the old information. In theory, this should never happen because all broadcasts are queued by insertion, so the past can never outrun the future.

Going on, everytime you block/unblock something, the storage is touched and modified as a whole. There's no "just add or remove this single value" due to the way the blacklist is stored in order to "compress" the data. (I'm basically splitting up the list in several fragments to bypass storage restrictions such as "you can only have so many keys" imposed by the browser.) If something goes wrong here, I immediately try to restore the last known list (a temporary backup from memory) and warn the user via alert. I also gracefully handle the quota limits and apply the same logic. And what happens if a tab crashes in the middle of this operation? Nothing good, I suppose.

I've read your e-mail. The only explanation, I can come up with, is: The list was either damaged while writing or it was truncated while being fetched. So you end up with a smaller "working part" of the actual list. That doesn't really make sense in my book though, since JSON serialization/deserialization is either "everything or nothing", but maybe it was a partial recovery from memory (deserialized state) after a fault. I'm just guessing at this point as I cannot reproduce something like this at all.

Is the list backed up somewhere when using local storage so that I could get it back?

Your browsers helds the data. It's the same data that is fetched by the extension, so no, there's no additional backup available. Your only option is regularly exporting your list via extension (see management view) as .json file and keep it around to import back, in case your blacklist breaks. Sorry.

from unwanted-twitch.

djcline23 avatar djcline23 commented on June 1, 2024

K, thanks. I’ve got en export from March at least, so that will save some. Everyone since then gets a second chance on getting blocked! 😛

from unwanted-twitch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.