Closed Bug 448300 Opened 16 years ago Closed 12 years ago

nsIXMLHttpRequest.send() returns NS_ERROR_XPC_NOT_ENOUGH_ARGS in Firefox 3

Categories

(Core :: DOM: Core & HTML, defect)

1.9.0 Branch
x86
Windows XP
defect
Not set
major

Tracking

()

RESOLVED WONTFIX

People

(Reporter: the_N_Channel, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1

The above site uses AHAH to communicate with a server and pull content to display in a textarea. The textarea's text is changed to sending, and then replaced with the contents of the server's execution at run time. It works completely in IE7, Firefox 2.0.0.16, and Opera 9.51 but it does not work in Firefox 3, hanging on "sending..."

I inspected the Error Console and found this: 
"Error: uncaught exception: [Exception... "Not enough arguments [nsIXMLHttpRequest.send]"  nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)"  location: "JS frame :: http://www.angelscamponline.com/KW-comp-tool/GA_Installer/scripts2.js :: ahah :: line 64"  data: no]"

reviewing my script, I see the following line:    

function ahah(url,target) 
{
	// native XMLHttpRequest object
	document.getElementById(target).innerHTML = 'sending...';
	if (window.XMLHttpRequest) {req = new XMLHttpRequest(); }
	else if (window.ActiveXObject) {req = new ActiveXObject("Microsoft.XMLHTTP");}

	if (req) 
	{
		req.onreadystatechange = function() {ahahDone(target);};
		req.open("GET", url, true);
		req.send();
	}
}

The exception is being thrown on the line for req.send(); I have successfully eliminated the error by changing that line to read req.send(null);, which can be seen here: http://www.angelscamponline.com/KW-comp-tool/GA_Installer/Index.html

The Mozilla Developer center documentation (http://developer.mozilla.org/en/docs/nsIXMLHttpRequest) says that the send method expects an in nsIVariant body, but it does not state that now the value does not default to null. This is breaking functionality that does not mimic behavior across other browsers and should either be documented or rectified immediately.    

Reproducible: Always

Steps to Reproduce:
1. Write AJAX using HttpRequest object send method with no parameters 
2.
3.
Actual Results:  
send method causes exception to be thrown

Expected Results:  
send method executes successfully
Component: General → XML
Product: Firefox → Core
QA Contact: general → xml
Version: unspecified → 1.9.0 Branch
Confirmed, changed bug title to include error code.

The problem described in this bug is a violation of the standard, defined at:

http://www.w3.org/TR/XMLHttpRequest/#send

'The send() method initiates the request and its optional argument provides the entity body.'

The argument is optional, so there can never be NOT_ENOUGH_ARGS.

Workaround: Supply a dummy argument.


Is this new in Firefox 3 like the reporter claims?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Undocumented revision to nsIXMLHttpRequest.send() method *breaks existing code* in Firefox 3 → nsIXMLHttpRequest.send() returns NS_ERROR_XPC_NOT_ENOUGH_ARGS in Firefox 3
There's no way we're going to fix this in Fx3.
Status: NEW → RESOLVED
Closed: 12 years ago
Component: XML → DOM: Mozilla Extensions
QA Contact: xml → general
Resolution: --- → WONTFIX
Component: DOM: Mozilla Extensions → DOM
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.