1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Remove injected script tags after use

This commit is contained in:
bitpshr 2018-11-06 14:26:02 -05:00
parent 34d80f21e2
commit d7b1cacabc

View File

@ -37,8 +37,10 @@ function injectScript (content) {
try {
const container = document.head || document.documentElement
const scriptTag = document.createElement('script')
scriptTag.setAttribute('async', false)
scriptTag.textContent = content
container.insertBefore(scriptTag, container.children[0])
container.removeChild(scriptTag)
} catch (e) {
console.error('MetaMask script injection failed', e)
}