In the manifest V3, there is one error" This extension may have been corrupted".

377 views
Skip to first unread message

Rxtester Beijing

unread,
Oct 20, 2022, 4:23:03 AM10/20/22
to Chromium Extensions
I have updated my extension from manifest v2 to V3 and Upload the latest manifest V3 extension to web store.
I have debugged the my extension in my local env. Everything is ok. But When I install the extension from web store. The extension can be installed as expected. But when I choose Off then On. The extension will pop up the error:"This extension may have been corrupted", needs to be repaired. Which cause my extension can not work now.

I have used the Fetch API to get my local data.json file(the file will be created by my local application and wrote in the extension path, the file is same directory with manifest file and background.js file) just like below:
From V2 
  chrome.runtime.getPackageDirectoryEntry(function(dirEntry) {
      dirEntry.getFile("test.json", {}, function(fileEntry) {
         console.log("Read \"data.json\" successfully");
         fileEntry.file(function(fi) {

to V3:
   fetch('test.json')
      .then(response => response.json())
      .then(json => {
         console.log("Read \"data.json\" successfully");

I find that If the test.json is not created, the extension will be ok. After I create the data.json in the same directory with manifest and background.js, the extension will think that this extension may have been corrupted. But in my local debugging test, all things are ok.

Rxtester Beijing

unread,
Oct 20, 2022, 5:10:36 AM10/20/22
to Chromium Extensions, Rxtester Beijing
In the manifest V2, the created test.json is ok.

Stefan Van Damme

unread,
Oct 20, 2022, 5:19:02 AM10/20/22
to Chromium Extensions, rxteste...@gmail.com
Hi there,

Do you have a basic Chrome extension to prove this issue? Then you can report this to crbug.com as the Manifest V3 issue.

Thanks,
Stefan vd

Message has been deleted

Jackie Han

unread,
Oct 20, 2022, 11:22:41 AM10/20/22
to Stefan Van Damme, Chromium Extensions, rxteste...@gmail.com
I searched a bit in source code. Chrome does verify the extension content from the Web Store, like this , this and this.
I'm guessing it's intentional to verify that the files haven't been modified.
So I suggest communicating with the extension / reading files in other ways.

--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/df954eb9-f54e-438a-9a7c-b269d7c0c434n%40chromium.org.

Jackie Han

unread,
Oct 20, 2022, 11:23:33 AM10/20/22
to Stefan Van Damme, Chromium Extensions, rxteste...@gmail.com
It makes sense to not verify contents in local dev mode.

Rxtester Beijing

unread,
Oct 20, 2022, 1:40:50 PM10/20/22
to Chromium Extensions, Jackie Han, Chromium Extensions, Rxtester Beijing, stefa...@gmail.com
Hi Jackie, 
Do you have advice about the solution?

Jackie Han

unread,
Oct 20, 2022, 3:08:15 PM10/20/22
to Rxtester Beijing, Chromium Extensions, stefa...@gmail.com
Could you describe your functional requirements? Why need to read files? Do you want to collaborate with local native applications?

Depending on your context, there may be different solutions:

Jackie Han

unread,
Oct 20, 2022, 3:11:25 PM10/20/22
to Rxtester Beijing, Chromium Extensions, stefa...@gmail.com
and <input type=file>, let the user select a file, then save it in extension storage( Indexeddb / storage.local / cache storage / OPFS).

Rxtester Beijing

unread,
Oct 20, 2022, 4:03:30 PM10/20/22
to Chromium Extensions, Jackie Han, Chromium Extensions, stefa...@gmail.com, Rxtester Beijing
Yes. I know the local file path. It is the same file path with manifest file.

Rxtester Beijing

unread,
Oct 20, 2022, 4:06:42 PM10/20/22
to Chromium Extensions, Rxtester Beijing, Jackie Han, Chromium Extensions, stefa...@gmail.com
I find that If I use the fetch API in my background.js code, the error will be reproduced in the my web store test account. I think that hash check is one error. Is there solution to avoid the chrome to do the hash check when I use the fetch API to get the local file?

Jackie Han

unread,
Oct 20, 2022, 4:47:19 PM10/20/22
to Rxtester Beijing, Chromium Extensions, stefa...@gmail.com
I know the local file path. It is the same file path with manifest file.

The solution is to avoid copying files into the extension directory. For example, put them to a common app data dir.
And chrome.runtime.getPlatformInfo() can know the user's OS platform.

Rxtester Beijing

unread,
Oct 20, 2022, 7:06:40 PM10/20/22
to Chromium Extensions, stefa...@gmail.com, Rxtester Beijing

Yes, I have one test develop account. I am trying to find the solution. If not, then I will open the bug to crbug.com

Rxtester Beijing

unread,
Oct 20, 2022, 7:07:53 PM10/20/22
to Chromium Extensions, Rxtester Beijing
Any other suggestions about issue.
On Thursday, October 20, 2022 at 4:23:03 PM UTC+8 Rxtester Beijing wrote:
Reply all
Reply to author
Forward
0 new messages