Skip to content

Loading filters from storage fails after adding a filter with meta data

Environment

  • Browser and full version: Chrome 100.0.4896.60
  • Extension using this toolkit: test-mv2
  • Commit hash: 5d0561a0 (0.4.0)

Steps to reproduce

  1. Run await EWE.filters.add(["aaaaa"], {a: "A"}).
  2. Run await EWE.filters.getUserFilters().
  3. Reload extension.
  4. Run await EWE.filters.getUserFilters().

Actual behavior

  • After 2) Returns array with one entry.
  • After 3) Warning message shown in console (see below).
  • After 4) Returns empty array.
SyntaxError: Unexpected token o in JSON at position 1
    at JSON.parse (<anonymous>)
    at Function.e.Subscription.fromObject (subscriptionClasses.jss:469:31)
    at e.INIParser.process (iniParser.jss:82:45)
    at filterStorage.jss:574:14
    at Object.readFromFile (io.jss:113:9)
    at async Object.loadFromDisk (filterStorage.jss:631:7)
    at async Object.initialize (filterListener.jss:176:20)
    at async Va (initializer.jss:30:3)
    at async idb.jss:63:10
    at async index.jss:68:3

Expected behavior

  • After 2) Returns array with one entry.
  • After 3) No warning message is shown in console.
  • After 4) Returns array with one entry.

Further information

This problem does not occur when adding a filter without meta data.