Index: jsapi.c =================================================================== RCS file: /cvsroot/mozilla/js/src/jsapi.c,v retrieving revision 3.47 diff -u -r3.47 jsapi.c --- jsapi.c 2000/03/15 14:29:43 3.47 +++ jsapi.c 2000/03/21 18:05:36 @@ -858,11 +858,6 @@ } #endif /* !JS_BUG_FALLIBLE_EQOPS */ -#if JS_HAS_EXPORT_IMPORT - /* XXX this might fail due to low memory */ - js_InitScanner(cx); -#endif /* JS_HAS_EXPORT_IMPORT */ - return oldVersion; } Index: jscntxt.h =================================================================== RCS file: /cvsroot/mozilla/js/src/jscntxt.h,v retrieving revision 3.17 diff -u -r3.17 jscntxt.h --- jscntxt.h 2000/03/12 05:09:42 3.17 +++ jscntxt.h 2000/03/21 18:05:36 @@ -233,6 +233,9 @@ jsval exception; /* most-recently-thrown exceptin */ uint32 options; /* see jsapi.h for JSOPTION_* */ + + /* Delay JS_SetVersion scanner effects until they're needed. */ + JSVersion scannerVersion; }; /* Slightly more readable macros, also to hide bitset implementation detail. */ Index: jsscan.c =================================================================== RCS file: /cvsroot/mozilla/js/src/jsscan.c,v retrieving revision 3.24 diff -u -r3.24 jsscan.c --- jsscan.c 2000/02/11 22:17:56 3.24 +++ jsscan.c 2000/03/21 18:05:36 @@ -216,6 +216,12 @@ size_t nb; JSTokenStream *ts; + if (cx->scannerVersion != cx->version) { + if (!js_InitScanner(cx)) + return NULL; + cx->scannerVersion = cx->version; + } + nb = sizeof(JSTokenStream) + JS_LINE_LIMIT * sizeof(jschar); JS_ARENA_ALLOCATE(ts, &cx->tempPool, nb); if (!ts) {