| Index: inject.preload.js |
| diff --git a/inject.preload.js b/inject.preload.js |
| index c35c071ce48f748401a0e3a3de6f267b51712f37..3b1e1f61bb9da682e7202f8a9549c82ad2fcb248 100644 |
| --- a/inject.preload.js |
| +++ b/inject.preload.js |
| @@ -387,10 +387,15 @@ 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"); |
|
Sebastian Noack
2017/05/30 09:41:16
Nit: The indentation looks a bit off here.
kzar
2017/05/30 10:20:31
Done.
|
| + if (typeof sandbox != "string" || sandbox.includes("allow-scripts")) |
|
Sebastian Noack
2017/05/30 09:41:16
What if allow-scripts is misspelled like "allow-sc
kzar
2017/05/30 10:20:31
Well a false-positive doesn't matter here, it just
Sebastian Noack
2017/05/30 10:36:46
I wonder whether we even need this check. If scrip
Sebastian Noack
2017/05/30 10:43:34
Never mind. We are in the extension's content scri
kzar
2017/05/30 12:27:15
Doing some further reading I realised that window.
|
| + { |
| + let script = document.createElement("script"); |
| + script.type = "application/javascript"; |
| + script.async = false; |
| + script.textContent = "(" + injected + ")('" + randomEventName + "');"; |
| + document.documentElement.appendChild(script); |
| + document.documentElement.removeChild(script); |
| + } |
| } |