在给定 URL 和 tabId 的情况下,是否有在 main_frame 中发出 http 请求的网络扩展 API?

Is there a webextesnion API that makes an http request in the main_frame given a URL and a tabId?

我正在寻找一种方法来为给定的 URL 和 tabID 发出 HTTP 请求。 URL 不是用户提供的,而是从扩展代码中获取的。

HTTP 请求需要传递到地址栏,因为我有一个 onBeforeRequest 观察者,我指定它给 "main_frame" URLs 必须能够观察到 URL(虽然不是用户输入的)。

我看着 webNavigation 和 webRequest APIs 没有希望。有什么办法可以实现吗?

编辑: 知道我可以将其连接到点击事件。但是,读取 URL、tabId 并将请求传递到 URL 地址栏以便 onBeforeRequest 观察者可以看到它的 API 是什么?

应该这样做:

var tabId = 1;
var url = 'google.com';

browser.tabs.update(
  tabId,
  {url: url}
);