Search code examples
google-chrome-extension

Chrome Extension View Optional Permission Warnings Locally


I want to add optional permissions to my extension and would like to test the warning messages (locally) prior to publishing.

I followed this article, and created the packed .crx file.

However when I upload it (via drag and drop), I get:

This extension is not listed in the Chrome Web Store and may have been added without your knowledge. Learn More

...but, my extension IS listed in the Chrome Webstore.

Am I missing something, or did Chrome permanently disable .crx uploads?

Seems like there is no solution to this online.

Is it possible that my "updated" manifest is causing this issue as it is now using v3 whereas the published extension is v2?


Solution

  • As a workaround, you can use chrome.management.getPermissionWarningsByManifest.

    It can be ran from any extension (without the "management" permission, and not necessarily the extension you're testing for warnings) and takes a valid extension manifest file as a string, returning an array of warnings in callback.

    An example using the manifest of the extension as linked in your question:

    const m = `
    {
        "update_url": "https://clients2.google.com/service/update2/crx",
        "manifest_version": 2,
        "version": "2.0.0",
        (..skipped..)
        "permissions": [
            "tabs",
            "contextMenus",
            "storage",
            "alarms",
            "downloads",
            "downloads.shelf"
        ],
        (..skipped..)
    }`;
    
    chrome.management.getPermissionWarningsByManifest(
      m, 
      warnings => { for (let warning of warnings) console.log(warning); }
    );
    // Prints:
    //  Read your browsing history
    //  Manage your downloads