Live-app fix (Place Footprints / routing dead in Chrome): submodule bumps carry the coroutine ownership fix (kicad 012d95ecb4) and the handler-exception survival fix (wxwidgets 1b5f0e31f4). Emscripten-6 fallout: - occ/ngspice worker wrappers: mainScriptUrlOrBlob was removed upstream; pthread children re-run the wrapper blob, so an em-pthread realm now importScripts the glue and gets out of the way (before: recursive service boots, pool never fills, silent 180s boot hangs — every occ spec and ngspice bg_run). - Makefile.wasm: -sASYNCIFY frankenlinks on the no-wx coroutine repro targets ported to -sJSPI (the JSPI-only libcontext crashed at first yield under them); mainloop/gl repro pages drive their tick through a promising export (emscripten_set_main_loop callbacks cannot suspend); retired inject-dyncall-shims lines removed (targets were unbuildable since Phase 8); $stringToNewUTF8 force-included (the EM_ASM value bridge aborted the runtime on the first decoded exception). - fiber-park levers: neither embind shape can drive suspending levers (plain throws on strict-JSPI Firefox; emscripten::async() re-executes its invoker on settle) — kept sync for manual Chromium probing, spec coverage moved to the jspi-coroutine harness (18 cases). Suite work: - Playwright 1.61.1 -> 1.62.1 (Firefox 153: JSPI on by default). - fiber-resume-park.spec retired -> coroutine-lifecycle.spec: census gate over boot / board load / chooser open / cancel (deterministically red on the pre-fix build). - Blind asyncify-era pins re-keyed: quasimodal-strand + wait-beacons beacon regexes, footprint-chooser-close liveness -> wx parking-timer heartbeat (scheduler counters idle flat on Firefox). - occ/ngspice test providers: 60s boot timeout + worker error surfacing (a worker death used to be a silent 180s timeout). - Harness pages: stale 9.99 config dir -> 10.0 (library_manager wxCHECK noise, chooser had no libraries). - gal-webgl harness: missing artifacts rebuilt (boost/glm extracted to the host sysroot), PgmOrNull stub added for the rebased GAL. - jspi-scheduler: clean-shutdown console line restored (app-quit contract), quarantine never yanks SP from a live window. Gates: test:e2e 699 passed / 0 failed (wx-chromium, kicad-firefox, kicad-chromium, jspi-firefox, coroutine-firefox); web ff/cr/mobile 71 passed; lint:ci-coverage 166, lint:determinism 163, screenshots manifest 492 current, corpus 7/7, tools:contract green. Offline screenshot baselines show expected mass drift from the engine bump — re-baseline (screenshots:noise -> promote) is a follow-up. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016X9eh1s5sTx1o9Em9KBuwR
205 lines
6.8 KiB
HTML
205 lines
6.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en-us">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<title>KiCad Gerber Viewer WASM</title>
|
|
<style>
|
|
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
|
|
div.emscripten { text-align: center; }
|
|
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
|
|
canvas.emscripten { border: 0px none; }
|
|
|
|
#status {
|
|
position: fixed;
|
|
bottom: 10px;
|
|
left: 10px;
|
|
color: #fff;
|
|
font-family: monospace;
|
|
z-index: 1000;
|
|
background: rgba(0,0,0,0.7);
|
|
padding: 10px;
|
|
border-radius: 5px;
|
|
}
|
|
|
|
#progress {
|
|
width: 300px;
|
|
height: 20px;
|
|
background: #333;
|
|
margin-top: 5px;
|
|
}
|
|
|
|
#progress-bar {
|
|
height: 100%;
|
|
background: #4CAF50;
|
|
width: 0%;
|
|
transition: width 0.3s;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body style="margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: #1a1a2e;">
|
|
<div id="main-window" style="width: 100vw; height: 100vh; position: absolute; top: 0; left: 0;"></div>
|
|
|
|
<div id="status">
|
|
<div id="status-text">Initializing...</div>
|
|
<div id="progress"><div id="progress-bar"></div></div>
|
|
</div>
|
|
|
|
<div id="window-container"></div>
|
|
|
|
<script>
|
|
var mainWindow = document.getElementById('main-window');
|
|
var statusText = document.getElementById('status-text');
|
|
var progressBar = document.getElementById('progress-bar');
|
|
|
|
var showError = function(msg) {
|
|
console.error('[KICAD_ERROR] ' + msg);
|
|
statusText.textContent = 'Error: ' + msg;
|
|
statusText.style.color = 'red';
|
|
};
|
|
|
|
var createCanvas = function() {
|
|
var canvas = document.createElement('canvas');
|
|
canvas.id = 'canvas';
|
|
canvas.style.display = 'none';
|
|
var width = window.innerWidth;
|
|
var height = window.innerHeight;
|
|
canvas.style.width = width + 'px';
|
|
canvas.style.height = height + 'px';
|
|
canvas.oncontextmenu = function() { event.preventDefault(); };
|
|
canvas.addEventListener("webglcontextlost", function(e) {
|
|
showError('WebGL context lost. You will need to reload the page.');
|
|
e.preventDefault();
|
|
}, false);
|
|
|
|
mainWindow.appendChild(canvas);
|
|
Module.canvas = canvas;
|
|
|
|
console.log('[KICAD] preRun complete, canvas created: ' + width + 'x' + height);
|
|
};
|
|
|
|
var onRuntimeInitialized = function() {
|
|
console.log('[KICAD] Runtime initialized');
|
|
var canvas = Module.canvas;
|
|
canvas.style.display = 'block';
|
|
document.getElementById('status').style.display = 'none';
|
|
};
|
|
|
|
// Pre-fetched resource data (fetched before pl_editor.js loads)
|
|
var resourceData = null;
|
|
|
|
fetch('images.tar.gz')
|
|
.then(function(response) {
|
|
if (!response.ok) throw new Error('HTTP ' + response.status);
|
|
return response.arrayBuffer();
|
|
})
|
|
.then(function(buffer) {
|
|
resourceData = new Uint8Array(buffer);
|
|
console.log('[KICAD] Prefetched images.tar.gz (' + resourceData.length + ' bytes)');
|
|
})
|
|
.catch(function(err) {
|
|
console.warn('[KICAD] Could not prefetch images.tar.gz:', err.message);
|
|
});
|
|
|
|
var writeResources = function() {
|
|
var resourcePath = '/workspace/build-wasm/sysroot/share/kicad/resources';
|
|
FS.mkdirTree(resourcePath);
|
|
|
|
if (resourceData) {
|
|
FS.writeFile(resourcePath + '/images.tar.gz', resourceData);
|
|
console.log('[KICAD] Wrote images.tar.gz to ' + resourcePath);
|
|
} else {
|
|
console.warn('[KICAD] images.tar.gz not ready yet (WASM loaded faster than fetch)');
|
|
}
|
|
};
|
|
|
|
// Land the user in a sane, writable directory instead of MEMFS root (where
|
|
// the only visible entries are /dev, /proc, /tmp, /workspace, /home).
|
|
// The Open/Save dialogs default to cwd when no explicit defaultDir is set.
|
|
var setupHomeDir = function() {
|
|
var home = '/home/kicad';
|
|
FS.mkdirTree(home);
|
|
FS.chdir(home);
|
|
console.log('[KICAD] cwd set to ' + home);
|
|
};
|
|
|
|
// Seed a minimal default config before main() so STARTWIZARD finds
|
|
// NeedsUserInput()==false and the first-run setup wizard never opens —
|
|
// same as eeschema.html / pl_editor.html.
|
|
var seedKicadConfig = function() {
|
|
var cfgDir = '/home/kicad/.config/kicad/kicad/10.0';
|
|
FS.mkdirTree(cfgDir);
|
|
|
|
var writeIfAbsent = function(path, contents) {
|
|
try { FS.stat(path); return; } catch (e) { /* absent — seed it */ }
|
|
FS.writeFile(path, contents);
|
|
console.log('[KICAD] Seeded ' + path);
|
|
};
|
|
|
|
writeIfAbsent(cfgDir + '/kicad_common.json', JSON.stringify({
|
|
do_not_show_again: { update_check_prompt: true, data_collection_prompt: true }
|
|
}, null, 2));
|
|
writeIfAbsent(cfgDir + '/sym-lib-table', '(sym_lib_table\n (version 7)\n)\n');
|
|
writeIfAbsent(cfgDir + '/fp-lib-table', '(fp_lib_table\n (version 7)\n)\n');
|
|
writeIfAbsent(cfgDir + '/design-block-lib-table', '(design_block_lib_table\n (version 7)\n)\n');
|
|
};
|
|
|
|
var Module = {
|
|
thisProgram: '/usr/bin/gerbview', // Fake absolute path for argv[0]
|
|
|
|
preRun: [createCanvas, writeResources, setupHomeDir, seedKicadConfig],
|
|
postRun: [],
|
|
|
|
print: function(text) {
|
|
if (arguments.length > 1)
|
|
text = Array.prototype.slice.call(arguments).join(' ');
|
|
console.log('[KICAD_OUT] ' + text);
|
|
},
|
|
|
|
printErr: function(text) {
|
|
if (arguments.length > 1)
|
|
text = Array.prototype.slice.call(arguments).join(' ');
|
|
console.error('[KICAD_ERR] ' + text);
|
|
},
|
|
|
|
setStatus: function(text) {
|
|
console.log('[KICAD_STATUS] ' + text);
|
|
statusText.textContent = text;
|
|
|
|
var match = text.match(/(\d+)\/(\d+)/);
|
|
if (match) {
|
|
var pct = (parseInt(match[1]) / parseInt(match[2])) * 100;
|
|
progressBar.style.width = pct + '%';
|
|
}
|
|
},
|
|
|
|
totalDependencies: 0,
|
|
monitorRunDependencies: function(left) {
|
|
this.totalDependencies = Math.max(this.totalDependencies, left);
|
|
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
|
|
},
|
|
|
|
onRuntimeInitialized: onRuntimeInitialized,
|
|
|
|
locateFile: function(path) {
|
|
return path;
|
|
}
|
|
};
|
|
|
|
Module.setStatus('Downloading...');
|
|
|
|
window.onerror = function(msg, url, line) {
|
|
showError(msg + ' at ' + url + ':' + line);
|
|
Module.setStatus = function(text) {
|
|
if (text) Module.printErr('[post-exception status] ' + text);
|
|
};
|
|
return false;
|
|
};
|
|
</script>
|
|
|
|
<!-- wxWidgets WASM glue code (defines getConfigEntryLength, etc.) -->
|
|
<script src="wx.js"></script>
|
|
<script src="wx-dom.js"></script>
|
|
<script async src="gerbview.js"></script>
|
|
</body>
|
|
</html>
|