If frontend::CompileScript returns NULL because of OOM, Process() in js.cpp will continue merrily on its way and no one ever calls JS_ReportOutOfMemory(). Is it the responsibility of the JS API to call JS_ReportOutOfMemory() or the shell?
This is not as clear cut as a thought. Parts of the compiler that allocate things do call js_ReportOutOfMemory(). However, if you accidentally return NULL from the compiler with no error set, nothing gets spit out. It would be nice to have something fail when that happens. I'll try to devise a patch.
Created attachment 627012 [details] [diff] [review] complains when the compiler returns NULL and doesn't report an error
Comment on attachment 627012 [details] [diff] [review] complains when the compiler returns NULL and doesn't report an error >+JSBool gGotError = JS_FALSE; In new code, use C++ bool, false, and true. (unless you have to match a function signature, or matching is the nicest way to avoid stupid C++ warnings, but that's not an issue here) >+ if (!script) >+ JS_ASSERT(gGotError); JS_ASSERT_IF(!script, gGotError);
Created attachment 628437 [details] [diff] [review] address review comments
Created attachment 628439 [details] [diff] [review] use JS_ASSERT_IF