简体   繁体   English

WebExtensions和Firefox Android:如何获取BrowserApp对象

[英]WebExtensions and Firefox Android: How to get a BrowserApp object

The MDN page for the BrowserApp object says that it is an alternative way to access some properties that you otherwise could not get to on Android. BrowserApp对象的MDN 页面表示,这是一种访问某些属性的替代方法,这些属性是您以前无法在Android上访问的。 But the way they show how to actually get one of these objects uses the deprecated 'old-style' API that does not work in my extension. 但是,它们显示如何实际获取这些对象之一的方式使用了在我的扩展程序中不起作用的已弃用的“旧式” API。

I need a way for my background script to get a hold of one of these BrowserApp objects, how do I do this? 我需要一种让我的后台脚本拥有这些BrowserApp对象之一的方法,该怎么办? I know that if I use a bootstrap script, the browser will give me one, but I need it in my background script. 我知道如果我使用引导脚本,浏览器会给我一个,但是我的后台脚本中需要它。

I can't use the above var { Cu } = require("chrome") method because "chrome" is not loaded yet by the time my script runs. 我无法使用上述var { Cu } = require("chrome")方法,因为在脚本运行时尚未加载"chrome"

(as an aside, does anyone know if the browser.downloads.download(...) api works on Android? The MDN says it will but the MDN says a lot of things, and at this point I'm wary of blindly trusting the docs) (顺便说一句,是否有人知道browser.downloads.download(...) api是否可以在Android上运行?MDN表示可以,但MDN表示很多事情,在这一点上,我谨防盲目信任文档)

You cannot access BrowserApp by design from webextensions. 您不能通过设计从webextensions访问BrowserApp。 Your best bet is probably asking about the individual things you want to get at via BrowserApp. 最好的选择可能是询问您要通过BrowserApp获得的单个内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM