14
submitted 1 year ago* (last edited 1 year ago) by look997@karab.in to c/firefox@lemmy.ml

I do a basic browser.local.sync sync test:

let monster = {
  name: "Kraken",
  tentacles: true,
  eyeCount: 10,
};

let kitten = {
  name: "Moggy",
  tentacles: false,
  eyeCount: 2,
};

browser.storage.sync.set({ kitten, monster });

and on the second profile:

await browser.storage.local.get("kitten");

but nothing happens, get("kitten") returns nothing.

QUESTIONS:

  1. Does the synchronization work on a zip file loaded from Add-ons -> Tools for all add-ons -> Install add-on from file...?
    I have in manifest.json applications.gecko.id, as needed.
  2. If not, what do I need to do to TEST the synchronization work?

API https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/sync

all 2 comments
sorted by: hot top controversial new old
[-] MrOtherGuy@lemmy.world 2 points 1 year ago

I don't know if the syncing part will work for unsigned extensions, but you need to use the same storage area on both endpoints. So if you set kitten key to sync area (browser.storage.sync) - then you need to also read it from the sync area, but in your example you are reading from local area which is for local not-to-be-synced data only.

this post was submitted on 08 Sep 2023
14 points (100.0% liked)

Firefox

17627 readers
154 users here now

A place to discuss the news and latest developments on the open-source browser Firefox

founded 4 years ago
MODERATORS