WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
171552
[Fetch API] Response disturbed when trying to clone before consuming
https://bugs.webkit.org/show_bug.cgi?id=171552
Summary
[Fetch API] Response disturbed when trying to clone before consuming
Peleg Rosenthal
Reported
2017-05-02 09:05:31 PDT
In latest nightly (
r216067
), evaluation of `response.body` leads to the response being "disturbed" when trying to clone it despite `body.locked` and `bodyUsed` being false. Steps to reproduce: 1. open safari 2. go to
https://google.com
3. open devtools 4. run the following: fetch('/').then(r => { r.body; r.clone() }) What happens? "TypeError: Cannot clone a disturbed Response" is thrown. What's expected to happen? Both FF and Chrome clone the response correctly if it hasn't been consumed yet. JSBin here
http://jsbin.com/marogokuna/1/edit?js,output
Attachments
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2017-05-03 17:12:53 PDT
This works in shipping Safari/WebKit. I can reproduce the failure in nightly.
Radar WebKit Bug Importer
Comment 2
2017-05-03 17:13:11 PDT
<
rdar://problem/31977099
>
Peleg Rosenthal
Comment 3
2017-05-03 17:19:22 PDT
Thanks Alexey, I'm actually able to reproduce this also in Safari 10.1 (12603.1.30.0.34) The only difference is that I need to catch the rejection for it to surface: fetch('/').then(r => { r.body; r.clone() }).catch(console.log)
Alexey Proskuryakov
Comment 4
2017-05-03 20:38:50 PDT
Thank you for the correction!
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug