MCPcopy Index your code
hub / github.com/hoothin/UserScripts / errorHandler

Function errorHandler

Picviewer CE+/dist.user.js:14081–14115  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

14079 };
14080
14081 function errorHandler(e){
14082 if(aborted)return;
14083
14084 if (!errorBlobList[img.src] && !/^blob:/.test(img.src)) {
14085 errorList[img.src]=true;
14086 let orgSrc = img.src;
14087 _GM_xmlhttpRequest({
14088 method: 'GET',
14089 url: img.src,
14090 responseType: 'blob',
14091 onload: function(response) {
14092 const blobUrl = URL.createObjectURL(response.response);
14093 const releaseBlob = () => URL.revokeObjectURL(blobUrl);
14094 window.addEventListener('beforeunload', releaseBlob);
14095
14096 img.src = blobUrl;
14097 setTimeout(() => {
14098 if (aborted) return;
14099 if (typeof img.width == 'number' && img.width && img.height) {
14100 } else {
14101 errorBlobList[orgSrc] = true;
14102 }
14103 }, 0);
14104 },
14105 onerror: function() {
14106 if (aborted) return;
14107 errorBlobList[orgSrc] = true;
14108 go('error',e);
14109 }
14110 });
14111 return;
14112 }
14113
14114 go('error',e);
14115 };
14116
14117 function removeListener(){
14118 img.removeEventListener('load',loadHandler,true);

Callers

nothing calls this directly

Calls 1

goFunction · 0.70

Tested by

no test coverage detected