From 9134c11cf8dcf2c2a515e7a6d8983ee6b0d42858 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 23 May 2023 21:49:42 -0400 Subject: [PATCH] Fix https://github.com/uBlockOrigin/uBlock-issues/issues/2668 Use document.append() only when there are no elements in the DOM, as a document instance can't have more than one direct child. --- platform/firefox/vapi-background-ext.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/firefox/vapi-background-ext.js b/platform/firefox/vapi-background-ext.js index cfa0d5900..72d2e1d37 100644 --- a/platform/firefox/vapi-background-ext.js +++ b/platform/firefox/vapi-background-ext.js @@ -315,7 +315,7 @@ vAPI.scriptletsInjector = ((doc, details) => { script = doc.createElement('script'); script.async = false; script.src = url; - doc.append(script); + (doc.head || doc.documentElement || doc).append(script); self.uBO_scriptletsInjected = details.filters; } catch (ex) { }