More specific content-type exception for dynamic script injection.

This commit is contained in:
hackademix 2018-07-09 00:08:26 +02:00
parent 48690ee92e
commit dac392deda
1 changed files with 2 additions and 1 deletions

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
{ {
let NULL = new Uint8Array(); let NULL = new Uint8Array();
let xmlFeedOrImage = /^(?:(?:application|text)\/(?:(?:r(?:ss|df)|atom)\+)?xml(;|$))|image\//i;
let brokenOnLoad = (async () => parseInt(await browser.runtime.getBrowserInfo().version) < 61); let brokenOnLoad = (async () => parseInt(await browser.runtime.getBrowserInfo().version) < 61);
let pendingRequests = new Map(); let pendingRequests = new Map();
@ -60,7 +61,7 @@
let content = this.getContentMetaData(request); let content = this.getContentMetaData(request);
debug(request.url, content.type); debug(request.url, content.type);
if (/^[\w/+-]*\b(xml|image)\b/i.test(content.type) && !/\bhtml\b/i.test(content.type)) return; if (xmlFeedOrImage.test(content.type) && !/\/svg\b/i.test(content.type)) return;
let filter = browser.webRequest.filterResponseData(requestId); let filter = browser.webRequest.filterResponseData(requestId);
let buffer = []; let buffer = [];