SidneyNemzer / snippets

A Chrome extension that allows you to create and edit JavaScript code snippets, which are synced to all your computers
https://chrome.google.com/webstore/detail/snippets/fakjeijchchmicjllnabpdkclfkpbiag
63 stars 9 forks source link

MV3 Support #32

Closed SidneyNemzer closed 5 months ago

SidneyNemzer commented 6 months ago

Background: Under MV3, the extension background page is no longer persistent; it terminates after a period of inactivity and restarts for the next event.

Problem 1: webext-redux doesn't support mv3

Fixed: https://github.com/tshaddix/webext-redux/pull/297 (published this PR as webext-redux@3.0.0-mv3.0, will publish as latest soon)

The port object used by the store will become disconnected if the service worker sleeps, preventing the store from receiving updates.

Problem 2: state is lost when service worker restarts

Fixed: Solution 2.1 is working well (chrome.storage.session).

Problem 3: Content Security Policy blocks linter worker

Fixed: disabled ace option loadWorkerFromBlob

Refused to load the script 'chrome-extension://afioclbfmnhmggdeelmdhdhcfchbjhbf/worker-javascript-eslint.js' because it violates the following Content Security Policy directive: "script-src 'self' 'wasm-unsafe-eval' 'inline-speculation-rules' http://localhost: http://127.0.0.1:". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'chrome-extension://afioclbfmnhmggdeelmdhdhcfchbjhbf/worker-javascript-eslint.js' failed to load. at blob:chrome-extension://afioclbfmnhmggdeelmdhdhcfchbjhbf/00335355-995f-4e8a-8bb7-2f0cf4c3790a:1:1

Other notes