Don't move the data when extracting the bytes in XMLHttpRequest::Send.

The data is used later to set the Content-Type header. Current rustc
(4d2af3861) does not detect this use-after-move, but treats the later use as
if the data was None. It will, however, detect the bug in d2b30f7d3, which we
are upgrading to.
This commit is contained in:
Ms2ger 2014-09-29 17:52:41 +02:00
parent 760f28b551
commit e72b5613ee
4 changed files with 1 additions and 12 deletions

View file

@ -450,7 +450,7 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
Get | Head => None, // Step 3
_ => data
};
let extracted = data.map(|d| d.extract());
let extracted = data.as_ref().map(|d| d.extract());
self.request_body_len.set(extracted.as_ref().map(|e| e.len()).unwrap_or(0));
// Step 6