小编ron*_*ron的帖子

如果清单是 MV3,Chrome 扩展程序在浏览器重新启动后始终显示“服务工作线程不活动”

我正在使用最新的 chrome:Win 10 Pro 上的版本 100.0.4896.60(官方版本)(64 位)

当我安装扩展时一切正常。

当我关闭 chrome 并重新打开时,扩展程序不再起作用。扩展选项卡显示所有扩展:“辅助服务(非活动)”

单击扩展程序的重新加载按钮后一切正常。

我还测试了它:

https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/examples/hello-world

为了确保这可能适用于某些设置,我卸载了 chrome,删除了所有 chrome 文件并重新安装。

问题仍然存在。

我的朋友使用相同的 chrome 版本似乎没有这个问题。

关于如何解决这个问题有什么建议吗?

这里是代码:

    "use strict";

async function sendRequest(request, sendResponse) {
  try {
    const startTime = Date.now();
    const response = await fetch(request.url, request.options);
    const time = Date.now() - startTime;
    const body = await response.text();
    const headers = [...response.headers].map((el) => ({
      key: el[0],
      value: el[1],
    }));
    sendResponse({
      status: response.status,
      body,
      headers,
      time,
    });
  } catch (err) {
    sendResponse({
      err: err.message
    }); …
Run Code Online (Sandbox Code Playgroud)

google-chrome-extension

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

google-chrome-extension ×1