内容脚本模式“ *://mail.google.com/*”与使用Firefox时的gmail不匹配

问题描述 投票:0回答:1

我有一个为chrome写的扩展名。最近,我决定将其移植到firefox上,而令我惊讶的是,开箱即用的功能几乎没有任何变化。但是,令我绊倒的一件事是由于某种原因我的gmail.js内容脚本未加载。这是我的内容脚本:

{
  "name": "Copy Machine",
  "description": "Copies text more better",
  "version": "0.6",
  "permissions": ["contextMenus", "tabs"],
  "icons": { 
    "16": "icon_16.png",
    "32": "icon_32.png"
  },
  "background": {
    "scripts": ["background.js"]
  },
  "manifest_version": 2,
  "content_scripts": [
        {
          "matches": [
              "*://mail.google.com/*"
          ],
          "js": ["gmail.js"],
          "run_at": "document_idle"
        },
        {
          "matches": [
              "<all_urls>"
          ],
          "js": ["generic.js"],
          "run_at": "document_idle"
        }
    ]
}

我的gmail.js内容脚本的第一行是:console.log("GMAIL SCRIPT IS RUNNING");

而且,generic.js内容脚本的第一行是:console.log("GENERIC SCRIPT IS RUNNING");

[当我在firefox中打开我的gmail帐户时,在控制台中看到“ GENERIC SCRIPT IS RUNNING”,但没有看到“ GMAIL SCRIPT IS RUNNING。”

对于google chrome,它可以按我的预期工作,但是由于某种原因,URL模式不匹配。我有什么想念的吗?谢谢。

google-chrome-extension firefox-webextensions
1个回答
0
投票

所以我最终在清单文件的"*://mail.google.com/*"中添加了permissions,使事情按我预期的方式工作。然后,我不得不使用不可用的api修复其他一些错误,这是我应该开始的工作:

https://extensionworkshop.com/documentation/develop/porting-a-google-chrome-extension/

然后我回去提交错误报告,当我删除"*://mail.google.com/*"时,它继续起作用。因此,也许正在发生一些奇怪的循环依赖问题?我不确定。

© www.soinside.com 2019 - 2024. All rights reserved.