1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2024-12-23 08:30:38 +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) {
let injectionIdentifier, registeredTab, injectionCount, missingCount, initiatorDomain, listedToManipulateDOM;
injectionIdentifier = injection.source + injection.path;
registeredTab = stateManager.tabs[tabIdentifier];
registeredTab.injections[injectionIdentifier] = injection;
if (injection['result'] !== false) {
injectionIdentifier = injection.source + injection.path;
registeredTab = stateManager.tabs[tabIdentifier];
registeredTab.injections[injectionIdentifier] = injection;
}
initiatorDomain = helpers.extractDomainFromUrl(url, true) || Address.EXAMPLE;
listedToManipulateDOM = stateManager._domainIsListed(initiatorDomain, 'manipulate-dom');
@ -357,7 +359,7 @@ chrome.webRequest.onErrorOccurred.addListener(function (requestDetails) {
chrome.webRequest.onBeforeRedirect.addListener(function (requestDetails) {
let knownRequest = stateManager.requests[requestDetails.requestId];
if (knownRequest['targetDetails']['result'] !== false) {
if (knownRequest) {
stateManager.registerInjection(
knownRequest.tabIdentifier,
knownRequest.targetDetails,