aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-08 15:03:07 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-08 16:01:29 -0500
commit8ca44d722c6db79f6f3a1892558c7c24f98abd5e (patch)
tree52f4867445ca09f16ce724e9fb653215c8ed6ab3
parent3c749f87053fea88221453f4a6fe4f194726bb6e (diff)
Prevent scripts from being injected multiple times
-rw-r--r--ext/bg/js/search-frontend.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/bg/js/search-frontend.js b/ext/bg/js/search-frontend.js
index e21dc371..fdf7219c 100644
--- a/ext/bg/js/search-frontend.js
+++ b/ext/bg/js/search-frontend.js
@@ -41,6 +41,9 @@ async function searchFrontendSetup() {
'/fg/js/frontend-initialize.js'
];
for (const src of scriptSrcs) {
+ const node = document.querySelector(`script[src='${src}']`);
+ if (node !== null) { continue; }
+
const script = document.createElement('script');
script.async = false;
script.src = src;