@ai-ecoverse/slicc-shared-web 1.18.0 → 1.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -150,7 +150,7 @@ A pause in one target blocks every page in the same renderer process, so those p
150
150
  Why it works the way it does:
151
151
 
152
152
  - Playwright detaches from shared workers, which resumes them early, so their coverage started late about half the time. Raw CDP keeps every worker paused until the profiler runs.
153
- - `debugger;` pauses in `beforeunload` but not in `pagehide` or `pageswap`, so a `beforeunload` hook, installed after `Page.enable`, takes the coverage of a page before it navigates. The pause only answers CDP when the page itself starts the navigation, so `goto` and `reload` go through `location`, never `Page.navigate` or `Page.reload`. Navigating away from `about:blank` skips the coverage dump so the first real load is not held in `beforeunload` for a useless snapshot.
153
+ - `debugger;` pauses in `beforeunload` but not in `pagehide` or `pageswap`, so a `beforeunload` hook, installed after `Page.enable`, takes the coverage of a page before it navigates. The pause only answers CDP when the page itself starts the navigation, so `goto` and `reload` go through `location`, never `Page.navigate` or `Page.reload`; they schedule it with `setTimeout` in an isolated world of the page (so page code that replaces its timers can't stop it), so the `Runtime.evaluate` that starts it answers before the old document goes, which otherwise loses the race on a slow runner ("Inspected target navigated or closed"). Navigating away from `about:blank` skips the coverage dump so the first real load is not held in `beforeunload` for a useless snapshot.
154
154
  - `goto` used to return as soon as the document swapped (`window.stale` cleared), which is before `readyState` is `complete` and before module scripts run. About 1 load in 20 then looked blank to the next assertion. It now waits for a complete, non-blank document.
155
155
  - `takePreciseCoverage` resets the counters, so every snapshot is a delta, and all of them are kept and summed.
156
156
  - monocart's `add()` from parallel test processes loses data, so each test writes raw JSON and the teardown merges it once.
package/harness/page.mjs CHANGED
@@ -187,7 +187,12 @@ export function page(
187
187
  async function navigate(expression) {
188
188
  for (let attempt = 0; attempt < 2; attempt++) {
189
189
  await evaluate(mark);
190
- await send('Runtime.evaluate', { expression });
190
+ const { frameTree } = await send('Page.getFrameTree');
191
+ const { executionContextId: contextId } = await send('Page.createIsolatedWorld', {
192
+ frameId: frameTree.frame.id,
193
+ worldName: 'slicc-harness-navigate',
194
+ });
195
+ await send('Runtime.evaluate', { expression, contextId });
191
196
  try {
192
197
  await until(fresh);
193
198
  return;
@@ -207,8 +212,11 @@ export function page(
207
212
  within,
208
213
  probed: () => Promise.all(probes),
209
214
  press,
210
- goto: (path) => navigate(`location.assign(${JSON.stringify(new URL(path, server.url).href)})`),
211
- reload: () => navigate('location.reload()'),
215
+ goto: (path) =>
216
+ navigate(
217
+ `setTimeout(() => location.assign(${JSON.stringify(new URL(path, server.url).href)}))`
218
+ ),
219
+ reload: () => navigate('setTimeout(() => location.reload())'),
212
220
  insert: (text) => send('Input.insertText', { text }),
213
221
  close: () => cdp.send('Target.closeTarget', { targetId }),
214
222
  enter: () => press('Enter'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-shared-web",
3
- "version": "1.18.0",
3
+ "version": "1.18.1",
4
4
  "description": "Shared Renovate, Biome, TypeScript, lefthook and GitHub Actions configuration, plus the CDP integration-test harness, for SLICC's web repos",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",