Set body of Request object used for onfetch event

RESOLVED FIXED in Firefox 40

Status

()

Core
DOM: Workers
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: jdm, Assigned: Ehsan)

Tracking

unspecified
mozilla40
x86
Mac OS X
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox40 fixed)

Details

Attachments

(2 attachments)

(Reporter)

Description

3 years ago
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...
(Reporter)

Updated

3 years ago
Blocks: 1059784
(Reporter)

Comment 1

3 years ago
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?
(Reporter)

Comment 2

3 years ago
The bit when we create the request object is http://mxr.mozilla.org/mozilla-central/source/dom/workers/ServiceWorkerManager.cpp#2246 in DispatchFetchEvent.
(Reporter)

Updated

3 years ago
Duplicate of this bug: 1157187
(Assignee)

Updated

3 years ago
Assignee: nobody → ehsan
(Assignee)

Comment 4

3 years ago
Created attachment 8601105 [details] [diff] [review]
Part 1: Add an API for cloning a channel's upload stream
Attachment #8601105 - Flags: review?(mcmanus)
(Assignee)

Comment 5

3 years ago
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)
(Reporter)

Updated

3 years ago
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
Last Resolved: 3 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.