class Opal::CliRunners::Firefox
def prepare_files_in(dir)
def prepare_files_in(dir) js = builder.to_s map = builder.source_map.to_json ext = builder.output_extension module_type = ' type="module"' if builder.esm? # CDP can't handle huge data passed to `addScriptToEvaluateOnLoad` # https://groups.google.com/a/chromium.org/forum/#!topic/chromium-discuss/U5qyeX_ydBo # The only way is to create temporary files and pass them to the browser. File.binwrite("#{dir}/index.#{ext}", js) File.binwrite("#{dir}/index.#{ext}.map", map) File.binwrite("#{dir}/index.html", <<~HTML) <!DOCTYPE html> <html><head> <meta charset='utf-8'> <link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon"> <script> window.opalheadlessfirefox = true; </script> </head><body> <script src='/index.#{ext}'#{module_type}></script> </body></html> HTML end