content_script: wrap inject() inside anonymous function
Do not pollute global scope with inject() function.
This commit is contained in:
parent
ce82f4fc2f
commit
d0fc84bf92
1 changed files with 1 additions and 1 deletions
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
var injectScript = document.createElement('script');
|
var injectScript = document.createElement('script');
|
||||||
// Use textContent instead of src to run inject() synchronously
|
// Use textContent instead of src to run inject() synchronously
|
||||||
injectScript.textContent = inject.toString() + "inject();";
|
injectScript.textContent = "(function(){" + inject.toString() + "inject();})();";
|
||||||
injectScript.onload = function() {
|
injectScript.onload = function() {
|
||||||
// Remove <script> node after injectScript runs.
|
// Remove <script> node after injectScript runs.
|
||||||
this.parentNode.removeChild(this);
|
this.parentNode.removeChild(this);
|
||||||
|
|
Loading…
Reference in a new issue