browser(firefox): fix extra HTTP headers in request interception (#11265)

This commit is contained in:
Andrey Lushnikov 2022-01-08 09:26:11 -07:00 коммит произвёл GitHub
Родитель 913edf9bdb
Коммит 5d8aa8d5cf
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 26 добавлений и 14 удалений

Просмотреть файл

@ -1,2 +1,2 @@
1313
Changed: lushnikov@chromium.org Wed 29 Dec 2021 09:04:48 PM PST
1314
Changed: lushnikov@chromium.org Sat Jan 8 18:49:01 MSK 2022

Просмотреть файл

@ -62,6 +62,13 @@ class PageNetwork {
this._extraHTTPHeaders = headers;
}
combinedExtraHTTPHeaders() {
return [
...(this._target.browserContext().extraHTTPHeaders || []),
...(this._extraHTTPHeaders || []),
];
}
enableRequestInterception() {
this._requestInterceptionEnabled = true;
}
@ -151,11 +158,8 @@ class NetworkRequest {
this._expectingResumedRequest = undefined; // { method, headers, postData }
this._sentOnResponse = false;
const pageNetwork = this._pageNetwork;
if (pageNetwork) {
appendExtraHTTPHeaders(httpChannel, pageNetwork._target.browserContext().extraHTTPHeaders);
appendExtraHTTPHeaders(httpChannel, pageNetwork._extraHTTPHeaders);
}
if (this._pageNetwork)
appendExtraHTTPHeaders(httpChannel, this._pageNetwork.combinedExtraHTTPHeaders());
this._responseBodyChunks = [];
@ -241,6 +245,8 @@ class NetworkRequest {
this.httpChannel.setRequestHeader(header.name, '', false /* merge */);
for (const header of headers)
this.httpChannel.setRequestHeader(header.name, header.value, false /* merge */);
} else if (this._pageNetwork) {
appendExtraHTTPHeaders(this.httpChannel, this._pageNetwork.combinedExtraHTTPHeaders());
}
if (method)
this.httpChannel.requestMethod = method;

Просмотреть файл

@ -1,2 +1,2 @@
1312
Changed: lushnikov@chromium.org Tue Dec 28 13:12:02 MST 2021
1313
Changed: lushnikov@chromium.org Sat Jan 8 18:49:01 MSK 2022

Просмотреть файл

@ -62,6 +62,13 @@ class PageNetwork {
this._extraHTTPHeaders = headers;
}
combinedExtraHTTPHeaders() {
return [
...(this._target.browserContext().extraHTTPHeaders || []),
...(this._extraHTTPHeaders || []),
];
}
enableRequestInterception() {
this._requestInterceptionEnabled = true;
}
@ -151,11 +158,8 @@ class NetworkRequest {
this._expectingResumedRequest = undefined; // { method, headers, postData }
this._sentOnResponse = false;
const pageNetwork = this._pageNetwork;
if (pageNetwork) {
appendExtraHTTPHeaders(httpChannel, pageNetwork._target.browserContext().extraHTTPHeaders);
appendExtraHTTPHeaders(httpChannel, pageNetwork._extraHTTPHeaders);
}
if (this._pageNetwork)
appendExtraHTTPHeaders(httpChannel, this._pageNetwork.combinedExtraHTTPHeaders());
this._responseBodyChunks = [];
@ -241,6 +245,8 @@ class NetworkRequest {
this.httpChannel.setRequestHeader(header.name, '', false /* merge */);
for (const header of headers)
this.httpChannel.setRequestHeader(header.name, header.value, false /* merge */);
} else if (this._pageNetwork) {
appendExtraHTTPHeaders(this.httpChannel, this._pageNetwork.combinedExtraHTTPHeaders());
}
if (method)
this.httpChannel.requestMethod = method;