diff --git a/browser_patches/firefox-beta/BUILD_NUMBER b/browser_patches/firefox-beta/BUILD_NUMBER index 3a5b761627..0c00dc438f 100644 --- a/browser_patches/firefox-beta/BUILD_NUMBER +++ b/browser_patches/firefox-beta/BUILD_NUMBER @@ -1,2 +1,2 @@ -1347 -Changed: aslushnikov@gmail.com Sat Aug 13 14:56:35 MSK 2022 +1348 +Changed: yurys@chromium.org Mon Aug 22 16:59:01 PDT 2022 diff --git a/browser_patches/firefox-beta/juggler/NetworkObserver.js b/browser_patches/firefox-beta/juggler/NetworkObserver.js index 340f756f6c..f197959497 100644 --- a/browser_patches/firefox-beta/juggler/NetworkObserver.js +++ b/browser_patches/firefox-beta/juggler/NetworkObserver.js @@ -863,7 +863,7 @@ function setPostData(httpChannel, postData, headers) { const body = atob(postData); synthesized.setData(body, body.length); - const overriddenHeader = (lowerCaseName, defaultValue) => { + const overriddenHeader = (lowerCaseName) => { if (headers) { for (const header of headers) { if (header.name.toLowerCase() === lowerCaseName) { @@ -871,11 +871,22 @@ function setPostData(httpChannel, postData, headers) { } } } - return defaultValue; + return undefined; } // Clear content-length, so that upload stream resets it. httpChannel.setRequestHeader('content-length', '', false /* merge */); - httpChannel.explicitSetUploadStream(synthesized, overriddenHeader('content-type', 'application/octet-stream'), -1, httpChannel.requestMethod, false); + let contentType = overriddenHeader('content-type'); + if (contentType === undefined) { + try { + contentType = httpChannel.getRequestHeader('content-type'); + } catch (e) { + if (e.result == Cr.NS_ERROR_NOT_AVAILABLE) + contentType = 'application/octet-stream'; + else + throw e; + } + } + httpChannel.explicitSetUploadStream(synthesized, contentType, -1, httpChannel.requestMethod, false); } function convertString(s, source, dest) { diff --git a/browser_patches/firefox/BUILD_NUMBER b/browser_patches/firefox/BUILD_NUMBER index 167b11029d..f892b88a0f 100644 --- a/browser_patches/firefox/BUILD_NUMBER +++ b/browser_patches/firefox/BUILD_NUMBER @@ -1,2 +1,2 @@ -1345 -Changed: aslushnikov@gmail.com Sat Aug 13 14:45:35 MSK 2022 +1346 +Changed: yurys@chromium.org Mon Aug 22 16:56:24 PDT 2022 diff --git a/browser_patches/firefox/juggler/NetworkObserver.js b/browser_patches/firefox/juggler/NetworkObserver.js index 340f756f6c..f197959497 100644 --- a/browser_patches/firefox/juggler/NetworkObserver.js +++ b/browser_patches/firefox/juggler/NetworkObserver.js @@ -863,7 +863,7 @@ function setPostData(httpChannel, postData, headers) { const body = atob(postData); synthesized.setData(body, body.length); - const overriddenHeader = (lowerCaseName, defaultValue) => { + const overriddenHeader = (lowerCaseName) => { if (headers) { for (const header of headers) { if (header.name.toLowerCase() === lowerCaseName) { @@ -871,11 +871,22 @@ function setPostData(httpChannel, postData, headers) { } } } - return defaultValue; + return undefined; } // Clear content-length, so that upload stream resets it. httpChannel.setRequestHeader('content-length', '', false /* merge */); - httpChannel.explicitSetUploadStream(synthesized, overriddenHeader('content-type', 'application/octet-stream'), -1, httpChannel.requestMethod, false); + let contentType = overriddenHeader('content-type'); + if (contentType === undefined) { + try { + contentType = httpChannel.getRequestHeader('content-type'); + } catch (e) { + if (e.result == Cr.NS_ERROR_NOT_AVAILABLE) + contentType = 'application/octet-stream'; + else + throw e; + } + } + httpChannel.explicitSetUploadStream(synthesized, contentType, -1, httpChannel.requestMethod, false); } function convertString(s, source, dest) {