Description
XMLHttpRequest does not unwrap the FormData object when sending, causing the following error in Firefox:
NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED: JavaScript component does not have a method named: "available"'JavaScript component does not have a method named: "available"' when calling method: [nsIInputStream::available]
request.send(formData);
Example:
<script src="platform.js"></script>
<script>
function doIt() {
var request = new XMLHttpRequest();
request.open('POST', '//localhost:8000/handle');
request.send(new FormData());
}
</script>
<a href="javascript:doIt();">Click</a>
Removing the platform.js script tag or executing the following code fixes the issue:
var oldSend = XMLHttpRequest.prototype.send; XMLHttpRequest.prototype.send = function(arg) { oldSend.call(this, unwrap(arg)); };
Browser: Firefox 31.0, Mozilla Firefox for Ubuntu canonical - 1.0
Platform: 0.3.5
ShadowDOM: c4da63735ba6c00a7d6af5c1b118f84bd6a2e114