Phase F fix: open-lane token was lost across the dispatch-context swap — mint it in JS; repro spec added
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Td4ujboGuAw26jvbDQzehj
This commit is contained in:
parent
747bf5ecf4
commit
1d8237bc08
5 changed files with 180 additions and 10 deletions
|
|
@ -153,7 +153,12 @@ if (typeof Asyncify !== "undefined" && !globalThis.__wxSchedulerInstalled) {
|
|||
var start = Module["kicadOpenFileStart"];
|
||||
if (typeof start !== "function" || typeof Module["kicadOpenFile"] !== "function") return;
|
||||
Module["kicadOpenFile"] = function (path) {
|
||||
var token = start(path);
|
||||
// Mint the token HERE, in pure JS — the starter runs the load on a
|
||||
// dispatch context and Asyncify-suspends its own frame, so a token
|
||||
// RETURNED from it would arrive as a placeholder (0). We own the token
|
||||
// and await its promise; the job resolves it when the load finishes.
|
||||
var token = self.beginWait("open");
|
||||
start(token, path);
|
||||
// waitPromise consumes early-resolved entries (the fast-error path),
|
||||
// so a job that finished before this await still resolves correctly.
|
||||
return self.waitPromise(token).then(function (r) { return !!r; });
|
||||
|
|
|
|||
Loading…
Reference in a new issue