- From: Takeshi Yoshino <notifications@github.com>
- Date: Wed, 28 Jan 2015 21:24:55 -0800
- To: slightlyoff/ServiceWorker <ServiceWorker@noreply.github.com>
- Message-ID: <slightlyoff/ServiceWorker/issues/452/71971020@github.com>
Thanks, Yutaka, Domenic. The table (https://github.com/slightlyoff/ServiceWorker/issues/452#issuecomment-70795093) is already updated to reflect the agreement. ---- Now, all the columns (except for that `read()` is not allowed for a closed stream) are the same. After making a little fix on Yutaka's algorithm in https://github.com/slightlyoff/ServiceWorker/issues/452#issuecomment-71579896, either of the following algorithms should work: ## Lock + `body neutered flag` - a `Request` has a boolean `body neutered flag` - `req.bodyUsed` = (`req.body` is locked) || `req`'s `body neutered flag` is set - The following operations fail when `req.bodyUsed` is set. Otherwise, they acquire the lock of `req.body` and release it when done. - `req.arrayBuffer()` - `req.blob()` - `req.formData()` - `req.json()` - `req.text()` - `req.clone()` fail when `req.bodyUsed` is set. - The following operations fail when `req.bodyUsed` is set. Otherwise, set `req`'s `body neutered flag`, confiscate the underlying source and queue from `req.body` and error it. - `fetch(req)` - `new Request(req)` - `cache.put(req, res)` - a `Response` has a boolean `body neutered flag` - `res.bodyUsed` = (`res.body` is locked) || `res`'s `body neutered flag` is set - The following operations fail when `res.bodyUsed` is set. Otherwise, they acquire the lock of `res.body` and release it when done. - `res.arrayBuffer()` - `res.blob()` - `res.formData()` - `res.json()` - `res.text()` - `res.clone()` fail when `res.bodyUsed` is set. - The following operations fail when `res.bodyUsed` is set. Otherwise, set `res`'s `body neutered flag`, confiscate the underlying source and queue from `res.body` and error it. - `e.respondWith(res)` - `cache.put(req, res)` - a `Response`/`Request` with `body neutered flag` is unset but `.body` `"errored"` is considered to be one whose headers were received successfully but body wasn't - a `Response`/`Request` with `body neutered flag` set is considered to be invalid ## Permanent lock - `req.bodyUsed` = `req.body` is locked - The following operations fail when `req.bodyUsed` is set. Otherwise, they acquire the lock of `req.body` and release it when done. - `req.arrayBuffer()` - `req.blob()` - `req.formData()` - `req.json()` - `req.text()` - `req.clone()` fail when `req.bodyUsed` is set. - The following operations fail when `req.bodyUsed` is set. Otherwise, they acquire the lock of `req.body` and never release it. - `fetch(req)` - `new Request(req)` - `cache.put(req, res)` - `res.bodyUsed` = `res.body` is locked - The following operations fail when `res.bodyUsed` is set. Otherwise, they acquire the lock of `res.body` and release it when done. - `res.arrayBuffer()` - `res.blob()` - `res.formData()` - `res.json()` - `res.text()` - `res.clone()` fail when `res.bodyUsed` is set. - The following operations fail when `res.bodyUsed` is set. Otherwise, they acquire the lock of `res.body` and never release it. - `e.respondWith(res)` - `cache.put(req, res)` - Needs change on the Streams API spec to hold the lock of a stream even after draining it. --- Reply to this email directly or view it on GitHub: https://github.com/slightlyoff/ServiceWorker/issues/452#issuecomment-71971020
Received on Thursday, 29 January 2015 05:25:25 UTC