Fixed: Handling of Google Fonts (#85)
This commit is contained in:
parent
6119cbd4e5
commit
168e2ae6a0
|
@ -42,15 +42,20 @@ interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) {
|
||||||
targetDetails = requestAnalyzer.getLocalTarget(requestDetails);
|
targetDetails = requestAnalyzer.getLocalTarget(requestDetails);
|
||||||
targetPath = targetDetails.path;
|
targetPath = targetDetails.path;
|
||||||
|
|
||||||
if (requestDetails.url.includes('fonts.googleapis.com') && !requestDetails.url.includes('Material+Icons')) {
|
if (Regex.GOOGLE_FONTS.test(requestDetails.url)) {
|
||||||
let initiatorDomain = helpers.extractDomainFromUrl(tab.url, true);
|
let initiatorDomain = helpers.extractDomainFromUrl(tab.url, true);
|
||||||
// Check if the website is allowed to load Google Fonts
|
// Check if the website is allowed to load Google Fonts
|
||||||
if (interceptor.blockGoogleFonts === true && !requestAnalyzer.domainsGoogleFonts[initiatorDomain]) {
|
if (interceptor.blockGoogleFonts === true && !requestAnalyzer.domainsGoogleFonts[initiatorDomain]) {
|
||||||
return {
|
return {
|
||||||
'cancel': true
|
'cancel': true
|
||||||
};
|
};
|
||||||
|
} else if (interceptor.blockGoogleFonts === false || requestAnalyzer.domainsGoogleFonts[initiatorDomain]) {
|
||||||
|
return {
|
||||||
|
'cancel': false
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!targetDetails) {
|
if (!targetDetails) {
|
||||||
return interceptor._handleMissingCandidate(requestDetails.url);
|
return interceptor._handleMissingCandidate(requestDetails.url);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue