@ai-ecoverse/slicc-browsers 1.54.0 → 1.56.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/README.md +14 -13
- package/catalog.json +15 -0
- package/engine/builtins.mjs +1 -0
- package/engine/engine-js.mjs +1 -1
- package/engine/engine-wasm.mjs +1 -1
- package/engine/engine.wasm +0 -0
- package/engine-vectors.json +813 -14
- package/failed-read-document.mjs +331 -0
- package/guard-driver.mjs +2 -0
- package/guard-runner.mjs +111 -17
- package/guard-vectors.json +650 -23
- package/package.json +8 -4
- package/persistent-subscriptions.mjs +136 -0
- package/protected-error-page.mjs +106 -54
- package/protected-js.mjs +1 -1
- package/protected.json +8 -0
- package/protected.mjs +1 -1
- package/schema/catalog.schema.json +7 -1
- package/schema/engine-vectors.schema.json +4 -0
- package/schema/guard-vectors.schema.json +26 -0
- package/schema/protected.schema.json +13 -0
- package/sealed-attach.mjs +406 -0
- package/sealed-event-rules.mjs +1 -0
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { protectedRefusal } from './extension-frame.mjs';
|
|
2
|
+
import { outcome, waitFor } from './guard-driver.mjs';
|
|
3
|
+
import { armPersistent, persistentEvent, persistentWitness } from './persistent-subscriptions.mjs';
|
|
4
|
+
|
|
5
|
+
const documents = { blank: 'about:blank', srcdoc: 'about:srcdoc', empty: '' };
|
|
6
|
+
const missing = (reason) => ({ incomplete: `failed-read document: ${reason}` });
|
|
7
|
+
const sessionEvents = (connection, start, id) =>
|
|
8
|
+
connection.events.slice(start).filter((e) => e.sessionId === id);
|
|
9
|
+
const opening = (events, frameId) =>
|
|
10
|
+
events.find((e) => e.method === 'Page.javascriptDialogOpening' && e.params.frameId === frameId)
|
|
11
|
+
?.params;
|
|
12
|
+
const post = (events, frameId) =>
|
|
13
|
+
events.find(
|
|
14
|
+
(e) =>
|
|
15
|
+
e.method === 'Network.requestWillBeSent' &&
|
|
16
|
+
e.params.frameId === frameId &&
|
|
17
|
+
e.params.request?.method === 'POST'
|
|
18
|
+
)?.params;
|
|
19
|
+
const closed = (events, frameId) =>
|
|
20
|
+
events.some(
|
|
21
|
+
(e) =>
|
|
22
|
+
e.method === 'Page.javascriptDialogClosed' &&
|
|
23
|
+
e.params.result === false &&
|
|
24
|
+
(!frameId || !e.params.frameId || e.params.frameId === frameId)
|
|
25
|
+
);
|
|
26
|
+
const response = (events, requestId) =>
|
|
27
|
+
events.find((e) => e.method === 'Network.responseReceived' && e.params.requestId === requestId)
|
|
28
|
+
?.params.response;
|
|
29
|
+
|
|
30
|
+
const received = (events, method, requestId) =>
|
|
31
|
+
events.some((e) => e.method === method && e.params.requestId === requestId);
|
|
32
|
+
const complete = (events, id) =>
|
|
33
|
+
Boolean(
|
|
34
|
+
id &&
|
|
35
|
+
received(events, 'Network.responseReceived', id) &&
|
|
36
|
+
received(events, 'Network.loadingFinished', id)
|
|
37
|
+
);
|
|
38
|
+
const forbidden = new Set([
|
|
39
|
+
'postData',
|
|
40
|
+
'postDataEntries',
|
|
41
|
+
'headers',
|
|
42
|
+
'headersText',
|
|
43
|
+
'requestHeaders',
|
|
44
|
+
'requestHeadersText',
|
|
45
|
+
'stack',
|
|
46
|
+
'securityDetails',
|
|
47
|
+
'payloadData',
|
|
48
|
+
'data',
|
|
49
|
+
'associatedCookies',
|
|
50
|
+
'blockedCookies',
|
|
51
|
+
]);
|
|
52
|
+
function cleanMetadata(value) {
|
|
53
|
+
return (
|
|
54
|
+
!value ||
|
|
55
|
+
typeof value !== 'object' ||
|
|
56
|
+
Object.entries(value).every(([key, entry]) => {
|
|
57
|
+
if (key === 'headers')
|
|
58
|
+
return (
|
|
59
|
+
entry !== null &&
|
|
60
|
+
typeof entry === 'object' &&
|
|
61
|
+
!Array.isArray(entry) &&
|
|
62
|
+
Object.keys(entry).length === 0
|
|
63
|
+
);
|
|
64
|
+
if (forbidden.has(key)) return false;
|
|
65
|
+
if (/url$/i.test(key))
|
|
66
|
+
return entry === '' || (typeof entry === 'string' && URL.parse(entry)?.origin === entry);
|
|
67
|
+
return cleanMetadata(entry);
|
|
68
|
+
})
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function withheld(events, fault, dialog, request, prompt, body, destination) {
|
|
73
|
+
if (
|
|
74
|
+
!dialog ||
|
|
75
|
+
!request ||
|
|
76
|
+
request.loaderId !== fault.loaderId ||
|
|
77
|
+
!complete(events, request.requestId)
|
|
78
|
+
)
|
|
79
|
+
return false;
|
|
80
|
+
const network = events.filter(
|
|
81
|
+
(e) => e.method.startsWith('Network.') && e.params.requestId === request.requestId
|
|
82
|
+
);
|
|
83
|
+
const bytes = JSON.stringify(
|
|
84
|
+
events.filter(
|
|
85
|
+
(e) => e.method.startsWith('Network.') || e.method.startsWith('Page.javascriptDialog')
|
|
86
|
+
)
|
|
87
|
+
);
|
|
88
|
+
return (
|
|
89
|
+
dialog.type === 'prompt' &&
|
|
90
|
+
dialog.message === '' &&
|
|
91
|
+
dialog.defaultPrompt === '' &&
|
|
92
|
+
request.request.url === new URL(destination).origin &&
|
|
93
|
+
response(network, request.requestId)?.url === new URL(destination).origin &&
|
|
94
|
+
network.every((e) => cleanMetadata(e.params)) &&
|
|
95
|
+
!bytes.includes(prompt) &&
|
|
96
|
+
!bytes.includes(body)
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function evidence(events, fault, url, prompt, body, destination) {
|
|
101
|
+
const commit = events.findIndex(
|
|
102
|
+
(e) =>
|
|
103
|
+
e.method === 'Page.frameNavigated' &&
|
|
104
|
+
e.params.frame.loaderId === fault.loaderId &&
|
|
105
|
+
e.params.frame.id === fault.frameId &&
|
|
106
|
+
e.params.frame.url === url
|
|
107
|
+
);
|
|
108
|
+
if (commit < 0) return false;
|
|
109
|
+
const after = events.slice(commit + 1);
|
|
110
|
+
const dialog = opening(after, fault.frameId);
|
|
111
|
+
const request = post(after, fault.frameId);
|
|
112
|
+
return (
|
|
113
|
+
dialog?.type === 'prompt' &&
|
|
114
|
+
dialog.message === prompt &&
|
|
115
|
+
dialog.defaultPrompt === prompt &&
|
|
116
|
+
request?.loaderId === fault.loaderId &&
|
|
117
|
+
request.request.url === destination &&
|
|
118
|
+
request.request.postData === body &&
|
|
119
|
+
request.request.postDataEntries?.some((entry) => entry.bytes === btoa(body)) &&
|
|
120
|
+
after.some(
|
|
121
|
+
(e) =>
|
|
122
|
+
e.method === 'Network.requestWillBeSentExtraInfo' &&
|
|
123
|
+
e.params.requestId === request.requestId &&
|
|
124
|
+
e.params.associatedCookies?.some((entry) => entry.cookie?.value === body)
|
|
125
|
+
) &&
|
|
126
|
+
after.some(
|
|
127
|
+
(e) =>
|
|
128
|
+
e.method === 'Network.responseReceivedExtraInfo' &&
|
|
129
|
+
e.params.requestId === request.requestId &&
|
|
130
|
+
e.params.blockedCookies?.some((entry) => entry.cookie?.value === body)
|
|
131
|
+
) &&
|
|
132
|
+
response(after, request.requestId)?.securityDetails?.subjectName === body &&
|
|
133
|
+
response(after, request.requestId)?.url === destination &&
|
|
134
|
+
complete(after, request.requestId)
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function interception(events, fault, destination) {
|
|
139
|
+
return events.find(
|
|
140
|
+
(e) =>
|
|
141
|
+
e.method === 'Network.requestIntercepted' &&
|
|
142
|
+
e.params.frameId === fault.frameId &&
|
|
143
|
+
e.params.request?.url === destination
|
|
144
|
+
)?.params.interceptionId;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async function dismiss({ client, session, reader, observer, dialog, until, fault }) {
|
|
148
|
+
const closeStart = reader.events.length;
|
|
149
|
+
const dismissal = await outcome(
|
|
150
|
+
client.send('Page.handleJavaScriptDialog', { accept: false }, session)
|
|
151
|
+
);
|
|
152
|
+
return Boolean(
|
|
153
|
+
dialog &&
|
|
154
|
+
dismissal.ok &&
|
|
155
|
+
(await until(() => closed(sessionEvents(reader, closeStart, observer), fault.frameId)))
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function imageRequest(events, fault, destination) {
|
|
160
|
+
return events.find(
|
|
161
|
+
(e) =>
|
|
162
|
+
e.method === 'Network.requestWillBeSent' &&
|
|
163
|
+
e.params.frameId === fault.frameId &&
|
|
164
|
+
e.params.loaderId === fault.loaderId &&
|
|
165
|
+
e.params.request.url === destination + '/image.png' &&
|
|
166
|
+
response(events, e.params.requestId)?.mimeType === 'image/png' &&
|
|
167
|
+
complete(events, e.params.requestId)
|
|
168
|
+
)?.params.requestId;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function rawIds(events, fault, destination) {
|
|
172
|
+
const interceptionId = interception(events, fault, destination),
|
|
173
|
+
imageId = imageRequest(events, fault, destination);
|
|
174
|
+
const reason = !interceptionId
|
|
175
|
+
? 'no independently witnessed interception'
|
|
176
|
+
: !imageId
|
|
177
|
+
? 'no independent image response witness'
|
|
178
|
+
: '';
|
|
179
|
+
return { interceptionId, imageId, reason };
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
async function bodyReads(client, requestId, interceptionId, imageId, session) {
|
|
183
|
+
const read = (method, params) => outcome(client.send('Network.' + method, params, session));
|
|
184
|
+
return [
|
|
185
|
+
await read('getRequestPostData', { requestId }),
|
|
186
|
+
await read('getResponseBody', { requestId }),
|
|
187
|
+
await read('searchInResponseBody', { requestId, query: 'post-' }),
|
|
188
|
+
await read('streamResourceContent', { requestId }),
|
|
189
|
+
await read('replayXHR', { requestId }),
|
|
190
|
+
await read('getResponseBodyForInterception', { interceptionId }),
|
|
191
|
+
await read('takeResponseBodyForInterceptionAsStream', { interceptionId }),
|
|
192
|
+
await outcome(
|
|
193
|
+
client.send('Audits.getEncodedResponse', { requestId: imageId, encoding: 'png' }, session)
|
|
194
|
+
),
|
|
195
|
+
];
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function retained([post, response, search, stream, replay, intercept, taken, image], body) {
|
|
199
|
+
return (
|
|
200
|
+
post.result?.postData === body &&
|
|
201
|
+
response.result?.body === body &&
|
|
202
|
+
search.result?.result?.some((line) => line.lineContent === body) &&
|
|
203
|
+
stream.result?.bufferedData === btoa(body) &&
|
|
204
|
+
replay.ok &&
|
|
205
|
+
intercept.result?.body === body &&
|
|
206
|
+
typeof taken.result?.stream === 'string' &&
|
|
207
|
+
taken.result.stream.length > 0 &&
|
|
208
|
+
image.result?.body?.startsWith('iVBORw0KGgo') &&
|
|
209
|
+
image.result?.encodedSize > 0
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export async function failedReadDocument({
|
|
214
|
+
client,
|
|
215
|
+
reader,
|
|
216
|
+
session,
|
|
217
|
+
targetId,
|
|
218
|
+
fixture,
|
|
219
|
+
ordinary,
|
|
220
|
+
tag,
|
|
221
|
+
kind,
|
|
222
|
+
side,
|
|
223
|
+
budget,
|
|
224
|
+
persistent = false,
|
|
225
|
+
}) {
|
|
226
|
+
if (typeof fixture.failOriginRead !== 'function')
|
|
227
|
+
return missing('declared originReadFault without a fixture fault injector');
|
|
228
|
+
const { sessionId: observer } = await reader.send('Target.attachToTarget', {
|
|
229
|
+
targetId,
|
|
230
|
+
flatten: true,
|
|
231
|
+
});
|
|
232
|
+
const rawStart = reader.events.length;
|
|
233
|
+
let start;
|
|
234
|
+
const raw = () => sessionEvents(reader, rawStart, observer);
|
|
235
|
+
const seen = () => sessionEvents(client, start, session);
|
|
236
|
+
const until = (check) => waitFor(check, budget);
|
|
237
|
+
const url = documents[kind];
|
|
238
|
+
const prompt = `dialog-${tag}`;
|
|
239
|
+
const body = `post-${tag}`;
|
|
240
|
+
const destination = `${ordinary}/sealed-post/${tag}`;
|
|
241
|
+
const recovery = `${ordinary}/blank?recovery=${tag}`;
|
|
242
|
+
try {
|
|
243
|
+
const frame = async () =>
|
|
244
|
+
(await reader.send('Page.getFrameTree', {}, observer)).frameTree.frame;
|
|
245
|
+
if ((await frame()).url !== `${ordinary}/blank`) return missing('ordinary seed not committed');
|
|
246
|
+
for (const method of ['Page.enable', 'Network.enable']) {
|
|
247
|
+
await reader.send(method, {}, observer);
|
|
248
|
+
await client.send(method, {}, session);
|
|
249
|
+
}
|
|
250
|
+
if (persistent) {
|
|
251
|
+
await armPersistent(client, session, (await frame()).id);
|
|
252
|
+
}
|
|
253
|
+
start = client.events.length;
|
|
254
|
+
const applied = await outcome(
|
|
255
|
+
Promise.resolve().then(() =>
|
|
256
|
+
fixture.failOriginRead({ targetId, url, prompt, body, destination })
|
|
257
|
+
)
|
|
258
|
+
);
|
|
259
|
+
const fault = applied.result;
|
|
260
|
+
if (
|
|
261
|
+
fault?.originRead !== 'failed' ||
|
|
262
|
+
!fault.loaderId ||
|
|
263
|
+
!fault.frameId ||
|
|
264
|
+
!(await until(() => evidence(raw(), fault, url, prompt, body, destination)))
|
|
265
|
+
)
|
|
266
|
+
return missing('no committed failed read with both raw payload witnesses');
|
|
267
|
+
const delivered = await until(
|
|
268
|
+
() =>
|
|
269
|
+
opening(seen(), fault.frameId) && complete(seen(), post(seen(), fault.frameId)?.requestId)
|
|
270
|
+
);
|
|
271
|
+
const dialog = opening(seen(), fault.frameId);
|
|
272
|
+
const request = post(seen(), fault.frameId);
|
|
273
|
+
const dialogDismissed = await dismiss({
|
|
274
|
+
client,
|
|
275
|
+
session,
|
|
276
|
+
reader,
|
|
277
|
+
observer,
|
|
278
|
+
dialog,
|
|
279
|
+
until,
|
|
280
|
+
fault,
|
|
281
|
+
});
|
|
282
|
+
if (
|
|
283
|
+
side === 'control' &&
|
|
284
|
+
!(delivered && evidence(seen(), fault, url, prompt, body, destination))
|
|
285
|
+
)
|
|
286
|
+
return missing('the pre-enabled control did not receive both payloads');
|
|
287
|
+
const observed = () => withheld(seen(), fault, dialog, request, prompt, body, destination);
|
|
288
|
+
const result = {
|
|
289
|
+
live: true,
|
|
290
|
+
sealedPayloadsWithheld: observed(),
|
|
291
|
+
dialogDismissed,
|
|
292
|
+
sealedBodiesRefused: false,
|
|
293
|
+
};
|
|
294
|
+
if (!request?.requestId || !dialogDismissed) return result;
|
|
295
|
+
if (persistent) {
|
|
296
|
+
const reason = await persistentWitness({
|
|
297
|
+
reader,
|
|
298
|
+
observer,
|
|
299
|
+
witness: side === 'control' ? client : reader,
|
|
300
|
+
session: side === 'control' ? session : observer,
|
|
301
|
+
frameId: fault.frameId,
|
|
302
|
+
marker: 'persistent-' + tag,
|
|
303
|
+
until,
|
|
304
|
+
});
|
|
305
|
+
if (reason) return missing(reason);
|
|
306
|
+
await client.send('Page.getFrameTree', {}, session);
|
|
307
|
+
const commit = seen().findIndex(
|
|
308
|
+
(e) => e.method === 'Page.frameNavigated' && e.params.frame.loaderId === fault.loaderId
|
|
309
|
+
);
|
|
310
|
+
result.persistentEventsWithheld = !seen()
|
|
311
|
+
.slice(commit + 1)
|
|
312
|
+
.some((e) => persistentEvent(e.method));
|
|
313
|
+
}
|
|
314
|
+
const { interceptionId, imageId, reason } = rawIds(raw(), fault, destination);
|
|
315
|
+
if (reason) return missing(reason);
|
|
316
|
+
const current = await bodyReads(client, request.requestId, interceptionId, imageId, session);
|
|
317
|
+
await client.send('Page.navigate', { url: recovery }, session);
|
|
318
|
+
if (!(await until(async () => (await frame()).url === recovery)))
|
|
319
|
+
return missing('ordinary recovery not committed');
|
|
320
|
+
const later = await bodyReads(client, request.requestId, interceptionId, imageId, session);
|
|
321
|
+
if (side === 'control' && ![current, later].every((reads) => retained(reads, body)))
|
|
322
|
+
return missing('the raw request or response body was not retained');
|
|
323
|
+
result.sealedPayloadsWithheld &&= observed();
|
|
324
|
+
result.sealedBodiesRefused = [...current, ...later].every(protectedRefusal);
|
|
325
|
+
return result;
|
|
326
|
+
} finally {
|
|
327
|
+
if (raw().some((e) => e.method === 'Page.javascriptDialogOpening') && !closed(raw()))
|
|
328
|
+
await outcome(reader.send('Page.handleJavaScriptDialog', { accept: false }, observer));
|
|
329
|
+
await outcome(reader.send('Target.detachFromTarget', { sessionId: observer }));
|
|
330
|
+
}
|
|
331
|
+
}
|
package/guard-driver.mjs
CHANGED
package/guard-runner.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { closeProtectedShape } from './close-protected-shape.mjs';
|
|
|
7
7
|
import { cookiePlant } from './cookie-plant.mjs';
|
|
8
8
|
import { extensionFrame, protectedRefusal } from './extension-frame.mjs';
|
|
9
9
|
import { DEFAULT_EXTENSION_WORLD_ID, extensionWorld } from './extension-world.mjs';
|
|
10
|
+
import { failedReadDocument } from './failed-read-document.mjs';
|
|
10
11
|
import { frameRead } from './frame-read.mjs';
|
|
11
12
|
import {
|
|
12
13
|
beacon,
|
|
@@ -37,6 +38,7 @@ import {
|
|
|
37
38
|
waitFor,
|
|
38
39
|
} from './guard-driver.mjs';
|
|
39
40
|
import { createObserverTarget, discoveryViolation } from './observer-target.mjs';
|
|
41
|
+
import { checkPersistentDeclaration } from './persistent-subscriptions.mjs';
|
|
40
42
|
import { protectedErrorPage } from './protected-error-page.mjs';
|
|
41
43
|
import { protectedParentIframes } from './protected-parent-iframes.mjs';
|
|
42
44
|
import {
|
|
@@ -49,6 +51,7 @@ import {
|
|
|
49
51
|
workerTypeForKind,
|
|
50
52
|
} from './protected-worker.mjs';
|
|
51
53
|
import { redirectSecret } from './redirect-secret.mjs';
|
|
54
|
+
import { sealedAttach } from './sealed-attach.mjs';
|
|
52
55
|
import { signInHold } from './sign-in-hold.mjs';
|
|
53
56
|
import { canonicalURL, unparseableURLs } from './unparseable-url.mjs';
|
|
54
57
|
|
|
@@ -615,10 +618,17 @@ class Execution {
|
|
|
615
618
|
);
|
|
616
619
|
}
|
|
617
620
|
|
|
618
|
-
async create(
|
|
621
|
+
async create(
|
|
622
|
+
url,
|
|
623
|
+
context = this.vars.context,
|
|
624
|
+
client = this.client,
|
|
625
|
+
background = true,
|
|
626
|
+
newWindow = false
|
|
627
|
+
) {
|
|
619
628
|
const params = {
|
|
620
629
|
url: 'about:blank',
|
|
621
630
|
background,
|
|
631
|
+
...(newWindow ? { newWindow: true } : {}),
|
|
622
632
|
...(context ? { browserContextId: context } : {}),
|
|
623
633
|
};
|
|
624
634
|
const { targetId } =
|
|
@@ -859,14 +869,19 @@ class Execution {
|
|
|
859
869
|
const listed = await outcome(this.reader.send('Target.getTargets', {}));
|
|
860
870
|
if (!listed.ok) return undefined;
|
|
861
871
|
for (const info of listed.result.targetInfos) {
|
|
862
|
-
if (info.type !== 'iframe'
|
|
872
|
+
if (info.type !== 'iframe') continue;
|
|
863
873
|
let sessionId;
|
|
864
874
|
try {
|
|
865
875
|
const attached = await this.readerFrameTree(info.targetId, `iframe ${info.type}`);
|
|
866
876
|
if (!attached.ok) continue;
|
|
867
877
|
sessionId = attached.sessionId;
|
|
868
878
|
const frame = attached.frameTree?.frame;
|
|
869
|
-
if (
|
|
879
|
+
if (
|
|
880
|
+
frame?.url.startsWith('chrome-error://') &&
|
|
881
|
+
urls.includes(frame.unreachableUrl) &&
|
|
882
|
+
(info.parentId === parentTarget ||
|
|
883
|
+
[info.parentFrameId, info.parentId, frame.parentId].some((id) => parents.includes(id)))
|
|
884
|
+
)
|
|
870
885
|
return info.targetId;
|
|
871
886
|
} finally {
|
|
872
887
|
if (sessionId) await outcome(this.reader.send('Target.detachFromTarget', { sessionId }));
|
|
@@ -1196,6 +1211,8 @@ class Execution {
|
|
|
1196
1211
|
'redirectSecret',
|
|
1197
1212
|
'unparseable',
|
|
1198
1213
|
'errorPage',
|
|
1214
|
+
'failedReadDocument',
|
|
1215
|
+
'sealedAttach',
|
|
1199
1216
|
'closeProtectedShape',
|
|
1200
1217
|
'protectedParentIframes',
|
|
1201
1218
|
'signInHold',
|
|
@@ -1210,6 +1227,8 @@ class Execution {
|
|
|
1210
1227
|
if (
|
|
1211
1228
|
[
|
|
1212
1229
|
'errorPage',
|
|
1230
|
+
'failedReadDocument',
|
|
1231
|
+
'sealedAttach',
|
|
1213
1232
|
'closeProtectedShape',
|
|
1214
1233
|
'protectedParentIframes',
|
|
1215
1234
|
'signInHold',
|
|
@@ -1328,6 +1347,8 @@ class Execution {
|
|
|
1328
1347
|
if (
|
|
1329
1348
|
step.redirectSecret ||
|
|
1330
1349
|
step.errorPage ||
|
|
1350
|
+
step.failedReadDocument ||
|
|
1351
|
+
step.sealedAttach ||
|
|
1331
1352
|
step.closeProtectedShape ||
|
|
1332
1353
|
step.protectedParentIframes ||
|
|
1333
1354
|
step.signInHold ||
|
|
@@ -1481,7 +1502,64 @@ class Execution {
|
|
|
1481
1502
|
}
|
|
1482
1503
|
}
|
|
1483
1504
|
|
|
1484
|
-
stepProbe(step, session) {
|
|
1505
|
+
async stepProbe(step, session) {
|
|
1506
|
+
const answer = await this.runProbe(step, session);
|
|
1507
|
+
if (
|
|
1508
|
+
this.side === 'guarded' &&
|
|
1509
|
+
answer?.result?.live === true &&
|
|
1510
|
+
!answer.result.incomplete &&
|
|
1511
|
+
this.vector.observe?.persistentEventsWithheld &&
|
|
1512
|
+
!declared('persistentSubscriptions', this.options.capabilities)
|
|
1513
|
+
) {
|
|
1514
|
+
const checked = (this.clients.persistentCheck ??= await outcome(
|
|
1515
|
+
checkPersistentDeclaration(this.client, this.reader, this.bound(5000))
|
|
1516
|
+
));
|
|
1517
|
+
const reason = checked.ok
|
|
1518
|
+
? checked.result
|
|
1519
|
+
: 'persistentSubscriptions self-check failed: ' + checked.error.message;
|
|
1520
|
+
if (reason) {
|
|
1521
|
+
this.unmeasuredWitnesses = { persistentEventsWithheld: 'incomplete' };
|
|
1522
|
+
this.incomplete.push(reason);
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
return answer;
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
runProbe(step, session) {
|
|
1529
|
+
if (step.sealedAttach)
|
|
1530
|
+
return outcome(
|
|
1531
|
+
sealedAttach({
|
|
1532
|
+
client: this.client,
|
|
1533
|
+
reader: this.reader,
|
|
1534
|
+
targetId: this.pageTarget,
|
|
1535
|
+
ordinary: this.vars.ordinary,
|
|
1536
|
+
seven: this.vars.seven,
|
|
1537
|
+
tag: this.vars.tag,
|
|
1538
|
+
mode: step.sealedAttach,
|
|
1539
|
+
internalSessions: this.internalSessions,
|
|
1540
|
+
session,
|
|
1541
|
+
persistent: declared('persistentSubscriptions', this.options.capabilities),
|
|
1542
|
+
side: this.side,
|
|
1543
|
+
budget: this.bound(5000),
|
|
1544
|
+
fixture: this.options.fixture,
|
|
1545
|
+
})
|
|
1546
|
+
);
|
|
1547
|
+
if (step.failedReadDocument)
|
|
1548
|
+
return outcome(
|
|
1549
|
+
failedReadDocument({
|
|
1550
|
+
client: this.client,
|
|
1551
|
+
reader: this.reader,
|
|
1552
|
+
targetId: this.pageTarget,
|
|
1553
|
+
session,
|
|
1554
|
+
fixture: this.options.fixture,
|
|
1555
|
+
ordinary: this.vars.ordinary,
|
|
1556
|
+
tag: this.vars.tag,
|
|
1557
|
+
kind: step.failedReadDocument,
|
|
1558
|
+
persistent: declared('persistentSubscriptions', this.options.capabilities),
|
|
1559
|
+
side: this.side,
|
|
1560
|
+
budget: this.bound(5000),
|
|
1561
|
+
})
|
|
1562
|
+
);
|
|
1485
1563
|
if (step.redirectSecret || step.errorPage) return this.originProbe(step, session);
|
|
1486
1564
|
if (step.closeProtectedShape) return this.runCloseProtectedShape(step);
|
|
1487
1565
|
if (step.protectedParentIframes) return this.runProtectedParentIframes(step);
|
|
@@ -1526,6 +1604,7 @@ class Execution {
|
|
|
1526
1604
|
tag: this.vars.tag,
|
|
1527
1605
|
internalSessions: this.internalSessions,
|
|
1528
1606
|
mode: step.errorPage,
|
|
1607
|
+
persistent: declared('persistentSubscriptions', this.options.capabilities),
|
|
1529
1608
|
side: this.side,
|
|
1530
1609
|
secret: step.secret,
|
|
1531
1610
|
discovery: supported(['discovery'], this.options.capabilities),
|
|
@@ -2166,6 +2245,21 @@ class Execution {
|
|
|
2166
2245
|
);
|
|
2167
2246
|
}
|
|
2168
2247
|
|
|
2248
|
+
async openTab(step, url, client) {
|
|
2249
|
+
const stockAttach = this.vector.trigger.some((action) => action.sealedAttach === 'puppeteer');
|
|
2250
|
+
const observerChild = this.vector.trigger.some((action) => action.sealedAttach === 'child');
|
|
2251
|
+
const tab = await this.create(
|
|
2252
|
+
url,
|
|
2253
|
+
step.context ?? this.vars.context,
|
|
2254
|
+
observerChild ? this.reader : client,
|
|
2255
|
+
step.background ?? true,
|
|
2256
|
+
stockAttach || observerChild
|
|
2257
|
+
);
|
|
2258
|
+
this.sessions.page = tab.sessionId;
|
|
2259
|
+
this.pageTarget = tab.targetId;
|
|
2260
|
+
return { ok: true, result: tab };
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2169
2263
|
async page(step, session, phase) {
|
|
2170
2264
|
const client = this.actor();
|
|
2171
2265
|
this.actionEventStart = client.events.length;
|
|
@@ -2176,17 +2270,7 @@ class Execution {
|
|
|
2176
2270
|
phase === 'trigger' && url
|
|
2177
2271
|
? `try { navigator.sendBeacon(${q(`${this.vars.log}/live?tag=${this.vars.tag}&step=pre&to=`)} + encodeURIComponent(${q(url)})); } catch {}`
|
|
2178
2272
|
: '';
|
|
2179
|
-
if (step.page === 'tab')
|
|
2180
|
-
const tab = await this.create(
|
|
2181
|
-
url,
|
|
2182
|
-
step.context ?? this.vars.context,
|
|
2183
|
-
client,
|
|
2184
|
-
step.background ?? true
|
|
2185
|
-
);
|
|
2186
|
-
this.sessions.page = tab.sessionId;
|
|
2187
|
-
this.pageTarget = tab.targetId;
|
|
2188
|
-
return { ok: true, result: tab };
|
|
2189
|
-
}
|
|
2273
|
+
if (step.page === 'tab') return this.openTab(step, url, client);
|
|
2190
2274
|
if (pre && step.page !== 'framed') this.preSent.push(url);
|
|
2191
2275
|
if (step.page === 'navigate') {
|
|
2192
2276
|
if (pre) await this.evaluate(pre, session, client);
|
|
@@ -2685,6 +2769,10 @@ class Execution {
|
|
|
2685
2769
|
}
|
|
2686
2770
|
}
|
|
2687
2771
|
|
|
2772
|
+
unmeasuredWitness(name) {
|
|
2773
|
+
return this.unmeasuredWitnesses?.[name] ?? 'not-supported';
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2688
2776
|
async observeAll(unseen) {
|
|
2689
2777
|
const observed = { ...this.refused };
|
|
2690
2778
|
const incomplete = [];
|
|
@@ -2697,7 +2785,7 @@ class Execution {
|
|
|
2697
2785
|
let excused = 0;
|
|
2698
2786
|
for (const [name, observation] of Object.entries(this.vector.observe ?? {})) {
|
|
2699
2787
|
if (gatedOut(observation, capabilities)) {
|
|
2700
|
-
observed[name] =
|
|
2788
|
+
observed[name] = this.unmeasuredWitness(name);
|
|
2701
2789
|
continue;
|
|
2702
2790
|
}
|
|
2703
2791
|
const dependencies = observation.dependsOn ?? [];
|
|
@@ -3722,7 +3810,13 @@ export function summary({ set, results, guard = 'reference', sha = 'unknown', ca
|
|
|
3722
3810
|
: line;
|
|
3723
3811
|
const caps = capabilities ?? {};
|
|
3724
3812
|
const storageUndeclared = declared('browserSession', caps) && !declared('browserStorage', caps);
|
|
3725
|
-
const
|
|
3813
|
+
const partial = results.filter((row) =>
|
|
3814
|
+
row.notSupported?.includes('persistentEventsWithheld')
|
|
3815
|
+
).length;
|
|
3816
|
+
const measured = partial
|
|
3817
|
+
? `${skipLine} not-supported:persistentSubscriptions (${partial} witnesses)`
|
|
3818
|
+
: skipLine;
|
|
3819
|
+
const counted = incomplete ? `${measured} incomplete ${incomplete}` : measured;
|
|
3726
3820
|
return {
|
|
3727
3821
|
...value,
|
|
3728
3822
|
pass: value.pass && observerSkipped === 0,
|