Skip to content

Commit

Permalink
browser(firefox): respect Set-Cookie header from fulfilled request (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dgozman committed Feb 16, 2021
1 parent 9dd443e commit 822f7cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions browser_patches/firefox/BUILD_NUMBER
@@ -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
7 changes: 6 additions & 1 deletion browser_patches/firefox/juggler/NetworkObserver.js
Expand Up @@ -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;
Expand Down

0 comments on commit 822f7cb

Please sign in to comment.