Initial read from extension storage centralized (#561)

This commit is contained in:
nobody 2021-07-10 06:40:13 +02:00
parent 6ba26b7e36
commit c034bf0c04
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
2 changed files with 6 additions and 25 deletions

View File

@ -139,31 +139,6 @@ interceptor._handleStorageChanged = function (changes) {
};
/**
* Initializations
*/
interceptor.xhrTestDomain = Address.LOCALCDN;
interceptor.blockMissing = false;
interceptor.blockGoogleFonts = true;
interceptor.allowedDomainsGoogleFonts = {};
interceptor.relatedSettings = [];
interceptor.relatedSettings.push(Setting.AMOUNT_INJECTED);
interceptor.relatedSettings.push(Setting.XHR_TEST_DOMAIN);
interceptor.relatedSettings.push(Setting.BLOCK_MISSING);
interceptor.relatedSettings.push(Setting.ALLOWED_DOMAINS_GOOGLE_FONTS);
storageManager.type.get(interceptor.relatedSettings, function (items) {
storageManager.amountInjected = items.amountInjected || 0;
interceptor.xhrTestDomain = items.xhrTestDomain || Address.LOCALCDN;
interceptor.allowedDomainsGoogleFonts = items.allowedDomainsGoogleFonts || {};
interceptor.blockMissing = items.blockMissing === undefined ? false : items.blockMissing;
interceptor.blockGoogleFonts = items.blockGoogleFonts === undefined ? true : items.blockGoogleFonts;
});
/**
* Event Handlers
*/

View File

@ -72,6 +72,12 @@ main._initializeSettings = function () {
'path': stateManager.selectedIcon
}, 'Enabled');
storageManager.amountInjected = items.amountInjected || 0;
interceptor.xhrTestDomain = items.xhrTestDomain || Address.LOCALCDN;
interceptor.allowedDomainsGoogleFonts = items.allowedDomainsGoogleFonts || {};
interceptor.blockMissing = items.blockMissing === undefined ? false : items.blockMissing;
interceptor.blockGoogleFonts = items.blockGoogleFonts === undefined ? true : items.blockGoogleFonts;
storageManager.type.set(items);
});
};