Google chrome extension Firefox插件无法识别扩展名。getBackgroundPage()

Google chrome extension Firefox插件无法识别扩展名。getBackgroundPage(),google-chrome-extension,firefox-addon-webextensions,Google Chrome Extension,Firefox Addon Webextensions,我有一个简单的问题,我把一个Chrome扩展移植到Firefox上,除了调用Chrome.Extension.getBackgroundPage()之外,其他一切似乎都很好来自popup.js它给了我类型错误-我还尝试了关键字浏览器,而不是浏览器,比如browser.extension.getBackgroundPage()我仍然遇到同样的错误 TypeError:browser.runtime.getBackgroundPage不是函数 完全错误如下所示 TypeError:browser.r

我有一个简单的问题,我把一个Chrome扩展移植到Firefox上,除了调用
Chrome.Extension.getBackgroundPage()之外,其他一切似乎都很好
来自
popup.js
它给了我
类型错误
-我还尝试了关键字
浏览器
,而不是
浏览器
,比如
browser.extension.getBackgroundPage()
我仍然遇到同样的错误

TypeError:browser.runtime.getBackgroundPage不是函数

完全错误如下所示

TypeError:browser.runtime.getBackgroundPage不是函数[Learn] 更多]popup.js:142:5 莫兹-extension://326d52a1-ea8a-4aa2-8845-10bfb334a761/popup.js:142:5 j

我正试图从
popup.js

$(document).ready(function () {
   var myFucn = chrome.extension.getBackgroundPage(); // Error at this line
});

如果扩展在Chrome中运行得很好,你知道我做错了什么吗?

AFAIK这是Firefox私有模式中的一个错误/怪癖。你必须使用消息。是的,我读过,但我没有使用私有模式。好吧,消息是你唯一的解决方案-我很久以前就遇到过这个错误,他们还没有修复它。该死,这真是令人伤心,我最近添加了一些新功能,需要从popup.js调用后台函数,而popup.js在chrome中工作,所以我认为它在Firefox中也能工作,但哦,好吧。。。谢谢你让我知道:(