Skip to content

Commit ef09e18

Browse files
author
DavidQ
committed
Continued and hardened game hosting reliability.
Updated: - [tools/Workspace Manager/main.js](C:\Users\davidq\Documents\GitHub\HTML-JavaScript-Gaming\tools\Workspace Manager\main.js) - Added a strict block when shared host context cannot be written. - Now refuses game mount with clear status: - `Unable to mount game: workspace host context storage is unavailable in this browser session.` - Requires `hostContextId` on every hosted game iframe URL (removed nullable fallback branch). Validation/report: - [docs/dev/reports/samples2tools_batch_48_validation.txt](C:\Users\davidq\Documents\GitHub\HTML-JavaScript-Gaming\docs\dev\reports\samples2tools_batch_48_validation.txt) (`PASS`) - [docs/dev/reports/samples2tools_batch_48_summary.txt](C:\Users\davidq\Documents\GitHub\HTML-JavaScript-Gaming\docs\dev\reports\samples2tools_batch_48_summary.txt) Commit comment: `Harden Workspace Manager hosted-game flow by blocking mounts when shared host context storage is unavailable, enforcing hostContextId on all game iframe launches, and removing nullable hostContext fallback (batch-48 PASS).`
1 parent 6aca55a commit ef09e18

3 files changed

Lines changed: 29 additions & 6 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Samples2Tools batch 48 summary
2+
Generated: 2026-04-24T22:49:16.610Z
3+
Purpose: harden Workspace Manager game mount flow for sessions where host context storage is unavailable.
4+
5+
Completed this batch:
6+
- Added explicit mount block + status message when host context cannot be written
7+
- Required hostContextId on every hosted game iframe mount URL
8+
- Removed nullable hostContextId fallback branch
9+
10+
Primary validation artifact:
11+
- docs/dev/reports/samples2tools_batch_48_validation.txt (PASS)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Samples2Tools batch 48 validation
2+
Generated: 2026-04-24T22:49:16.610Z
3+
Scope: prevent invalid hosted-game mount when shared host context cannot be persisted.
4+
5+
- [PASS] Game mount blocks when host context storage is unavailable :: tools/Workspace Manager/main.js
6+
- [PASS] Game mount always appends hostContextId when mounting :: tools/Workspace Manager/main.js
7+
- [PASS] No legacy nullable hostContextId fallback branch remains :: tools/Workspace Manager/main.js
8+
9+
Checks: 3
10+
Failures: 0
11+
Result: PASS

tools/Workspace Manager/main.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,11 @@ function mountGameFrame(gameEntry) {
223223
}
224224
}
225225
});
226+
if (!hostContext?.contextId) {
227+
writeStatus("Unable to mount game: workspace host context storage is unavailable in this browser session.");
228+
setCurrentLabel("No game mounted.");
229+
return false;
230+
}
226231

227232
const frame = document.createElement("iframe");
228233
frame.setAttribute("data-game-host-frame", gameEntry.id);
@@ -232,12 +237,8 @@ function mountGameFrame(gameEntry) {
232237
gameUrl.searchParams.set("hosted", "1");
233238
gameUrl.searchParams.set("hostToolId", "workspace-manager");
234239
gameUrl.searchParams.set("hostGameId", gameEntry.id);
235-
if (hostContext?.contextId) {
236-
currentGameHostContextId = hostContext.contextId;
237-
gameUrl.searchParams.set("hostContextId", hostContext.contextId);
238-
} else {
239-
currentGameHostContextId = "";
240-
}
240+
currentGameHostContextId = hostContext.contextId;
241+
gameUrl.searchParams.set("hostContextId", hostContext.contextId);
241242
frame.src = gameUrl.toString();
242243
refs.mountContainer.replaceChildren(frame);
243244
currentGameFrame = frame;

0 commit comments

Comments
 (0)