@@ -70,7 +70,7 @@ def write_browser_extension(configuration, browser):
7070 }
7171""" )
7272
73- contentPath = "build/capture/" + browser + "/scripts/content .js"
73+ contentPath = "build/capture/" + browser + "/scripts/mainContent .js"
7474 write_content_script (contentPath , configuration )
7575 add_suffix_to_file (contentPath , """
7676let __webGPUReconstruct = new __WebGPUReconstruct();
@@ -80,20 +80,32 @@ def write_browser_extension(configuration, browser):
8080document.addEventListener('__WebGPUReconstruct_saveCapture', function() {
8181 __webGPUReconstruct.finishCapture();
8282});
83+
84+ __webGPUReconstruct.optionsPromise = new Promise((resolve) => {
85+ window.addEventListener("message", function __WebGPUReconstruct_MessageListener(event) {
86+ if (event.source === window && event?.data?.type === "WebGPUReconstruct Options") {
87+ __webGPUReconstruct.configure(event.data.message);
88+ window.removeEventListener("message", __WebGPUReconstruct_MessageListener);
89+ resolve();
90+ }
91+ });
92+ });
8393""" )
8494
8595 shutil .make_archive ("build/capture/" + browser , 'zip' , "build/capture/" + browser )
8696
8797def write_module (configuration ):
8898 Path ("build/capture/module" ).mkdir (parents = True , exist_ok = True )
8999 contentPath = "build/capture/module/WebGPUReconstruct.js"
90- shutil .copyfile ("capture/scripts/content .js" , contentPath )
100+ shutil .copyfile ("capture/scripts/mainContent .js" , contentPath )
91101 write_content_script (contentPath , configuration )
92102 add_suffix_to_file (contentPath , """
93103let __webGPUReconstruct;
94104
95- function start() {
105+ function start(configuration ) {
96106 __webGPUReconstruct = new __WebGPUReconstruct();
107+ __webGPUReconstruct.configure(configuration);
108+ __webGPUReconstruct.optionsPromise = new Promise((resolve) => { resolve() });
97109}
98110
99111function finish() {
0 commit comments