aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2014-09-29 09:57:27 -0600
committerbors-servo <metajack+bors@gmail.com>2014-09-29 09:57:27 -0600
commita58324f25b6f87d005026d8f9405c9f0d89a1f74 (patch)
treefa1e824fb3c4d27926bfab7921dc1498350635a8
parente70dcc3ae55c743bab2aa4b35cbfd8dcf11f799a (diff)
parente72b5613ee1c65233f85bac84371a822f8c2d30b (diff)
downloadservo-a58324f25b6f87d005026d8f9405c9f0d89a1f74.tar.gz
servo-a58324f25b6f87d005026d8f9405c9f0d89a1f74.zip
auto merge of #3522 : Ms2ger/servo/xhr-send-uaf, r=SimonSapin
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.
-rw-r--r--components/script/dom/xmlhttprequest.rs2
-rw-r--r--tests/wpt/metadata/XMLHttpRequest/formdata.htm.ini3
-rw-r--r--tests/wpt/metadata/XMLHttpRequest/send-content-type-charset.htm.ini3
-rw-r--r--tests/wpt/metadata/XMLHttpRequest/send-content-type-string.htm.ini5
4 files changed, 1 insertions, 12 deletions
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index 4f310a8948b..49a8b861338 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -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
diff --git a/tests/wpt/metadata/XMLHttpRequest/formdata.htm.ini b/tests/wpt/metadata/XMLHttpRequest/formdata.htm.ini
index 98cba460931..2e6dda5d74a 100644
--- a/tests/wpt/metadata/XMLHttpRequest/formdata.htm.ini
+++ b/tests/wpt/metadata/XMLHttpRequest/formdata.htm.ini
@@ -1,8 +1,5 @@
[formdata.htm]
type: testharness
- [empty formdata]
- expected: FAIL
-
[formdata with string]
expected: FAIL
diff --git a/tests/wpt/metadata/XMLHttpRequest/send-content-type-charset.htm.ini b/tests/wpt/metadata/XMLHttpRequest/send-content-type-charset.htm.ini
index b1169989752..49ac57c781e 100644
--- a/tests/wpt/metadata/XMLHttpRequest/send-content-type-charset.htm.ini
+++ b/tests/wpt/metadata/XMLHttpRequest/send-content-type-charset.htm.ini
@@ -15,6 +15,3 @@
[XMLHttpRequest: send() - charset parameter of Content-Type 6]
expected: FAIL
- [XMLHttpRequest: send() - charset parameter of Content-Type 7]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/XMLHttpRequest/send-content-type-string.htm.ini b/tests/wpt/metadata/XMLHttpRequest/send-content-type-string.htm.ini
deleted file mode 100644
index 5fe540a5412..00000000000
--- a/tests/wpt/metadata/XMLHttpRequest/send-content-type-string.htm.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[send-content-type-string.htm]
- type: testharness
- [XMLHttpRequest: send() - Content-Type]
- expected: FAIL
-