@ai-ecoverse/slicc-browsers 1.7.10 → 1.7.11
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 +1 -1
- package/guard-runner.mjs +14 -2
- package/guard-vectors.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -170,7 +170,7 @@ Any `cdp`, `page` or `children` step can take `requires`, the capabilities it ne
|
|
|
170
170
|
- `eval`: evaluate `expression`.
|
|
171
171
|
`hops` routes `url` through `/hop` on each `origin`, with its `code`.
|
|
172
172
|
- `{ "answer": { "url", "stage"?, "cdp"?, "params"?, "hold"? } }`: answer each paused request or auth challenge for `url` with that call; `hold` leaves it paused. Every other paused request continues unchanged.
|
|
173
|
-
- `{ "children": steps, "where"? }`: run these steps on each target auto-attached from then on, then resume it. `where` scopes them to the row's own target: `{ "openerId": "page" }` (opened by the row's page) or `{ "urlPrefix": url }`; other attached targets are resumed and otherwise left alone.
|
|
173
|
+
- `{ "children": steps, "where"? }`: run these steps on each target auto-attached from then on, then resume it. `where` scopes them to the row's own target: `{ "openerId": "page" }` (opened by the row's page) or `{ "urlPrefix": url }`; other attached targets are resumed and otherwise left alone. When a vector has a `children` step with `where`, a target that attaches before that step runs waits until it does, and is then matched against `where`. A target is only resumed when it attached waiting for the debugger, and a `browser_ui` target (Chrome's own UI, such as `chrome://omnibox-popup.top-chrome/`) is never adopted or sent anything.
|
|
174
174
|
- `{ "settle": { "beacon"?, "served"?, "title"?, "ms"?, "variant"?, "session"?, "dependsOn"?, "or"? } }`: wait for a beacon from `beacon`, for the fixture to log a request for the URL `served`, for the page `title`, or for the session to detach. When a refusal in `dependsOn` was recorded, the beacon can't come: a settle with `or` (a check) then waits until `or` holds, and one without it is skipped. Without such a refusal, `or` plays no part. Each beacon settle after an init script depends on that script's registration, and its `or` is what the row reads: the hops and the destination for the redirect chains, or the served page otherwise. It waits up to `ms` (10000 by default), then another 600 ms. `variant` waits the run's detach variant instead.
|
|
175
175
|
- `{ "wait": ms }`.
|
|
176
176
|
- `{ "paused": { "url", "ms" } }`: wait until the client has seen the pause that an `answer` rule for `url` matches (`Fetch.requestPaused` at the rule's stage, or `Fetch.authRequired` for a `Fetch.continueWithAuth` rule). It waits up to `ms`. On the control leg, a pause that never comes fails the row with `paused: no pause for <url> within <ms>ms`. On the guarded leg the guard may hide that pause, so the step waits the full `ms` and doesn't fail. The C5 guessed-id vectors and `C5.auth` use it before their second request, so the probe's interception id falls between the two ids the guess spans.
|
package/guard-runner.mjs
CHANGED
|
@@ -111,6 +111,10 @@ class Execution {
|
|
|
111
111
|
this.answers = [];
|
|
112
112
|
this.attachSettings = new Map();
|
|
113
113
|
this.childSteps = [];
|
|
114
|
+
this.deferred = [];
|
|
115
|
+
this.expectWhere = [...(vector.setup ?? []), ...(vector.trigger ?? [])].some(
|
|
116
|
+
(step) => step.children && step.where
|
|
117
|
+
);
|
|
114
118
|
this.childRuns = new Map();
|
|
115
119
|
this.named = new Map();
|
|
116
120
|
this.processed = new Set();
|
|
@@ -447,6 +451,11 @@ class Execution {
|
|
|
447
451
|
adopt(event) {
|
|
448
452
|
const info = event.params.targetInfo;
|
|
449
453
|
const child = event.params.sessionId;
|
|
454
|
+
if (info?.type === 'browser_ui') return;
|
|
455
|
+
if (this.expectWhere && !this.childWhere) {
|
|
456
|
+
this.deferred.push(event);
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
450
459
|
if (info?.browserContextId && this.vars.context && info.browserContextId !== this.vars.context)
|
|
451
460
|
return;
|
|
452
461
|
if (this.childWhere && !this.childMatches(info)) {
|
|
@@ -462,7 +471,8 @@ class Execution {
|
|
|
462
471
|
else {
|
|
463
472
|
await this.execute(this.childSteps.slice(0, reload), child);
|
|
464
473
|
const start = this.client.events.length;
|
|
465
|
-
|
|
474
|
+
if (event.params.waitingForDebugger)
|
|
475
|
+
await outcome(this.client.send('Runtime.runIfWaitingForDebugger', {}, child));
|
|
466
476
|
await this.poll(
|
|
467
477
|
() =>
|
|
468
478
|
this.client.events
|
|
@@ -473,7 +483,8 @@ class Execution {
|
|
|
473
483
|
await this.execute(this.childSteps.slice(reload), child);
|
|
474
484
|
}
|
|
475
485
|
const resumed = this.client.events.length;
|
|
476
|
-
|
|
486
|
+
if (event.params.waitingForDebugger)
|
|
487
|
+
await outcome(this.client.send('Runtime.runIfWaitingForDebugger', {}, child));
|
|
477
488
|
if (this.childSteps.some((step) => step.cdp === 'Page.enable'))
|
|
478
489
|
await this.poll(() => this.firstLoad(child, resumed), 5000);
|
|
479
490
|
})().catch((error) => this.errors.push(String(error.message ?? error)));
|
|
@@ -604,6 +615,7 @@ class Execution {
|
|
|
604
615
|
if (step.children) {
|
|
605
616
|
this.childSteps = step.children;
|
|
606
617
|
this.childWhere = step.where;
|
|
618
|
+
for (const event of this.deferred.splice(0)) this.adopt(event);
|
|
607
619
|
return;
|
|
608
620
|
}
|
|
609
621
|
if (step.answer) {
|
package/guard-vectors.json
CHANGED