(pic1 中的 30119999.xml,有一个齿轮标记 pre name)
我在 Web Worker 中设置了这个请求,响应数据没问题,我在 onmessage 回调中终止了它
但是为什么请求总是处于待处理状态并且无法预览,请帮助。
伪代码:
const workerBlob = new Blob([`onmessage = function (event) {
const xhr = new XMLHttpRequest();
xhr.addEventListener('load', function () {
postMessage(xhr.response);
});
xhr.open('GET', event.data.url, true);
xhr.send();
}`], { type: 'application/javascript' });
const workerURL = URL.createObjectURL(workerBlob);
const worker = new Worker(workerUrl);
worker.postMessage({url});
worker.onmessage = (message) => {
// do something
worker.terminate();
};
最佳答案
根据 Debugging Service Workers :
The gear icon signifies that these requests came from the Service Worker itself. Specifically, these are the requests being made by the Service Worker's install handler to populate the offline cache.
关于google-chrome-devtools - Chrome 网络请求表中带有齿轮图标的名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48336926/