browser(firefox): respect Set-Cookie header from fulfilled request (#5456)

This commit is contained in:
Dmitry Gozman 2021-02-15 22:49:57 -08:00 committed by GitHub
parent 9dd443e1aa
commit 822f7cb1eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -1,2 +1,2 @@
1229
Changed: lushnikov@chromium.org Thu 11 Feb 2021 08:20:05 AM PST
1230
Changed: dgozman@gmail.com Sat Feb 13 10:15:07 PST 2021

View File

@ -197,8 +197,13 @@ class NetworkRequest {
// Public interception API.
fulfill(status, statusText, headers, base64body) {
this._interceptedChannel.synthesizeStatus(status, statusText);
for (const header of headers)
for (const header of headers) {
this._interceptedChannel.synthesizeHeader(header.name, header.value);
if (header.name.toLowerCase() === 'set-cookie') {
Services.cookies.QueryInterface(Ci.nsICookieService);
Services.cookies.setCookieStringFromHttp(this.httpChannel.URI, header.value, this.httpChannel);
}
}
const synthesized = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(Ci.nsIStringInputStream);
const body = base64body ? atob(base64body) : '';
synthesized.data = body;