Closed Bug 1134325 Opened 5 years ago Closed 4 years ago

Set body of Request object used for onfetch event

Categories

(Core :: DOM: Workers, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla40
Tracking Status
firefox40 --- fixed

People

(Reporter: jdm, Assigned: ehsan)

References

Details

Attachments

(2 files)

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.
Duplicate of this bug: 1157187
Assignee: nobody → ehsan
Attachment #8601106 - Flags: review?(josh) → review+
Attachment #8601105 - Flags: review?(mcmanus) → review+
https://hg.mozilla.org/mozilla-central/rev/82f7c0c91407
https://hg.mozilla.org/mozilla-central/rev/70bd577548bf
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in before you can comment on or make changes to this bug.