Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/bidiMapper/modules/network/NetworkRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ export class NetworkRequest {

#fetchId?: Protocol.Fetch.RequestId;

#finished = false;

/**
* Indicates the network intercept phase, if the request is currently blocked.
* Undefined necessarily implies that the request is not blocked.
Expand Down Expand Up @@ -473,7 +475,8 @@ export class NetworkRequest {
if (
Boolean(this.#response.info) &&
responseExtraInfoCompleted &&
responseInterceptionCompleted
responseInterceptionCompleted &&
this.#finished
) {
this.#emitEvent(this.#getResponseReceivedEvent.bind(this));
this.#networkStorage.disposeRequest(this.id);
Expand Down Expand Up @@ -523,6 +526,7 @@ export class NetworkRequest {
}

onLoadingFailedEvent(event: Protocol.Network.LoadingFailedEvent) {
this.#finished = true;
this.#emitEventsIfReady({
hasFailed: true,
});
Expand Down Expand Up @@ -1100,6 +1104,11 @@ export class NetworkRequest {
return 'other';
}
}

onLoadingFinished(): void {
this.#finished = true;
this.#emitEventsIfReady();
}
}

function getCdpBodyFromBiDiBytesValue(
Expand Down
9 changes: 9 additions & 0 deletions src/bidiMapper/modules/network/NetworkStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ export class NetworkStorage {
).onResponseReceivedExtraInfoEvent(params);
},
],
[
'Network.loadingFinished',
(params: Protocol.Network.LoadingFinishedEvent) => {
this.#getOrCreateNetworkRequest(
params.requestId,
cdpTarget,
).onLoadingFinished();
},
],
[
'Network.requestServedFromCache',
(params: Protocol.Network.RequestServedFromCacheEvent) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[network_events.py]
[test_event_order_with_redirect]
expected: FAIL
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[fetch_error.py]
expected: TIMEOUT
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,15 @@

[test_response_status[407-Proxy Authentication Required\]]
expected: FAIL

[test_redirect]
expected: FAIL

[test_redirect_document[http\]]
expected: FAIL

[test_redirect_document[https\]]
expected: FAIL

[test_redirect_document[https coop\]]
expected: FAIL
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[response_completed_cached.py]
[test_cached_redirect]
expected: FAIL
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[network_events.py]
[test_event_order_with_redirect]
expected: FAIL
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[fetch_error.py]
expected: TIMEOUT
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,15 @@

[test_response_status[407-Proxy Authentication Required\]]
expected: FAIL

[test_redirect]
expected: FAIL

[test_redirect_document[http\]]
expected: FAIL

[test_redirect_document[https\]]
expected: FAIL

[test_redirect_document[https coop\]]
expected: FAIL
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[response_completed_cached.py]
[test_cached_redirect]
expected: FAIL
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[fetch_error.py]
expected: TIMEOUT
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[response_completed.py]
expected: TIMEOUT
[test_response_status[101-Switching Protocols\]]
expected: FAIL

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[response_completed_cached.py]
[test_cached_redirect]
expected: FAIL
Loading