Преглед изворни кода

fix bootstrap call with MV3 (fix #1557)

Gildas пре 1 година
родитељ
комит
244654e765
1 измењених фајлова са 1 додато и 7 уклоњено
  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) {