Topic: NS_ERROR_ILLEGAL_VALUE error ?

I have updated my 0.5 beta3 to 0.5 RC2 but I receive this Error alert on every page:

uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.open]"  nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: http://devel.luke.local/javascripts/xaj … ax_core.js :: anonymous :: line 369"  data: no]

What kind of error it is ?

Re: NS_ERROR_ILLEGAL_VALUE error ?

This error appears sometimes since Firefox 3. I'm not sure if the code, FireBug or FireFox is causing this error. I've seen it sometimes on my website as well, but it's odd that it appears only when I scroll to the buttom or switch tabs. Can you perhaps post your code or provide an Url?

Re: NS_ERROR_ILLEGAL_VALUE error ?

Hi,

Having the same issue over here. I put the debugger on and it seems to show there are 4 attempts made before actually failing. The function just replaces the content of a DIV. After some research on google, it turns out that the call to the SetRequestHeaders might be misplaced and apparently should be done after the object is opened. From what I saw in the xajax_core.js, it is doing that alright... Let's hope this can be resolved soon smile

xajax debug output
Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

ERROR: Request: NS_ERROR_ILLEGAL_VALUE: Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.setRequestHeader]

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.setRequestHeader]

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

CALLING: 
xjxfun: pagination
extend: function (object) {
    return Object.extend.apply(this, [this, object]);
}
URI: 
/xajax.php

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

POST: xjxfun=pagination&extend=function (object) {
    return Object.extend.apply(this, [this, object]);
}
&xjxr=1231232225830
&xjxargs[]=Shotlist
&xjxargs[]=N1

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

PREPARING REQUEST

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.setRequestHeader]

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

CALLING: 
xjxfun: pagination
extend: function (object) {
    return Object.extend.apply(this, [this, object]);
}
URI: 
/xajax.php

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

POST: xjxfun=pagination&extend=function (object) {
    return Object.extend.apply(this, [this, object]);
}
&xjxr=1231232225830
&xjxargs[]=Shotlist
&xjxargs[]=N1

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

PREPARING REQUEST

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.setRequestHeader]

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

CALLING: 
xjxfun: pagination
extend: function (object) {
    return Object.extend.apply(this, [this, object]);
}
URI: 
/xajax.php

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

POST: xjxfun=pagination&extend=function (object) {
    return Object.extend.apply(this, [this, object]);
}
&xjxr=1231232225830
&xjxargs[]=Shotlist
&xjxargs[]=N1

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

PREPARING REQUEST

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.setRequestHeader]

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

CALLING: 
xjxfun: pagination
extend: function (object) {
    return Object.extend.apply(this, [this, object]);
}
URI: 
/xajax.php

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

POST: xjxfun=pagination&extend=function (object) {
    return Object.extend.apply(this, [this, object]);
}
&xjxr=1231232225830
&xjxargs[]=Shotlist
&xjxargs[]=N1

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

PREPARING REQUEST

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.setRequestHeader]

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

CALLING: 
xjxfun: pagination
extend: function (object) {
    return Object.extend.apply(this, [this, object]);
}
URI: 
/xajax.php

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

POST: xjxfun=pagination&extend=function (object) {
    return Object.extend.apply(this, [this, object]);
}
&xjxr=1231232225830
&xjxargs[]=Shotlist
&xjxargs[]=N1

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

INITIALIZING REQUEST OBJECT

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

PREPARING REQUEST

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

PROCESSING PARAMETERS [2]

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

INITIALIZING REQUEST

Tue Jan 06 2009 09:57:05 GMT+0100 (Romance Standard Time)

STARTING XAJAX REQUEST

Also found this on google groups:

...By the way, I found what causes the issue with
the help from somebody working in Mozilla codes. The Auth key we get
back from google contains an erroneous character at the end of the
string (0A) , which is invalid char and firefox doesn't like it.

I don't know whether it's simply a bug or meant to be. Replacing the
char (string.replace) may let you workaround the issue...

Hope that can help you guyz smile

aXe

Re: NS_ERROR_ILLEGAL_VALUE error ?

aXe, it looks like you'r passing a JS function as argument in xajax.request({}) ? If so, avoid it..otherwise it will always fail

Re: NS_ERROR_ILLEGAL_VALUE error ?

I don't think I am passing anything weird
<input type="button" onclick="xajax_pagination ('hotlist', 1); " value="press me" />

and the function is

function pagination ($pane, $page_num)
    {
        $objResponse = new xajaxResponse();

        $output_data = '<p align="center"><b style="color:red;">TEST</b></p>';
        $objResponse->assign ("test","innerHTML", $output_data);

        return $objResponse;
    }

6 (edited by sebas 2009-03-12 2:09:08 PM)

Re: NS_ERROR_ILLEGAL_VALUE error ?

This error occures usually when you are using other javascript libraries next to xajax.

it has to do with setHeaders and variables that are of the type 'function'

at line 3129 (xajax_core.js) in the last xajax release (5. final) there is the following line of code

this.request.setRequestHeader(optionName, headers[optionName]);

I was using xajax in a project that also used json2007 (http://code.google.com/p/reallysimplehistory/). This library extends several javascript objects.

xajax loops thru the variable 'headers'

for (var optionName in headers)

problem was that headers had a variable named 'toJSONString', toJSONString is a function added by json2007.

this.request.setRequestHeader(optionName, headers[optionName]);

will try to set an invalid value.. as stated above, a function.

xajax can fix this by changing that part of the code to

oRequest.setRequestHeaders = function(headers) {
  if ('object' == typeof headers) {
   for (var optionName in headers)
     if( typeof headers[optionName] != 'function' )
       this.request.setRequestHeader(optionName, headers[optionName]);
  }
}

I hope this gets added to the next release (or fixed in the current release).

Sebas

Re: NS_ERROR_ILLEGAL_VALUE error ?

Hi Sebas,

thanks for pointing that out. I'll have a look at it asap smile