mirror of
https://github.com/morluto/rea.git
synced 2026-12-04 05:51:06 +00:00
refactor(browser): share network omission counting (#16535)
This commit is contained in:
1 parent
c15d9f2905
commit
2c9d4d728b
1 file changed
+8
-16
@@ -484,36 +484,28 @@ export class PlaywrightScenarioNetwork {
|
||||
private omitOmittedTransactionPhase(
|
||||
request: ScenarioNetworkRequest,
|
||||
kind: UnindexedNetworkEvent["kind"],
|
||||
phase: string = kind,
|
||||
): void {
|
||||
if (!this.omittedRequests.has(request)) return;
|
||||
if (!this.observeOmittedTransactionPhase(request, kind)) return;
|
||||
this.options.omitEvent(kind, "max-network-transactions");
|
||||
}
|
||||
|
||||
private observeOmittedTransactionPhase(
|
||||
request: ScenarioNetworkRequest,
|
||||
phase: string,
|
||||
): boolean {
|
||||
let observed = this.omittedPhases.get(request);
|
||||
if (observed === undefined) {
|
||||
observed = new Set();
|
||||
this.omittedPhases.set(request, observed);
|
||||
}
|
||||
if (observed.has(phase)) return false;
|
||||
if (observed.has(phase)) return;
|
||||
observed.add(phase);
|
||||
return true;
|
||||
this.options.omitEvent(kind, "max-network-transactions");
|
||||
}
|
||||
|
||||
private omitOmittedTransactionContent(
|
||||
request: ScenarioNetworkRequest,
|
||||
phase: "request" | "response",
|
||||
): void {
|
||||
if (!this.omittedRequests.has(request)) return;
|
||||
if (
|
||||
!this.observeOmittedTransactionPhase(request, `network-content:${phase}`)
|
||||
)
|
||||
return;
|
||||
this.options.omitEvent("network-content", "max-network-transactions");
|
||||
this.omitOmittedTransactionPhase(
|
||||
request,
|
||||
"network-content",
|
||||
`network-content:${phase}`,
|
||||
);
|
||||
}
|
||||
|
||||
private admitMetadata(
|
||||
|
||||
Reference in new issue
Block a user