mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
browser(firefox): rewrite network instrumentation (#2638)
This change introduces NetworkRequest object that encapsulates internal redirects as they happen in netwerk/ stack. NetworkRequest now serves as both ResponseBodyListener and NotificationCallbacks.
This commit is contained in:
parent
eac7dab8b7
commit
2fa32f7e9c
@ -1 +1 @@
|
|||||||
1113
|
1114
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -114,13 +114,13 @@ class NetworkHandler {
|
|||||||
this._httpActivity.delete(activity._id);
|
this._httpActivity.delete(activity._id);
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onRequest(httpChannel, eventDetails) {
|
async _onRequest(eventDetails, channelId) {
|
||||||
let pendingRequestCallback;
|
let pendingRequestCallback;
|
||||||
let pendingRequestPromise = new Promise(x => pendingRequestCallback = x);
|
let pendingRequestPromise = new Promise(x => pendingRequestCallback = x);
|
||||||
this._pendingRequstWillBeSentEvents.add(pendingRequestPromise);
|
this._pendingRequstWillBeSentEvents.add(pendingRequestPromise);
|
||||||
let details = null;
|
let details = null;
|
||||||
try {
|
try {
|
||||||
details = await this._contentPage.send('requestDetails', {channelId: httpChannel.channelId});
|
details = await this._contentPage.send('requestDetails', {channelId});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
pendingRequestCallback();
|
pendingRequestCallback();
|
||||||
this._pendingRequstWillBeSentEvents.delete(pendingRequestPromise);
|
this._pendingRequstWillBeSentEvents.delete(pendingRequestPromise);
|
||||||
@ -139,19 +139,19 @@ class NetworkHandler {
|
|||||||
this._pendingRequstWillBeSentEvents.delete(pendingRequestPromise);
|
this._pendingRequstWillBeSentEvents.delete(pendingRequestPromise);
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onResponse(httpChannel, eventDetails) {
|
async _onResponse(eventDetails) {
|
||||||
const activity = this._ensureHTTPActivity(eventDetails.requestId);
|
const activity = this._ensureHTTPActivity(eventDetails.requestId);
|
||||||
activity.response = eventDetails;
|
activity.response = eventDetails;
|
||||||
this._reportHTTPAcitivityEvents(activity);
|
this._reportHTTPAcitivityEvents(activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onRequestFinished(httpChannel, eventDetails) {
|
async _onRequestFinished(eventDetails) {
|
||||||
const activity = this._ensureHTTPActivity(eventDetails.requestId);
|
const activity = this._ensureHTTPActivity(eventDetails.requestId);
|
||||||
activity.complete = eventDetails;
|
activity.complete = eventDetails;
|
||||||
this._reportHTTPAcitivityEvents(activity);
|
this._reportHTTPAcitivityEvents(activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onRequestFailed(httpChannel, eventDetails) {
|
async _onRequestFailed(eventDetails) {
|
||||||
const activity = this._ensureHTTPActivity(eventDetails.requestId);
|
const activity = this._ensureHTTPActivity(eventDetails.requestId);
|
||||||
activity.failed = eventDetails;
|
activity.failed = eventDetails;
|
||||||
this._reportHTTPAcitivityEvents(activity);
|
this._reportHTTPAcitivityEvents(activity);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user