Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion background.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function handleErrorsRequest(data, sender, sendResponse) {
}
error.type = 'File not found';
error.text = error.url;
popupErrors.unshift('File not found: ' + htmlentities(error.url));
popupErrors.unshift('Failed to load: ' + htmlentities(error.url));
}
else {
error.text = error.text.replace(/^Uncaught /, '').replace(/^Error: /, '');
Expand Down
19 changes: 19 additions & 0 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,25 @@ new function() {
}));
}
}, true);

// handle 404 errors from xhr
XMLHttpRequest.prototype.jse__open = XMLHttpRequest.prototype.open
XMLHttpRequest.prototype.jse__onload = function(e) {
if (this.status >= 400) {
document.dispatchEvent(new CustomEvent('ErrorToExtension', {
detail: {
is404: true,
url: this.jse__url
}
}));
}
};
XMLHttpRequest.prototype.open = function(m, u, a) {
this.jse__url = u
this.addEventListener('load', this.jse__onload, { once : true });
return this.jse__open(m, u, a);
};

}

var script = document.createElement('script');
Expand Down