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:
Dmitry Gozman 2020-06-20 20:45:01 -07:00 committed by GitHub
parent eac7dab8b7
commit 2fa32f7e9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 481 additions and 511 deletions

View File

@ -1 +1 @@
1113
1114

File diff suppressed because it is too large Load Diff

View File

@ -114,13 +114,13 @@ class NetworkHandler {
this._httpActivity.delete(activity._id);
}
async _onRequest(httpChannel, eventDetails) {
async _onRequest(eventDetails, channelId) {
let pendingRequestCallback;
let pendingRequestPromise = new Promise(x => pendingRequestCallback = x);
this._pendingRequstWillBeSentEvents.add(pendingRequestPromise);
let details = null;
try {
details = await this._contentPage.send('requestDetails', {channelId: httpChannel.channelId});
details = await this._contentPage.send('requestDetails', {channelId});
} catch (e) {
pendingRequestCallback();
this._pendingRequstWillBeSentEvents.delete(pendingRequestPromise);
@ -139,19 +139,19 @@ class NetworkHandler {
this._pendingRequstWillBeSentEvents.delete(pendingRequestPromise);
}
async _onResponse(httpChannel, eventDetails) {
async _onResponse(eventDetails) {
const activity = this._ensureHTTPActivity(eventDetails.requestId);
activity.response = eventDetails;
this._reportHTTPAcitivityEvents(activity);
}
async _onRequestFinished(httpChannel, eventDetails) {
async _onRequestFinished(eventDetails) {
const activity = this._ensureHTTPActivity(eventDetails.requestId);
activity.complete = eventDetails;
this._reportHTTPAcitivityEvents(activity);
}
async _onRequestFailed(httpChannel, eventDetails) {
async _onRequestFailed(eventDetails) {
const activity = this._ensureHTTPActivity(eventDetails.requestId);
activity.failed = eventDetails;
this._reportHTTPAcitivityEvents(activity);