Bug 419615 - "use JSVERSION_LATEST in xpcshell" (use a context callback to set error-reporter and jsversion default) [p=crowder@fiverocks.com (Brian Crowder) r+a1.9=shaver]

This commit is contained in:
reed%reedloden.com 2008-04-09 07:27:16 +00:00
Родитель 6baecaf85f
Коммит 28675b443b
2 изменённых файлов: 13 добавлений и 3 удалений

Просмотреть файл

@ -1289,6 +1289,16 @@ nsXPCFunctionThisTranslator::TranslateThis(nsISupports *aInitialThis,
#endif
JS_STATIC_DLL_CALLBACK(JSBool)
ContextCallback(JSContext *cx, uintN contextOp)
{
if (contextOp == JSCONTEXT_NEW) {
JS_SetErrorReporter(cx, my_ErrorReporter);
JS_SetVersion(cx, JSVERSION_LATEST);
}
return JS_TRUE;
}
int
main(int argc, char **argv, char **envp)
{
@ -1330,14 +1340,14 @@ main(int argc, char **argv, char **envp)
return 1;
}
JS_SetContextCallback(rt, ContextCallback);
cx = JS_NewContext(rt, 8192);
if (!cx) {
printf("JS_NewContext failed!\n");
return 1;
}
JS_SetErrorReporter(cx, my_ErrorReporter);
nsCOMPtr<nsIXPConnect> xpc = do_GetService(nsIXPConnect::GetCID());
if (!xpc) {
printf("failed to get nsXPConnect service!\n");

Просмотреть файл

@ -111,7 +111,7 @@ done
for t in $testdir/test_*.js
do
echo -n "$t: "
NATIVE_TOPSRCDIR="$native_topsrcdir" TOPSRCDIR="$topsrcdir" $xpcshell -v 180 -s $headfiles -f $t $tailfiles 2> $t.log 1>&2
NATIVE_TOPSRCDIR="$native_topsrcdir" TOPSRCDIR="$topsrcdir" $xpcshell -s $headfiles -f $t $tailfiles 2> $t.log 1>&2
rv="$?"
if [ ! "$rv" = "0" -o \
`grep -c '\*\*\* PASS' $t.log` = 0 ]