diff --git a/src/js/contentscript.js b/src/js/contentscript.js index 8d8d5edd0..5791f81de 100644 --- a/src/js/contentscript.js +++ b/src/js/contentscript.js @@ -1,7 +1,7 @@ /******************************************************************************* uBlock Origin - a browser extension to block requests. - Copyright (C) 2014-2017 Raymond Hill + Copyright (C) 2014-2018 Raymond Hill This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -356,8 +356,11 @@ vAPI.injectScriptlet = function(doc, text) { (doc.head || doc.documentElement).appendChild(script); } catch (ex) { } - if ( script && script.parentNode ) { - script.parentNode.removeChild(script); + if ( script ) { + if ( script.parentNode ) { + script.parentNode.removeChild(script); + } + script.textContent = ''; } }; diff --git a/src/js/scriptlet-filtering.js b/src/js/scriptlet-filtering.js index b12825dea..486cd58d9 100644 --- a/src/js/scriptlet-filtering.js +++ b/src/js/scriptlet-filtering.js @@ -78,8 +78,11 @@ (d.head || d.documentElement).appendChild(script); } catch (ex) { } - if ( script && script.parentNode ) { - script.parentNode.removeChild(script); + if ( script ) { + if ( script.parentNode ) { + script.parentNode.removeChild(script); + } + script.textContent = ''; } }; injectScriptlets(document);