edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [Edbrowse-dev] javaParseExecute incorrect use of variable
@ 2014-01-18 18:23 Chris Brannon
  2014-01-19 15:11 ` Adam Thompson
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Brannon @ 2014-01-18 18:23 UTC (permalink / raw)
  To: edbrowse-dev

This is mainly for Adam, so he can fix it in his jsdom.cpp.  I'll fix it
in jsdom.c on the master branch shortly.

Here's a fragment of the documentation for JS_EvaluateScript:

If a script compiles and executes successfully,
JS_EvaluateScript or JS_EvaluateUCScript stores the result in *rval,
if non-null, and returns JS_TRUE. Otherwise it returns JS_FALSE and the value
left in *rval is undefined. 

Here's what we do, from line 1089 of jsdom.c on master:

    ok = JS_EvaluateScript(jcx, this, str, strlen(str),
       filename, lineno, &rval);
    rc = eb_true;
    if(JSVAL_IS_BOOLEAN(rval))
	rc = JSVAL_TO_BOOLEAN(rval);

We never check "ok".  If "ok" is false, the contents of rval shouldn't
be used, since they are undefined.

-- Chris

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-19 15:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-18 18:23 [Edbrowse-dev] javaParseExecute incorrect use of variable Chris Brannon
2014-01-19 15:11 ` Adam Thompson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).