Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Unified Diff: LayoutTests/http/tests/local/formdata/send-form-data-with-bad-string.html

Issue 74133005: Remove several uses of toWebCoreStringWithNullCheck(v8::Handle<v8::Value>) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/local/formdata/send-form-data-with-bad-string.html
diff --git a/LayoutTests/http/tests/local/formdata/send-form-data-with-bad-string.html b/LayoutTests/http/tests/local/formdata/send-form-data-with-bad-string.html
new file mode 100644
index 0000000000000000000000000000000000000000..5ab287191f7d91dd5c35261e149f0760ed7c2319
--- /dev/null
+++ b/LayoutTests/http/tests/local/formdata/send-form-data-with-bad-string.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src="../../../../resources/js-test.js"></script>
+<script>
+description("Test that passing bad strings to FormData.append() throws and aborts properly.");
+
+var xhr = new XMLHttpRequest();
+xhr.open('POST', 'http://127.0.0.1:8000/xmlhttprequest/resources/post-echo.cgi', false);
+var badString = { toString: function() { throw "Exception in toString()"; } };
+
+var formData = new FormData();
+shouldThrow("formData.append(badString, 'test')", "'Exception in toString()'");
+shouldThrow("formData.append('textarea', badString)", "'Exception in toString()'");
+shouldThrow("formData.append('blob', new Blob(['']), badString)", "'Exception in toString()'");
+
+xhr.send(formData);
+if (xhr.readyState !== 4 || xhr.status !== 200) {
+ testFailed('xhr.readyState = ' + xhr.readyState + ', xhr.status = ' + xhr.status);
+ return;
+}
+
+shouldBe("xhr.response.indexOf('test')", "-1");
+shouldBe("xhr.response.indexOf('textarea')", "-1");
+shouldBe("xhr.response.indexOf('blob')", "-1");
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698