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/content/media.js | 7 +++---- src/content/webglHook.js | 9 +++------ 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'src/content') diff --git a/src/content/media.js b/src/content/media.js index b975bef..ead6e05 100644 --- a/src/content/media.js +++ b/src/content/media.js @@ -1,5 +1,5 @@ -debug("Media Hook (blocked %s)", !!window.mediaBlocker, document.URL, document.documentElement && document.documentElement.innerHTML); -try { +if (correctFrame()) { + debug("Media Hook (blocked %s)", !!window.mediaBlocker, document.URL, document.documentElement && document.documentElement.innerHTML); (() => { let unpatched = new Map(); function patch(obj, methodName, replacement) { @@ -56,6 +56,5 @@ try { }); })(); -} catch (e) { - error(e, "Cannot patch MediaSource"); + document.URL; } diff --git a/src/content/webglHook.js b/src/content/webglHook.js index c3b7aaa..39637e2 100644 --- a/src/content/webglHook.js +++ b/src/content/webglHook.js @@ -1,5 +1,5 @@ -debug("WebGL Hook", document.URL, document.documentElement && document.documentElement.innerHTML); -try { +if (correctFrame()) { + debug("WebGL Hook", document.URL, document.documentElement && document.documentElement.innerHTML); let proto = HTMLCanvasElement.prototype; let getContext = proto.getContext; exportFunction(function(type, ...rest) { @@ -24,8 +24,5 @@ try { } return getContext.call(this, type, ...rest); }, proto, {defineAs: "getContext"}); -} catch (e) { - console.error(e); + document.URL; } - -null; -- cgit v1.2.3