Search code examples
javascriptgoogle-chrome-extensionchrome-extension-manifest-v3

Chrome extenshion. Block content on any page warning


I'm working on extenshion which works on 2 websites. I made host permission and content_scripts matches.

Customer uploaded this extenshion, moderation is passed. But when you want to install this extenshion, you will see message with description:

.... Block content on any page. Why block? Why any page? Is it possible to change this warning?

My manifest:

{
    "name": "NAME",
    "description": "DESCR",
    "version": "1.02",
    "manifest_version": 3,
    "icons": {
        "16": "icons/16.png",
        "32": "icons/32.png",
        "57": "icons/57.png",
        "128": "icons/144.png"
    },
    "permissions": ["storage", "tabs", "declarativeNetRequest"],
    "content_security_policy": {
        "extension_pages": "script-src 'self'; object-src 'self';"     
    },

    "host_permissions": ["https://www.site1.com/*", "https://www.site2.com/*", "*://*.site2.com/*/event/*", "*://*.site2.com/event/*"],
    "action": {
        "default_popup": "popup.html"
    },  
    "background": {
        "service_worker": "background.js"
    },
    "content_scripts": [
        {
            "matches": ["*://*.site2.com/*/event/*", "*://*.site2.com/event/*"],
            "js": ["content-2.js"],
            "css": ["content.css"],
            "run_at": "document_start"
        },
        {
            "matches": ["https://www.site1.com/*"],
            "js": ["content-1.js"],
            "css": ["content.css"],
            "run_at": "document_start"
        }
    ]    
}

Solution

  • See the list of warnings, it's from declarativeNetRequest.

    You can use declarativeNetRequestWithHostAccess which works with sites in host_permissions.