【问题标题】:Will adding "chrome_url_overrides" to chrome extension, disable the extension to existing users?将“chrome_url_overrides”添加到 chrome 扩展,禁用现有用户的扩展?
【发布时间】:2016-07-05 06:10:27
【问题描述】:

我在 chrome 网上商店中有一个现有的 chrome 扩展,下面给出了类似的 manifest.json。

{
    "manifest_version": 2,
    "name": "Extension Name",
    "short_name": "Short Name",
    "description": "Some description",
    "version": "1.0.83",
    "icons" : {
        "16": "something.png",
        "32": "something.png",
        "48": "something.png",
        "96": "something.png",
        "128": "something.png",
        "512": "something.png"
    },  
    "permissions": [ "tabs", "https://*/*", "http://*/*", "storage", "gcm" ],
    "optional_permissions": [ "notifications", "webRequest", "webRequestBlocking" ],
    "page_action": {
        "default_icon": "styles/images/icon.png",
        "default_title": "Name",
        "default_popup": "popup.html"
    },
    "update_url": "https://clients2.google.com/service/update2/crx",
    "content_security_policy": "script-src 'self' https://www.google-analytics.com https://d2xwmjc4uy2hr5.cloudfront.net; object-src 'self'",
    "background": {
        "scripts": ["scripts/jquery-2.1.1.min.js", "scripts/background.js"],
        "persistent": true
    },
    "web_accessible_resources" : ["logo.png"],
    "content_scripts": [
        {
            "js": ["scripts/jquery-2.1.1.min.js", "scripts/bigstuff.js"],
            "run_at": "document_end",
            "matches" : ["<all_urls>"]
        }
     ]
}

现在我想为用户自定义新标签页,这需要我修改清单并添加以下详细信息。

chrome_url_overrides": {
    "newtab": "newtab.html"
}

添加此项会禁用现有用户的扩展吗?

【问题讨论】:

  • 这取决于你是否在 manifest.json 上添加新的permissions
  • 除了 chrome_url_ovverrides 设置之外,我没有添加任何新权限
  • 好问题,但很难测试。但是,如果有任何迹象,chrome.management.getPermissionWarningsByManifest 的输出不会改变。不幸的是,我们不知道这是否足以说明问题。需要更深入地了解 Chrome 内部结构。
  • @Xan 是的。我不能有预感或怀疑,因为我可能会失去超过 30 万的现有用户群
  • 制作一个虚拟的私有测试扩展?

标签: google-chrome google-chrome-extension chrome-web-store


【解决方案1】:

您的扩展程序不会被 Chrome 禁用(但请参阅此答案的结尾!)。仅当更新引入 new permission warnings 时,更新的扩展才会被禁用(警告:此列表不完整)。
要查看新旧扩展产生了哪些权限警告,请参阅What message is generated by the chrome “permissions” property in an extension manifest?的答案

以下评论摘自from Chromium's source code,靠近检查是否可以在没有用户交互的情况下应用扩展更新的逻辑:

// We keep track of all permissions the user has granted each extension.
// This allows extensions to gracefully support backwards compatibility
// by including unknown permissions in their manifests. When the user
// installs the extension, only the recognized permissions are recorded.
// When the unknown permissions become recognized (e.g., through browser
// upgrade), we can prompt the user to accept these new permissions.
// Extensions can also silently upgrade to less permissions, and then
// silently upgrade to a version that adds these permissions back.
//
// For example, pretend that Chrome 10 includes a permission "omnibox"
// for an API that adds suggestions to the omnibox. An extension can
// maintain backwards compatibility while still having "omnibox" in the
// manifest. If a user installs the extension on Chrome 9, the browser
// will record the permissions it recognized, not including "omnibox."
// When upgrading to Chrome 10, "omnibox" will be recognized and Chrome
// will disable the extension and prompt the user to approve the increase
// in privileges. The extension could then release a new version that
// removes the "omnibox" permission. When the user upgrades, Chrome will
// still remember that "omnibox" had been granted, so that if the
// extension once again includes "omnibox" in an upgrade, the extension
// can upgrade without requiring this user's approval.

chrome_url_overrides 权限。

当我按照上述步骤使用以下manifest.json

{
    "name": "Permission test",
    "version": "1",
    "manifest_version": 2,
    "chrome_url_overrides": { "newtab": "manifest.json" }
}

然后我得到一个没有任何警告的权限对话框(“此扩展程序不需要特殊权限。”)。因此,如果您在更新中添加此清单密钥,Chrome(经过 54 及更早版本测试)不会禁用您的扩展程序。

意味着您现在可以在不丢失用户的情况下发布扩展程序。用户经常查看新标签页,如果您在未经他们同意的情况下更改它,那么用户可以删除您的扩展程序,如果他们想重新获得对其新标签页的控制权。

并仔细查看Single Purpose Policy of the Chrome Web Store:例如,如果您开始将 NTP 替换为与您的扩展程序功能无关的包含广告的页面,Chrome 网上应用店列表可能会被商店策展人

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-30
    • 2020-05-13
    • 2018-05-25
    • 2020-07-23
    相关资源
    最近更新 更多