TL;DR ManifestV3 is still a semi-broken toy that can't handle many nontrivial scenarios.
with V3 each time I need a value from settings I need to use chrome.storage
native messaging host
Is a Manifest V2 with background "persistent": false the same as a service worker?
Yes, conceptually.
However, there may be differences due to the inferior nature of service workers as this is still an immature Web technology so it doesn't support things we grew accustomed to such as dynamic script loading, ES modules, clipboard handling, DOM parsing, and a lot more.
instead of doing a major change to V3 could I first get my code running in V2 with a non-persistent background.js?
- Yes, it's a good start especially since ManifestV3 is still in development.
My native host passes some javascript to my extension which in turn adds it via the script tag.
Definitely forbidden.
This code is not a part of the extension package so it can't be verified by the web store reviewers.
An alternative will be revealed when Chromium team announces their solution for Tampermonkey and similar extensions that allow installing external userscripts.
Meanwhile, try switching to a declarative approach: create rule definitions in JSON which will be processed by your extension code.
when a V2 update will be rejected?
Probably next year.
There's no official announcement yet but if Chromium developers have a bit of conscience they won't disable ManifestV2 until they fix all or most of the problems in V3, which will probably happen next year.
There's almost no active development currently for ManifestV3 problems though (other areas such as DevTools see ~100 times more meaningful activity) and seeing how Chromium team has been factually ignoring most of feedback from extension authors for the past five years, it's not exactly encouraging...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…