WebPanel: publish Failed together with the browser-fallback outcome
A plugin polling between Failed and OpenedInBrowser saw Failed with no flag and, per the docs, opened the page itself: a second open with a spent code. While the fallback is pending the status keeps its pre-failure value; after OpenInBrowser (outside the lock) one lock sets Failed, the error and, when the browser opened, the flag. The no-fallback path is unchanged. Harness: OpenInBrowser delay mode and a continuous poll in CreateFailureFallsBack. Show comments reworded as defensive, not observed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
537a40a430
commit
7e2cf67e30
3 changed files with 49 additions and 11 deletions
|
|
@ -25,6 +25,7 @@ public static unsafe class PayloadEntry
|
|||
public static void SetEnvironmentDelay(int ms) => _env!.DelayMs = ms;
|
||||
public static void SetBrowserFolder(string? folder) => _env!.BrowserFolder = folder;
|
||||
public static void SetBrowserFails(bool fails) => _env!.BrowserFails = fails;
|
||||
public static void SetBrowserDelay(int ms) => _env!.BrowserDelayMs = ms;
|
||||
public static void SetWorld(string world) => _env!.World = world;
|
||||
|
||||
/// <summary>The engine's WebPanelApi.Open path: read the caller's struct, then the host.</summary>
|
||||
|
|
@ -111,6 +112,7 @@ public static unsafe class PayloadEntry
|
|||
public volatile int DelayMs;
|
||||
public volatile string? BrowserFolder;
|
||||
public volatile bool BrowserFails; // OpenInBrowser returns false without recording a call
|
||||
public volatile int BrowserDelayMs; // OpenInBrowser sleeps first (a slow ShellExecute)
|
||||
public volatile string World = "Harness World";
|
||||
|
||||
public IntPtr GameHwnd { get; }
|
||||
|
|
@ -122,6 +124,7 @@ public static unsafe class PayloadEntry
|
|||
public bool OpenInBrowser(string url)
|
||||
{
|
||||
if (!WebPanelUrlPolicy.IsBrowserSafe(url)) { _log("HARNESS: OpenInBrowser got an unsafe url"); return false; }
|
||||
if (BrowserDelayMs > 0) Thread.Sleep(BrowserDelayMs);
|
||||
if (BrowserFails) { _log("HARNESS: OpenInBrowser set to fail"); return false; }
|
||||
_browser(url);
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue