From d3cacf634fad5a80c8a715df60d3e53f008252df Mon Sep 17 00:00:00 2001 From: hackademix Date: Thu, 26 Jul 2018 19:33:46 +0200 Subject: More edge cases covered in dynamic script injection. --- src/bg/RequestGuard.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/bg/RequestGuard.js') diff --git a/src/bg/RequestGuard.js b/src/bg/RequestGuard.js index 5220658..5a281fb 100644 --- a/src/bg/RequestGuard.js +++ b/src/bg/RequestGuard.js @@ -99,12 +99,14 @@ var RequestGuard = (() => { } } let collection = records[what]; - if (type in collection) { - if (!collection[type].includes(requestKey)) { - collection[type].push(requestKey); + if (collection) { + if (type in collection) { + if (!collection[type].includes(requestKey)) { + collection[type].push(requestKey); + } + } else { + collection[type] = [requestKey]; } - } else { - collection[type] = [requestKey]; } return records; }, @@ -425,12 +427,12 @@ var RequestGuard = (() => { } if (!capabilities.has("media")) { RequestUtil.executeOnStart(request, { - code: "window.mediaBlocker = true;" + code: "window.mediaBlocker = correctFrame();" }); } RequestUtil.executeOnStart(request, { - file: "content/media.js" + file: "/content/media.js" }); } else if (request.type === "main_frame" && !TabStatus.map.has(tabId)) { debug("No TabStatus data yet for noscriptFrame", tabId); -- cgit v1.2.3