MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / setup

Method setup

test/test_browser.py:757–793  ·  view source on GitHub ↗
(assetLocalization)

Source from the content-addressed store, hash-verified

755 ''')
756
757 def setup(assetLocalization):
758 create_file('on_window_error_shell.html', r'''
759 <html>
760 <body>
761 <center><canvas id='canvas' width='256' height='256'></canvas></center>
762 <hr><div id='output'></div><hr>
763 <script type='text/javascript'>
764 const errorHandler = async (event) => {
765 if (globalThis.disableErrorReporting) return;
766 event.stopImmediatePropagation();
767 const error = String(event instanceof ErrorEvent ? event.message : (event.reason || event));
768 globalThis.disableErrorReporting = true;
769 window.onerror = null;
770 var result = error.includes("test.data") ? 1 : 0;
771 await fetch('/report_result?' + result);
772 window.close();
773 }
774 window.addEventListener('error', errorHandler);
775 window.addEventListener('unhandledrejection', errorHandler);
776 const outputElem = document.getElementById('output');
777 var Module = {
778 locateFile: (path, prefix) => {
779 if (path.endsWith('.wasm')) {
780 return prefix + path;
781 } else {
782 return "''' + assetLocalization + r'''" + path;
783 }
784 },
785 print: () => {
786 outputElem.innerHTML += text.replace('\n', '<br>', 'g') + '<br>';
787 },
788 canvas: document.getElementById('canvas')
789 };
790 </script>
791 {{{ SCRIPT }}}
792 </body>
793 </html>''&#x27;)
794
795 # test test missing file should run xhr.onload with status different than 200, 304 or 206
796 setup("")

Callers 2

mainFunction · 0.80
parse_argsFunction · 0.80

Calls 2

create_fileFunction · 0.90
ensure_dirFunction · 0.90

Tested by

no test coverage detected