From 9d8b4bb865a811a32de0639c30ec710214f56bef Mon Sep 17 00:00:00 2001 From: Daniel Flippo Date: Thu, 17 Aug 2023 17:48:02 -0400 Subject: [PATCH] added migration code --- src/background.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/background.js b/src/background.js index 59a9e31..cae6d53 100644 --- a/src/background.js +++ b/src/background.js @@ -63,6 +63,16 @@ chrome.runtime.onInstalled.addListener((details) => { chrome.storage.local.remove(oldOptionName); } } + /** + * Ensure updated structure of highlighter objects + */ + for (const highlighterIndex of currentOptions.highlighter) { + for (const attributeName of Object.keys(defaultOptions.highlighter)) { + if (!(attributeName in currentOptions.highlighter[highlighterIndex])) { + chrome.storage.local.set({ highlighter: defaultOptions.highlighter }); + } + } + } /** * Convert any non-hex colors to hex. */