@botiverse/porthole 0.9.0 → 0.10.0

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.
@@ -57,10 +57,14 @@ async function click(display: LaunchedDisplay, selector: string): Promise<void>
57
57
  await (await display.frame()).locator(selector).click();
58
58
  }
59
59
 
60
- async function bodyData(display: LaunchedDisplay, name: string): Promise<string> {
60
+ async function bodyData(display: LaunchedDisplay, name: string, verdict?: string): Promise<string> {
61
61
  const frame = await display.frame();
62
+ // A probe's verdict where the answer is a wall's (P096): none coming fails it, not its setup.
62
63
  await expect
63
- .poll(() => frame.locator("body").getAttribute(`data-${name}`), { timeout: 5_000 })
64
+ .poll(() => frame.locator("body").getAttribute(`data-${name}`), {
65
+ timeout: 5_000,
66
+ ...(verdict === undefined ? {} : { message: verdict }),
67
+ })
64
68
  .not.toBeNull();
65
69
  return (await frame.locator("body").getAttribute(`data-${name}`)) ?? "";
66
70
  }
@@ -92,10 +96,21 @@ export const CLIPBOARD_PROBES: readonly Probe[] = [
92
96
  });
93
97
  await seed(context.page, SEED);
94
98
  await click(display, "#go");
95
- expect(await bodyData(display, "text")).toMatch(/^refused/u);
96
- expect(await bodyData(display, "item")).toMatch(/^refused/u);
97
- expect(await bodyData(display, "read")).toMatch(/^refused/u);
98
- expect(await pasted(context.page), "the clipboard still holds the person's own").toBe(SEED);
99
+ expect(
100
+ await bodyData(display, "text", "probe: writeText is refused"),
101
+ "probe: writeText is refused",
102
+ ).toMatch(/^refused/u);
103
+ expect(
104
+ await bodyData(display, "item", "probe: write is refused"),
105
+ "probe: write is refused",
106
+ ).toMatch(/^refused/u);
107
+ expect(
108
+ await bodyData(display, "read", "probe: readText is refused"),
109
+ "probe: readText is refused",
110
+ ).toMatch(/^refused/u);
111
+ expect(await pasted(context.page), "probe: the clipboard still holds the person's own").toBe(
112
+ SEED,
113
+ );
99
114
  },
100
115
  },
101
116
  {
@@ -125,8 +140,13 @@ export const CLIPBOARD_PROBES: readonly Probe[] = [
125
140
  });
126
141
  await seed(context.page, SEED);
127
142
  await click(display, "#go");
128
- expect(await bodyData(display, "copied")).not.toContain("true");
129
- expect(await pasted(context.page), "the clipboard still holds the person's own").toBe(SEED);
143
+ expect(
144
+ await bodyData(display, "copied", "probe: execCommand copied or cut"),
145
+ "probe: execCommand copied or cut",
146
+ ).not.toContain("true");
147
+ expect(await pasted(context.page), "probe: the clipboard still holds the person's own").toBe(
148
+ SEED,
149
+ );
130
150
  },
131
151
  },
132
152
  {
@@ -156,8 +176,14 @@ export const CLIPBOARD_PROBES: readonly Probe[] = [
156
176
  await context.page.keyboard.press("ControlOrMeta+C");
157
177
  await settle(200);
158
178
  // The positive control: the person's own copy works, and copies what they selected.
159
- expect((await pasted(context.page)).trim()).toBe("porthole-selected-text");
160
- expect(await frame.locator("body").getAttribute("data-ran")).toBeNull();
179
+ expect(
180
+ (await pasted(context.page)).trim(),
181
+ "probe: the clipboard holds what the person selected",
182
+ ).toBe("porthole-selected-text");
183
+ expect(
184
+ await frame.locator("body").getAttribute("data-ran"),
185
+ "probe: a copy listener of the content's ran",
186
+ ).toBeNull();
161
187
  },
162
188
  },
163
189
  {
@@ -176,12 +202,16 @@ export const CLIPBOARD_PROBES: readonly Probe[] = [
176
202
  copyText("copied on load").then(${settled("onload")});
177
203
  </script>`,
178
204
  });
179
- expect(await bodyData(display, "onload")).toMatch(/^refused/u);
205
+ expect(
206
+ await bodyData(display, "onload", "probe: copyText without a click is refused"),
207
+ "probe: copyText without a click is refused",
208
+ ).toMatch(/^refused/u);
180
209
  await click(display, "#copy");
181
210
  expect(await bodyData(display, "result")).toBe("true");
182
- expect(await display.calls()).toEqual([
183
- { capability: "copyText", args: { text: "npm test -- --run" } },
184
- ]);
211
+ expect(
212
+ await display.calls(),
213
+ "probe: only the click's whole text reached the host's handler",
214
+ ).toEqual([{ capability: "copyText", args: { text: "npm test -- --run" } }]);
185
215
  },
186
216
  },
187
217
  ];
@@ -24,18 +24,44 @@ async function recorded(
24
24
  timeoutMs = 10_000,
25
25
  ): Promise<Record<string, unknown>> {
26
26
  const frame = await display.frame();
27
- await expect
28
- .poll(
29
- () =>
30
- frame
31
- .evaluate(() => (window as unknown as { r?: { done?: boolean } }).r?.done === true)
32
- .catch(() => false),
33
- { timeout: timeoutMs },
34
- )
35
- .toBe(true);
27
+ // Each look is bounded: a frame a dialog holds (a print dialog, where the sandbox lets one open)
28
+ // answers no evaluation, and the probe fails by its assertion, not a test timeout (P096).
29
+ const done = (): Promise<boolean> =>
30
+ Promise.race([
31
+ frame
32
+ .evaluate(() => (window as unknown as { r?: { done?: boolean } }).r?.done === true)
33
+ .catch(() => false),
34
+ new Promise<boolean>((resolve) => setTimeout(() => resolve(false), 1_000)),
35
+ ]);
36
+ await expect.poll(done, { timeout: timeoutMs }).toBe(true);
36
37
  return frame.evaluate(() => (window as unknown as { r: Record<string, unknown> }).r);
37
38
  }
38
39
 
40
+ /**
41
+ * What the content recorded, or, where its document went before it could say, that as the probe's
42
+ * verdict (P096): started again (navigated away), or written over by `document.write` once the
43
+ * shell's lock is gone (its own element `own` gone): the escape itself, not a probe that failed to
44
+ * start.
45
+ */
46
+ async function replacedOrRecorded(
47
+ display: LaunchedDisplay,
48
+ own: string,
49
+ ): Promise<Record<string, unknown>> {
50
+ try {
51
+ return await recorded(display);
52
+ } catch (error) {
53
+ const restarts = (await display.events()).filter((event) => event.type === "navigated");
54
+ expect(restarts, "probe: the content's document was replaced before it reported").toEqual([]);
55
+ const frame = await display.frame().catch(() => undefined);
56
+ const kept = await frame
57
+ ?.locator(own)
58
+ .count()
59
+ .catch(() => undefined);
60
+ expect(kept, "probe: the content's document was written over before it reported").not.toBe(0);
61
+ throw error;
62
+ }
63
+ }
64
+
39
65
  /** Counts what the page shows the person beyond the frame: dialogs, downloads, new windows. */
40
66
  function watch(page: Page): { dialogs: string[]; downloads: string[]; windows: string[] } {
41
67
  const seen = { dialogs: [] as string[], downloads: [] as string[], windows: [] as string[] };
@@ -73,7 +99,11 @@ export const LIMIT_PROBES: readonly Probe[] = [
73
99
  });
74
100
  const frame = await display.frame();
75
101
  await expect(frame.locator("#bar")).toBeAttached();
76
- await expect.poll(async () => Math.round((await display.box()).height)).toBe(400);
102
+ await expect
103
+ .poll(async () => Math.round((await display.box()).height), {
104
+ message: "probe: the frame is its box's height",
105
+ })
106
+ .toBe(400);
77
107
  await frame.evaluate(() => window.scrollTo(0, 600));
78
108
  const seen = await frame.evaluate(() => ({
79
109
  scrolled: window.scrollY,
@@ -82,11 +112,16 @@ export const LIMIT_PROBES: readonly Probe[] = [
82
112
  (document.getElementById("bar") as HTMLElement).getBoundingClientRect().top,
83
113
  ),
84
114
  }));
85
- expect(seen).toEqual({ scrolled: 600, scrolls: true, barTop: 0 });
115
+ expect(seen, "probe: the page scrolls itself and position: fixed stays put").toEqual({
116
+ scrolled: 600,
117
+ scrolls: true,
118
+ barTop: 0,
119
+ });
86
120
  await settle(500);
87
- expect(Math.round((await display.box()).height), "it doesn't grow with its content").toBe(
88
- 400,
89
- );
121
+ expect(
122
+ Math.round((await display.box()).height),
123
+ "probe: it doesn't grow with its content",
124
+ ).toBe(400);
90
125
  },
91
126
  },
92
127
  {
@@ -115,13 +150,14 @@ export const LIMIT_PROBES: readonly Probe[] = [
115
150
  events: (window as unknown as { events: number }).events,
116
151
  prefers: matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light",
117
152
  }));
118
- expect(seen.theme).toBeNull();
119
- expect(seen.text).toBe(light["--color-text-primary"]);
120
- expect(seen.events).toBe(0);
153
+ expect(seen.theme, "probe: the page took a theme").toBeNull();
154
+ expect(seen.text, "probe: the page stays light").toBe(light["--color-text-primary"]);
155
+ expect(seen.events, "probe: the page heard a theme change").toBe(0);
121
156
  const element = await frame.frameElement();
122
- expect(await element.evaluate((node) => (node as HTMLElement).style.colorScheme)).toBe(
123
- "light",
124
- );
157
+ expect(
158
+ await element.evaluate((node) => (node as HTMLElement).style.colorScheme),
159
+ "probe: the frame element stays light",
160
+ ).toBe("light");
125
161
  context.measured(`prefers-color-scheme inside, the person on dark: ${seen.prefers}`);
126
162
  },
127
163
  },
@@ -137,16 +173,21 @@ export const LIMIT_PROBES: readonly Probe[] = [
137
173
  content: thrower,
138
174
  });
139
175
  await expect
140
- .poll(async () =>
141
- (await reported.errors()).some(
142
- (each) => each.includes("porthole-thrown") || each.includes("Script error"),
143
- ),
176
+ .poll(
177
+ async () =>
178
+ (await reported.errors()).some(
179
+ (each) => each.includes("porthole-thrown") || each.includes("Script error"),
180
+ ),
181
+ { message: "probe: what content threw reached the host" },
144
182
  )
145
183
  .toBe(true);
146
184
  const quiet = await context.launch({ config: inline({ errors: "none" }), content: thrower });
147
185
  await expect((await quiet.frame()).locator("p")).toHaveText("x");
148
186
  await settle(800);
149
- expect(await quiet.errors()).toEqual([]);
187
+ expect(
188
+ await quiet.errors(),
189
+ "probe: an error reached a host that didn't declare reportError",
190
+ ).toEqual([]);
150
191
  },
151
192
  },
152
193
  {
@@ -175,15 +216,21 @@ export const LIMIT_PROBES: readonly Probe[] = [
175
216
  await context.launch({ config: presets.mcpApp(), content: "", document: page }),
176
217
  ]) {
177
218
  await expect
178
- .poll(async () => (await display.errors()).includes("porthole-after"))
219
+ .poll(async () => (await display.errors()).includes("porthole-after"), {
220
+ message: "probe: every logged error reached the host",
221
+ })
179
222
  .toBe(true);
180
223
  const errors = await display.errors();
181
- expect(errors).toContain('{"name":"porthole-cycle","self":"[Circular]"}');
182
- expect(errors).toContain('{"big":"5n"}');
224
+ expect(errors, "probe: a cycle is reported as bounded text").toContain(
225
+ '{"name":"porthole-cycle","self":"[Circular]"}',
226
+ );
227
+ expect(errors, "probe: a BigInt is reported as text").toContain('{"big":"5n"}');
183
228
  const graph = errors.find((each) => each.startsWith('{"a":{"a":'));
184
- expect(graph, "the shared graph, reported").toBeDefined();
185
- expect(graph).toContain('"b":"[Repeated]"');
186
- expect(graph?.length).toBeLessThanOrEqual(2_000);
229
+ expect(graph, "probe: the shared graph, reported").toBeDefined();
230
+ expect(graph, "probe: a shared graph's repeats are cut").toContain('"b":"[Repeated]"');
231
+ expect(graph?.length, "probe: the shared graph's report is bounded").toBeLessThanOrEqual(
232
+ 2_000,
233
+ );
187
234
  }
188
235
  },
189
236
  },
@@ -210,19 +257,21 @@ export const LIMIT_PROBES: readonly Probe[] = [
210
257
  });
211
258
  const verdict = await context.result(display, 15_000);
212
259
  await settle();
213
- expect(verdict).toMatchObject({
260
+ expect(verdict, "probe: what the sandbox blocks fails quietly in the content").toMatchObject({
214
261
  fetch: "rejected TypeError",
215
262
  image: "failed",
216
263
  script: "undefined",
217
264
  after: "ran",
218
265
  });
219
- expect(canary.requests()).toEqual([]);
220
- expect(seen.dialogs).toEqual([]);
266
+ expect(canary.requests(), "probe: nothing reached the canary").toEqual([]);
267
+ expect(seen.dialogs, "probe: a dialog was shown").toEqual([]);
221
268
  // Where reportError is declared, each block is reported to the host (the manual says where
222
269
  // it goes, by \`errors\`, #4); where it isn't, nothing is.
223
270
  await expect
224
- .poll(async () =>
225
- (await display.errors()).some((each) => each.startsWith("Blocked by the sandbox:")),
271
+ .poll(
272
+ async () =>
273
+ (await display.errors()).some((each) => each.startsWith("Blocked by the sandbox:")),
274
+ { message: "probe: the host heard of each block where reportError is declared" },
226
275
  )
227
276
  .toBe(true);
228
277
  const quiet = await context.launch({
@@ -233,11 +282,17 @@ export const LIMIT_PROBES: readonly Probe[] = [
233
282
  `<img src="${c}/quiet.png">`,
234
283
  ),
235
284
  });
236
- expect(await context.result(quiet, 15_000)).toMatchObject({ fetch: "rejected TypeError" });
285
+ expect(
286
+ await context.result(quiet, 15_000),
287
+ "probe: the fetch rejects where reportError isn't declared",
288
+ ).toMatchObject({ fetch: "rejected TypeError" });
237
289
  await settle();
238
- expect(await quiet.errors()).toEqual([]);
239
- expect(canary.requests()).toEqual([]);
240
- expect(seen.dialogs).toEqual([]);
290
+ expect(
291
+ await quiet.errors(),
292
+ "probe: a block reached a host that didn't declare reportError",
293
+ ).toEqual([]);
294
+ expect(canary.requests(), "probe: nothing reached the canary").toEqual([]);
295
+ expect(seen.dialogs, "probe: a dialog was shown").toEqual([]);
241
296
  },
242
297
  },
243
298
  {
@@ -274,8 +329,11 @@ export const LIMIT_PROBES: readonly Probe[] = [
274
329
  "the page's own CSP, which an opaque frame inherits, blocks data: images or inline styles (img-src, style-src): opaque content here can't inline its assets, whatever its config",
275
330
  );
276
331
  }
277
- expect(verdict).toMatchObject({ inline: "loaded", styled: "37px" });
278
- expect(canary.requests()).toEqual([]);
332
+ expect(verdict, "probe: inline data: images and <style> CSS work").toMatchObject({
333
+ inline: "loaded",
334
+ styled: "37px",
335
+ });
336
+ expect(canary.requests(), "probe: nothing reached the canary").toEqual([]);
279
337
  },
280
338
  },
281
339
  {
@@ -299,9 +357,13 @@ export const LIMIT_PROBES: readonly Probe[] = [
299
357
  });
300
358
  await click(display, "#go");
301
359
  const verdict = await recorded(display);
302
- expect(verdict).toMatchObject({ alert: "undefined", confirm: "false", prompt: "null" });
303
- expect(verdict.ms as number).toBeLessThan(1_000);
304
- expect(seen.dialogs).toEqual([]);
360
+ expect(verdict, "probe: alert, confirm and prompt return without asking").toMatchObject({
361
+ alert: "undefined",
362
+ confirm: "false",
363
+ prompt: "null",
364
+ });
365
+ expect(verdict.ms as number, "probe: a dialog held the content").toBeLessThan(1_000);
366
+ expect(seen.dialogs, "probe: a dialog was shown").toEqual([]);
305
367
  },
306
368
  },
307
369
  {
@@ -321,12 +383,23 @@ export const LIMIT_PROBES: readonly Probe[] = [
321
383
  });
322
384
  </script>`,
323
385
  });
324
- await click(display, "#go");
386
+ // A print dialog holds the click that opened it, and the frame, where the sandbox lets one
387
+ // open (Firefox with allow-modals): the click is bounded (15 s, so a slow click on a busy
388
+ // runner isn't taken for a held one), and a click still held is this probe's verdict
389
+ // failing, not a test timeout (P096).
390
+ const held = await Promise.race([
391
+ click(display, "#go").then(
392
+ () => false,
393
+ () => false,
394
+ ),
395
+ new Promise<boolean>((resolve) => setTimeout(() => resolve(true), 15_000)),
396
+ ]);
397
+ expect(held, "probe: print() opened a dialog that held the click").toBe(false);
325
398
  const verdict = await recorded(display);
326
- expect(verdict.print).toBe("undefined");
327
- expect(verdict.beforeprint).toBeUndefined();
328
- expect(verdict.afterprint).toBeUndefined();
329
- expect(seen.dialogs).toEqual([]);
399
+ expect(verdict.print, "probe: print() returns nothing").toBe("undefined");
400
+ expect(verdict.beforeprint, "probe: a print started").toBeUndefined();
401
+ expect(verdict.afterprint, "probe: a print finished").toBeUndefined();
402
+ expect(seen.dialogs, "probe: a dialog was shown").toEqual([]);
330
403
  },
331
404
  },
332
405
  {
@@ -349,7 +422,7 @@ export const LIMIT_PROBES: readonly Probe[] = [
349
422
  await click(display, selector);
350
423
  }
351
424
  await settle(1_000);
352
- expect(seen.downloads).toEqual([]);
425
+ expect(seen.downloads, "probe: a download started").toEqual([]);
353
426
  },
354
427
  },
355
428
  {
@@ -373,9 +446,9 @@ export const LIMIT_PROBES: readonly Probe[] = [
373
446
  r: (window as unknown as { r: Record<string, unknown> }).r,
374
447
  form: document.getElementById("form") !== null,
375
448
  }));
376
- expect(state.form, "the frame stayed on its content").toBe(true);
377
- expect(state.r.clicked).toBe(true);
378
- expect(canary.requests()).toEqual([]);
449
+ expect(state.form, "probe: the frame stayed on its content").toBe(true);
450
+ expect(state.r.clicked, "probe: a button's click handler runs").toBe(true);
451
+ expect(canary.requests(), "probe: the form submitted to the canary").toEqual([]);
379
452
  context.measured(`submit event fired: ${JSON.stringify(state.r.submitEvent ?? 0)} time(s)`);
380
453
  },
381
454
  },
@@ -393,9 +466,12 @@ export const LIMIT_PROBES: readonly Probe[] = [
393
466
  await click(display, selector);
394
467
  }
395
468
  await settle(800);
396
- await expect((await display.frame()).locator("#still")).toHaveText("still here");
397
- expect(seen.windows).toEqual([]);
398
- expect(await display.calls(), "nothing went to the host").toEqual([]);
469
+ await expect(
470
+ (await display.frame()).locator("#still"),
471
+ "probe: the frame stayed on its content",
472
+ ).toHaveText("still here");
473
+ expect(seen.windows, "probe: a window opened").toEqual([]);
474
+ expect(await display.calls(), "probe: nothing went to the host").toEqual([]);
399
475
  },
400
476
  },
401
477
  {
@@ -414,24 +490,26 @@ export const LIMIT_PROBES: readonly Probe[] = [
414
490
  const closed = await context.launch({ config: inline(), content });
415
491
  await click(closed, "#open");
416
492
  const verdict = await recorded(closed);
417
- expect(["null", "throws"]).toContain(verdict.open);
493
+ expect(["null", "throws"], "probe: window.open opened a window").toContain(verdict.open);
418
494
  context.measured(`window.open: ${String(verdict.open)}`);
419
495
  await click(closed, "#blank");
420
496
  await settle(800);
421
- expect(seen.windows).toEqual([]);
497
+ expect(seen.windows, "probe: a window opened").toEqual([]);
422
498
  // With openLink declared, the link asks the app instead (the person says no here).
423
499
  const linked = await context.launch({
424
500
  config: inline({ capabilities: { openLink: {} } }),
425
501
  content,
426
502
  });
427
503
  await click(linked, "#blank");
428
- const asked = await linked.answerNextConfirmation(false);
429
- expect(asked).toMatchObject({
504
+ const asked = await linked.answerNextConfirmation(false).catch(() => undefined);
505
+ // A matcher on nothing says nothing of the message: none asked is said first (P096).
506
+ expect(asked, "probe: the link asked the app").toBeDefined();
507
+ expect(asked, "probe: the link asked the app").toMatchObject({
430
508
  capability: "openLink",
431
509
  args: { url: "https://example.com/report" },
432
510
  });
433
511
  await settle(500);
434
- expect(seen.windows).toEqual([]);
512
+ expect(seen.windows, "probe: a window opened after the person said no").toEqual([]);
435
513
  },
436
514
  },
437
515
  {
@@ -476,11 +554,13 @@ export const LIMIT_PROBES: readonly Probe[] = [
476
554
  buffer: Buffer.from("file text"),
477
555
  });
478
556
  const verdict = await recorded(display);
479
- expect(String(verdict.media)).toMatch(/^(rejected|absent)/u);
480
- expect(String(verdict.location)).toMatch(/^(denied 1|absent)$/u);
481
- expect(String(verdict.share)).toMatch(/^(rejected|absent)/u);
482
- expect(verdict.file).toBe("file text");
483
- expect(seen.dialogs).toEqual([]);
557
+ expect(String(verdict.media), "probe: camera and microphone are denied").toMatch(
558
+ /^(rejected|absent)/u,
559
+ );
560
+ expect(String(verdict.location), "probe: location is denied").toMatch(/^(denied 1|absent)$/u);
561
+ expect(String(verdict.share), "probe: sharing is denied").toMatch(/^(rejected|absent)/u);
562
+ expect(verdict.file, "probe: a chosen file can be read").toBe("file text");
563
+ expect(seen.dialogs, "probe: a dialog was shown").toEqual([]);
484
564
  context.measured(
485
565
  `camera/microphone: ${String(verdict.media)}; share: ${String(verdict.share)}`,
486
566
  );
@@ -509,9 +589,11 @@ export const LIMIT_PROBES: readonly Probe[] = [
509
589
  "the page's own CSP, which an opaque frame inherits, blocks blob: workers (worker-src falls back to its script-src): opaque content here gets no workers, whatever its config",
510
590
  );
511
591
  }
512
- expect(verdict.worker).toBe("answered 42");
513
- expect(String(verdict.serviceWorker)).toMatch(/^(absent|rejected|throws)/u);
514
- expect(verdict.rtc).toBe("undefined");
592
+ expect(verdict.worker, "probe: a blob: worker answers").toBe("answered 42");
593
+ expect(String(verdict.serviceWorker), "probe: a service worker was registered").toMatch(
594
+ /^(absent|rejected|throws)/u,
595
+ );
596
+ expect(verdict.rtc, "probe: WebRTC is there").toBe("undefined");
515
597
  context.measured(`service worker: ${String(verdict.serviceWorker)}`);
516
598
  },
517
599
  },
@@ -540,7 +622,7 @@ export const LIMIT_PROBES: readonly Probe[] = [
540
622
  "the page's own CSP, which an opaque frame inherits, blocks data: media (media-src): opaque content here plays no inline sound, whatever its config",
541
623
  );
542
624
  }
543
- expect(verdict.clicked, "play() in a click's handler").toBe("played");
625
+ expect(verdict.clicked, "probe: play() in a click's handler").toBe("played");
544
626
  context.measured(`play() without a click: ${String(verdict.unasked)}`);
545
627
  },
546
628
  },
@@ -556,7 +638,10 @@ export const LIMIT_PROBES: readonly Probe[] = [
556
638
  r.search = location.search;
557
639
  r.hash = location.hash;`),
558
640
  });
559
- expect(await context.result(display)).toMatchObject({
641
+ expect(
642
+ await context.result(display),
643
+ "probe: the address is about:srcdoc with no query or hash",
644
+ ).toMatchObject({
560
645
  href: "about:srcdoc",
561
646
  search: "",
562
647
  hash: "",
@@ -586,13 +671,18 @@ export const LIMIT_PROBES: readonly Probe[] = [
586
671
  </script>`,
587
672
  });
588
673
  await click(display, "#go");
589
- expect(await recorded(display)).toMatchObject({
674
+ expect(
675
+ await replacedOrRecorded(display, "#go"),
676
+ "probe: write and open throw, nested frames are removed, full screen is closed",
677
+ ).toMatchObject({
590
678
  write: "throws",
591
679
  open: "throws",
592
680
  frames: 0,
593
681
  fullscreen: "rejected",
594
682
  });
595
- expect(["rejected", "absent"]).toContain((await recorded(display)).clipboard);
683
+ expect(["rejected", "absent"], "probe: the clipboard was written").toContain(
684
+ (await recorded(display)).clipboard,
685
+ );
596
686
  },
597
687
  },
598
688
  {
@@ -607,12 +697,15 @@ export const LIMIT_PROBES: readonly Probe[] = [
607
697
  localStorage.setItem("porthole-limits", "first");
608
698
  r.read = localStorage.getItem("porthole-limits");`),
609
699
  });
610
- expect((await context.result(first)).read).toBe("first");
700
+ expect(
701
+ (await context.result(first)).read,
702
+ "probe: storage works while the frame is shown",
703
+ ).toBe("first");
611
704
  const second = await context.launch({
612
705
  config: inline(),
613
706
  content: attack(`r.read = String(localStorage.getItem("porthole-limits"));`),
614
707
  });
615
- expect((await context.result(second)).read, "another frame's storage").toBe("null");
708
+ expect((await context.result(second)).read, "probe: another frame's storage").toBe("null");
616
709
  },
617
710
  },
618
711
  ];