From 4cb3001fc6353ca941dd0c440d3e91979dacbe2b Mon Sep 17 00:00:00 2001 From: Carsten Sandtner Date: Wed, 15 May 2013 13:57:25 +0200 Subject: [PATCH] Fixed check for arguments at xhr.send() --- .../javascript/bindings/XMLHTTPRequest.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripting/javascript/bindings/XMLHTTPRequest.cpp b/scripting/javascript/bindings/XMLHTTPRequest.cpp index 6b3806d491..6640efc362 100644 --- a/scripting/javascript/bindings/XMLHTTPRequest.cpp +++ b/scripting/javascript/bindings/XMLHTTPRequest.cpp @@ -616,19 +616,19 @@ JS_BINDED_FUNC_IMPL(MinXmlHttpRequest, send) { JSString *str; + char *data; // Clean up header map. New request, new headers! http_header.clear(); - - if (!JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "S", &str)) { - return JS_FALSE; - }; - - if (meth.compare("post") == 0 || meth.compare("POST") == 0) { - - char *data = JS_EncodeString(cx, str); - cc_request->setRequestData(data, strlen(data)); + if (argc == 2) { + if (!JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "S", &str)) { + return JS_FALSE; + }; + data = JS_EncodeString(cx, str); + } + if (meth.compare("post") == 0 || meth.compare("POST") == 0) { + cc_request->setRequestData(data, strlen(data)); } _setHttpRequestHeader();