From e8e8e85219dad2e7285a73f0f5cb0ffb77003eb3 Mon Sep 17 00:00:00 2001 From: Mengdi Chen Date: Fri, 24 Feb 2023 14:53:48 -0500 Subject: [PATCH] [DevTools] remove script tag immediately --- .../src/contentScripts/prepareInjection.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/react-devtools-extensions/src/contentScripts/prepareInjection.js b/packages/react-devtools-extensions/src/contentScripts/prepareInjection.js index b5d667d26254a..4ab0500f59ddb 100644 --- a/packages/react-devtools-extensions/src/contentScripts/prepareInjection.js +++ b/packages/react-devtools-extensions/src/contentScripts/prepareInjection.js @@ -26,10 +26,8 @@ function injectScriptSync(src) { function injectScriptAsync(src) { const script = document.createElement('script'); script.src = src; - script.onload = function () { - script.remove(); - }; nullthrows(document.documentElement).appendChild(script); + nullthrows(script.parentNode).removeChild(script); } let lastDetectionResult;