content_script: wrap inject() inside anonymous function

Do not pollute global scope with inject() function.
This commit is contained in:
Muhammad Faiz 2020-06-15 13:45:54 +07:00
parent ce82f4fc2f
commit d0fc84bf92

View file

@ -28,7 +28,7 @@
var injectScript = document.createElement('script');
// Use textContent instead of src to run inject() synchronously
injectScript.textContent = inject.toString() + "inject();";
injectScript.textContent = "(function(){" + inject.toString() + "inject();})();";
injectScript.onload = function() {
// Remove <script> node after injectScript runs.
this.parentNode.removeChild(this);