Index: inject.preload.js |
diff --git a/inject.preload.js b/inject.preload.js |
index c35c071ce48f748401a0e3a3de6f267b51712f37..e24c9c9c65fa10ba087c2037b245f455eadce9fe 100644 |
--- a/inject.preload.js |
+++ b/inject.preload.js |
@@ -387,10 +387,16 @@ function injected(eventName, injectedIntoContentWindow) |
if (document instanceof HTMLDocument) |
{ |
- let script = document.createElement("script"); |
- script.type = "application/javascript"; |
- script.async = false; |
- script.textContent = "(" + injected + ")('" + randomEventName + "');"; |
- document.documentElement.appendChild(script); |
- document.documentElement.removeChild(script); |
+ let sandbox = window.frameElement && |
+ window.frameElement.getAttribute("sandbox"); |
+ |
+ if (typeof sandbox != "string" || /(^|\s)allow-scripts(\s|$)/i.test(sandbox)) |
+ { |
+ let script = document.createElement("script"); |
+ script.type = "application/javascript"; |
+ script.async = false; |
+ script.textContent = "(" + injected + ")('" + randomEventName + "');"; |
+ document.documentElement.appendChild(script); |
+ document.documentElement.removeChild(script); |
+ } |
} |