Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Manifest V3 #28

Open
jinliming2 opened this issue Apr 20, 2024 · 0 comments
Open

Migrate to Manifest V3 #28

jinliming2 opened this issue Apr 20, 2024 · 0 comments

Comments

@jinliming2
Copy link
Owner

Although Google Chrome has announced that extensions using Manifest V2 will gradually become uninstallable starting June 2024, I have considered migrating to Manifest V3. However, due to a key API that this extension relies on being unavailable in Manifest V3, it is currently impossible to migrate.

Specifically, the main behaviour of this extension is to correct encoding by modifying HTTP response headers. Because it involves modifying response headers, it needs to request the webRequestBlocking permission. However, this permission can no longer be requested by regular extensions in Manifest V3 (reserved only for policy-installed extensions), making it impossible to modify response headers using the current method.

Manifest V3 recommends using the declarativeNetRequest API to modify network requests, but this API is not perfect. When modifying response headers, it only supports specifying fixed strings and does not support dynamic values based on existing response headers, making it impossible to perfectly perform the work of this extension. This extension needs to preserve the MIME part of the response headers when modifying them, otherwise, it would cause abnormal website displays. Therefore, it is currently not feasible to use the declarativeNetRequest API for rewriting.

There is an issue tracking the feature request for declarativeNetRequest to allow rewriting response headers using regular expression references, which might solve the problem. However, this issue has been unresolved since its proposal on September 30, 2021, with the latest update on December 14, 2023, indicating that the issue is being researched.

Therefore, until this issue is resolved, this extension will not be updated to migrate to Manifest V3. Starting in June 2024, some users may no longer be able to use this extension, and the only solution might be to pause Chrome browser updates.


虽然 Google Chrome 已经预告在 2024 年 6 月开始,使用 Manifest V2 的扩展程序将逐步无法安装,我也考虑过迁移 Manifest V3,但是由于此扩展程序依赖的一个关键 API 在 Manifest V3 中无法使用,导致目前无法迁移。

具体来说,目前此扩展的主要行为就是通过修改 HTTP 响应头来完成编码的纠正,由于涉及到响应头的修改,因此需要申请 webRequestBlocking 权限。而这个权限在 Manifest V3 中无法再被普通扩展程序申请(仅为 Policy installed extensions 保留),因此无法再使用现在的办法来修改响应头。

Manifest V3 推荐使用 declarativeNetRequest API 来修改网络请求,但是这个 API 并不完善,在修改响应头的时候,仅支持指定固定的字符串而不支持基于现有的响应头给出动态值,因此无法完美完成此扩展的工作。此扩展在修改响应头的时候需要保留其中的 MIME 部分,否则会导致网站展示出现异常。因此目前还无法使用 declarativeNetRequest API 来改写。

已经有一个 issue 来跟踪针对 declarativeNetRequest 的功能要求,使得其可以通过正则引用来改写响应头,这也许能够解决问题,但是这个 issue 自 2021 年 9 月 30 日提出至今未解决,最新的消息是 2023 年 12 月 14 日有人表示正在研究此问题。

因此,在此问题得到解决之前,这个扩展暂时不会更新迁移到 Manifest V3,从 2024 年 6 月开始,可能会有部分用户无法再使用此扩展,唯一的解决办法可能就是暂停 Chrome 浏览器的更新。

@jinliming2 jinliming2 pinned this issue Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant