Subj : Re: AutoConfigProxy -> JSEng To : netscape.public.mozilla.jseng From : "Mark Warren" Date : Thu Apr 01 2004 12:59 pm You need to set *rval to either JSVAL_TRUE or JSVAL_FALSE to return a boolean value back to the script. Returning JS_TRUE/JS_FALSE from the function simply tells the JS engine whether to continue or abort execution. M- "Corail" wrote in message news:c4gf2q$29f1@ripley.netscape.com... > Hi, > > this is the code : > > /* Define a bunch of native functions first: */ > static JSBool mylocalHostOrDomainIs(JSContext *cx, JSObject *obj, uintN > argc, jsval *argv, jsval *rval) > { > JSBool bret = JS_FALSE; > if (argc != 2) > return bret; > > char *host=NULL, *hostdom=NULL; > > host = JS_GetStringBytes(JSVAL_TO_STRING(argv[0])); > hostdom = JS_GetStringBytes(JSVAL_TO_STRING(argv[1])); > > if (_tcschr(host, '.') == NULL) > bret = JS_TRUE; > > if ( _tcsnicmp(host, hostdom, _tcslen(host)) == 0) > bret = JS_TRUE; > > return bret; > } > > Corail131 > > "Brendan Eich" wrote in message > news:406B9E88.7040602@meer.net... > > Corail131 wrote: > > > > > I have add a function into my JSObject object named > > > mylocalHostOrDomainIs that is bind to ths javascript function > > > localHostOrDomainIs. > > > > > > Why the second IF doesn't run ??? > > > > Show your code for mylocalHostOrDomainIs and perhaps someone can help. > > Not showing code that anyone trying to diagnose the problem would need > > to read is not helpful. > > > > /be > > > > .