Parcourir la source

fix bootstrap call with MV3 (fix #1557)

Gildas il y a 1 an
Parent
commit
244654e765
1 fichiers modifiés avec 1 ajouts et 7 suppressions
  1. 1 7
      src/core/content/content-bootstrap.js

+ 1 - 7
src/core/content/content-bootstrap.js

@@ -111,13 +111,7 @@ function getContent() {
 }
 
 function executeBootstrap(data) {
-	const scriptElement = document.createElement("script");
-	scriptElement.textContent = "(()=>{" +
-		"document.currentScript.remove();" +
-		"if (document.readyState=='complete') {run()} else {globalThis.addEventListener('load', run)}" +
-		"function run() {this.bootstrap([" + (new Uint8Array(data)).toString() + "])}" +
-		"})()";
-	document.body.appendChild(scriptElement);
+	document.dispatchEvent(new CustomEvent("single-file-bootstrap", { detail: { data } }));
 }
 
 async function onMessage(message) {