There's currently a TODO comment in FetchEventRunnable::DispatchFetchEvent. It would be kind of sucky to always duplicate the request body for memory usage reasons...
Important bits: HttpBaseChannel::GetUploadStream will get an input stream for the request body. We'll probably need to rewind it after reading it, like http://mxr.mozilla.org/mozilla-central/source/netwerk/protocol/http/nsHttpChannel.cpp#6173 in DoAuthRetry. The easiest way to accomplish this bug is to just eagerly get the body, extract it to a string and create the Request object with the result. The better way to do it would be to add a lazy getter to the Request object that only extracts the stream as necessary, to avoid the performance and memory hit of duplicating it. I'd probably be fine with that as a followup?
The bit when we create the request object is http://mxr.mozilla.org/mozilla-central/source/dom/workers/ServiceWorkerManager.cpp#2246 in DispatchFetchEvent.
Created attachment 8601105 [details] [diff] [review] Part 1: Add an API for cloning a channel's upload stream
Attachment #8601105 - Flags: review?(mcmanus)
Created attachment 8601106 [details] [diff] [review] Part 2: Correctly reflect the Request's body to the service worker's fetch event
Attachment #8601106 - Flags: review?(josh)
Attachment #8601106 - Flags: review?(josh) → review+
Attachment #8601105 - Flags: review?(mcmanus) → review+
Status: NEW → RESOLVED
Last Resolved: 4 years ago
status-firefox40: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in before you can comment on or make changes to this bug.