wildskyf / TextareaCache

Browser Add-on: Automatically save the content in Textarea.
MIT License
67 stars 7 forks source link

fixed bugs in ta_database.updateDatabaseVersion() #129

Closed crnkv closed 2 months ago

crnkv commented 7 months ago

Several things fixed:

  1. A piece of code correctly updated 'setting' in the database by comparing data.setting to _resetData.setting, but that code got deleted for no reason in the commit a6efa62 . I put it back.
  2. The code for updating 'version' in the commit 07b3e88 had mistaken me.data.setting.version for me.data.version
  3. Only 'setting' was skipped in the for-loop, which is not right
  4. Now correctly updates 'setting' and 'exceptions', deleting option values that are not in _resetData.setting
GHolk commented 2 months ago

This code only run while the user update their add-on?

crnkv commented 2 months ago

Only runs when me.data.version is different from me.VERSION (currently '9') (version of the database architecture) (i.e. when user's local installation is updated to a newer version with a newer database design), it seems

crnkv commented 2 months ago

Now that version 4.9.1 has gone public, I, again, use firefox devtool to inspect into TextareaCache 4.9.1's database design: On ta_database.init(), we have me = ta_database loaded from storage, then we have:

GHolk commented 2 months ago

squash and merge as 34dfe871cca9585ab89811231eefa82cf1fcb6a3