1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2024-12-23 16:44:34 +01:00

Improve handling of missing resources (#1043)

This commit is contained in:
nobody 2022-07-05 07:44:07 +02:00
parent 0587988882
commit ff4fc657a5
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A

View File

@ -33,9 +33,11 @@ var stateManager = {};
stateManager.registerInjection = function (tabIdentifier, injection, url) { stateManager.registerInjection = function (tabIdentifier, injection, url) {
let injectionIdentifier, registeredTab, injectionCount, missingCount, initiatorDomain, listedToManipulateDOM; let injectionIdentifier, registeredTab, injectionCount, missingCount, initiatorDomain, listedToManipulateDOM;
injectionIdentifier = injection.source + injection.path; if (injection['result'] !== false) {
registeredTab = stateManager.tabs[tabIdentifier]; injectionIdentifier = injection.source + injection.path;
registeredTab.injections[injectionIdentifier] = injection; registeredTab = stateManager.tabs[tabIdentifier];
registeredTab.injections[injectionIdentifier] = injection;
}
initiatorDomain = helpers.extractDomainFromUrl(url, true) || Address.EXAMPLE; initiatorDomain = helpers.extractDomainFromUrl(url, true) || Address.EXAMPLE;
listedToManipulateDOM = stateManager._domainIsListed(initiatorDomain, 'manipulate-dom'); listedToManipulateDOM = stateManager._domainIsListed(initiatorDomain, 'manipulate-dom');
@ -357,7 +359,7 @@ chrome.webRequest.onErrorOccurred.addListener(function (requestDetails) {
chrome.webRequest.onBeforeRedirect.addListener(function (requestDetails) { chrome.webRequest.onBeforeRedirect.addListener(function (requestDetails) {
let knownRequest = stateManager.requests[requestDetails.requestId]; let knownRequest = stateManager.requests[requestDetails.requestId];
if (knownRequest['targetDetails']['result'] !== false) { if (knownRequest) {
stateManager.registerInjection( stateManager.registerInjection(
knownRequest.tabIdentifier, knownRequest.tabIdentifier,
knownRequest.targetDetails, knownRequest.targetDetails,