@botiverse/porthole 0.9.0 → 0.12.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.
- package/dist/annotate/types.d.ts +21 -7
- package/dist/annotate/validate.d.ts +18 -3
- package/dist/annotate/validate.js +29 -5
- package/dist/bridge/bridge.js +1 -51
- package/dist/bridge/unseen.d.ts +18 -0
- package/dist/bridge/unseen.js +71 -0
- package/dist/check/files.d.ts +2 -0
- package/dist/check/files.js +67 -50
- package/dist/check/lint.d.ts +8 -1
- package/dist/check/lint.js +18 -0
- package/dist/check/markup.d.ts +7 -0
- package/dist/check/markup.js +49 -0
- package/dist/check/page-source.js +1 -1
- package/dist/check/scroll.d.ts +100 -0
- package/dist/check/scroll.js +1429 -0
- package/dist/conformance/behavior.js +107 -68
- package/dist/conformance/clipboard.js +16 -14
- package/dist/conformance/harness-source.js +1 -1
- package/dist/conformance/limits.js +117 -64
- package/dist/conformance/probes.js +66 -49
- package/dist/conformance/runtime.js +6 -0
- package/dist/conformance/served.js +66 -63
- package/dist/guide/guide.js +1 -1
- package/dist/guide/runtime.js +2 -2
- package/dist/host/create-host.js +46 -4
- package/dist/index.d.ts +1 -1
- package/dist/platform/types.d.ts +4 -2
- package/dist/react/frame.d.ts +2 -1
- package/dist/runtime/requests.d.ts +5 -0
- package/dist/runtime/requests.js +16 -1
- package/dist/runtime/types.generated.js +1 -1
- package/dist/shell/annotate.d.ts +6 -3
- package/dist/shell/annotate.js +474 -104
- package/dist/shell/use.js +9 -1
- package/docs/ADOPTING.md +99 -1
- package/docs/ARCHITECTURE.md +2 -1
- package/docs/DECISIONS.md +764 -14
- package/docs/DESIGN.md +192 -42
- package/docs/THREAT_MODEL.md +109 -27
- package/package.json +1 -1
- package/src/annotate/types.ts +22 -7
- package/src/annotate/validate.ts +32 -6
- package/src/bridge/bridge.ts +1 -60
- package/src/bridge/unseen.ts +82 -0
- package/src/check/files.ts +68 -54
- package/src/check/lint.ts +24 -0
- package/src/check/markup.ts +53 -0
- package/src/check/scroll.ts +1757 -0
- package/src/conformance/behavior.ts +221 -69
- package/src/conformance/clipboard.ts +44 -14
- package/src/conformance/limits.ts +169 -76
- package/src/conformance/probes.ts +97 -49
- package/src/conformance/runtime.ts +9 -0
- package/src/conformance/served.ts +112 -63
- package/src/guide/guide.ts +1 -0
- package/src/guide/runtime.ts +2 -2
- package/src/host/create-host.ts +50 -4
- package/src/index.ts +1 -0
- package/src/platform/types.ts +4 -2
- package/src/react/frame.tsx +2 -1
- package/src/runtime/requests.ts +23 -1
- package/src/runtime/types.generated.ts +1 -1
- package/src/shell/annotate.ts +474 -104
- package/src/shell/use.ts +9 -1
- package/types/runtime/v1/comments.d.ts +14 -4
|
@@ -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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
|
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
|
|
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(
|
|
88
|
-
|
|
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(
|
|
123
|
-
|
|
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(
|
|
141
|
-
|
|
142
|
-
(
|
|
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(
|
|
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
|
|
182
|
-
|
|
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(
|
|
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(
|
|
225
|
-
|
|
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(
|
|
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(
|
|
239
|
-
|
|
240
|
-
|
|
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
|
|
278
|
-
|
|
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
|
|
303
|
-
|
|
304
|
-
|
|
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
|
-
|
|
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(
|
|
397
|
-
|
|
398
|
-
|
|
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
|
-
|
|
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(
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
expect(verdict.
|
|
483
|
-
expect(
|
|
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(
|
|
514
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
];
|