MCPcopy
hub / github.com/librespeed/speedtest / clearRequests

Function clearRequests

speedtest_worker.js:267–290  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

265});
266// stops all XHR activity, aggressively
267function clearRequests() {
268 tverb("stopping pending XHRs");
269 if (xhr) {
270 for (let i = 0; i < xhr.length; i++) {
271 try {
272 xhr[i].onprogress = null;
273 xhr[i].onload = null;
274 xhr[i].onerror = null;
275 } catch (e) {}
276 try {
277 xhr[i].upload.onprogress = null;
278 xhr[i].upload.onload = null;
279 xhr[i].upload.onerror = null;
280 } catch (e) {}
281 try {
282 xhr[i].abort();
283 } catch (e) {}
284 try {
285 delete xhr[i];
286 } catch (e) {}
287 }
288 xhr = null;
289 }
290}
291// gets client's IP using url_getIp, then calls the done function
292let ipCalled = false; // used to prevent multiple accidental calls to getIp
293let ispInfo = ""; //used for telemetry

Callers 4

dlTestFunction · 0.85
ulTestFunction · 0.85
pingTestFunction · 0.85

Calls 1

tverbFunction · 0.85

Tested by

no test coverage detected