RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  j...@rpm5.org
  Module: rpm                              Date:   03-Jul-2017 10:06:01
  Branch: rpm-5_4                          Handle: 2017070308060100

  Modified files:           (Branch: rpm-5_4)
    rpm/rpmio               rpmjs45.cpp rpmjss.inp

  Log:
    - rpmjs45: EIP.

  Summary:
    Revision    Changes     Path
    1.1.2.18    +137 -145   rpm/rpmio/rpmjs45.cpp
    1.1.2.7     +8  -8      rpm/rpmio/rpmjss.inp
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmjs45.cpp
  ============================================================================
  $ cvs diff -u -r1.1.2.17 -r1.1.2.18 rpmjs45.cpp
  --- rpm/rpmio/rpmjs45.cpp     3 Jul 2017 04:08:54 -0000       1.1.2.17
  +++ rpm/rpmio/rpmjs45.cpp     3 Jul 2017 08:06:01 -0000       1.1.2.18
  @@ -19,16 +19,62 @@
   
   #include "jsapi.h"
   #include "jsprf.h"
  +#include "jsobj.h"
  +
  +#include "js/Debug.h"
  +#include "js/GCAPI.h"
   #include "js/Initialization.h"
  +#include "js/StructuredClone.h"
  +#include "js/TrackedOptimizationInfo.h"
  +
   #include "js/Conversions.h"
   #include "js/CharacterEncoding.h"
   
   #include "jsfriendapi.h"
   
   #include "jswrapper.h"
  +#include "shellmoduleloader.out.h"
  +
  +#include "builtin/ModuleObject.h"
  +#include "builtin/TestingFunctions.h"
  +
  +#include "frontend/Parser.h"
  +
  +#include "gc/GCInternals.h"
  +#include "gc/Statistics.h"
  +  
  +#include "jit/arm/Simulator-arm.h"
  +#include "jit/InlinableNatives.h"
  +#include "jit/Ion.h"
  +#include "jit/JitcodeMap.h"
  +#include "jit/OptimizationTracking.h"
  +
  +#include "perf/jsperf.h"
   
  +#include "shell/jsoptparse.h"
  +#ifdef       NOTYET
  +#include "shell/OSObject.h"
  +#endif
  +
  +#include "vm/ArgumentsObject.h"
  +#include "vm/Compression.h"
  +#include "vm/Debugger.h"
  +#include "vm/HelperThreads.h"
  +#include "vm/Monitor.h"
  +#include "vm/NativeObject.h"
  +#include "vm/Shape.h"
  +#include "vm/String.h"
   #include "vm/StringBuffer.h"
  +#include "vm/Time.h"
   #include "vm/TypedArrayObject.h"
  +#include "vm/WrapperObject.h"
  +
  +#include "jscompartmentinlines.h"
  +#include "jsobjinlines.h"
  +
  +#include "vm/ErrorObject-inl.h"
  +#include "vm/Interpreter-inl.h"
  +#include "vm/Stack-inl.h"
   
   using namespace JS;
   using namespace js;
  @@ -74,18 +120,6 @@
        (unsigned int) report->lineno, message);
   }
   
  -static void
  -rpmjssOOMCallback(JSContext* cx, void* data)
  -{
  -#ifdef       NOTYET
  -    // If a script is running, the engine is about to throw the string "out 
of
  -    // memory", which may or may not be caught. Otherwise the engine will 
just
  -    // unwind and return null/false, with no exception set.
  -    if (!JS_IsRunning(cx))
  -        GetShellRuntime(cx)->gotError = true;
  -#endif
  -}
  -
   enum JSShellErrNum {
   #define MSG_DEF(name, count, exception, format) \
       name,
  @@ -94,21 +128,8 @@
       JSShellErr_Limit
   };
   
  -static const JSErrorFormatString jsShell_ErrorFormatString[JSShellErr_Limit] 
= {
  -#define MSG_DEF(name, count, exception, format) \
  -    { format, count, JSEXN_ERR } ,
  -#include "jsshell.msg"
  -#undef MSG_DEF
  -};
  -
   const JSErrorFormatString*
  -my_GetErrorMessage(void* userRef, const unsigned errorNumber)
  -{
  -    if (errorNumber == 0 || errorNumber >= JSShellErr_Limit)
  -        return nullptr;
  -
  -    return &jsShell_ErrorFormatString[errorNumber];
  -}
  +my_GetErrorMessage(void* userRef, const unsigned errorNumber);
   
   /*==============================================================*/
   enum PathResolutionMode {    /* XXX shell/OSObject.h */
  @@ -513,7 +534,6 @@
       return true;
   }
   
  -#ifdef       NOTYET
   static bool
   ospath_join(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -557,18 +577,15 @@
       args.rval().setString(result);
       return true;
   }
  -#endif
   
   static const JSFunctionSpecWithHelp ospath_functions[] = {
       JS_FN_HELP("isAbsolute", ospath_isAbsolute, 1, 0,
   "isAbsolute(path)",
   "  Return whether the given path is absolute."),
   
  -#ifdef       NOTYET
       JS_FN_HELP("join", ospath_join, 1, 0,
   "join(paths...)",
   "  Join one or more path components in a platform independent way."),
  -#endif       /* NOTYET */
   
       JS_FS_HELP_END
   };
  @@ -1107,13 +1124,11 @@
       return sr;
   }
   
  -#ifdef       NOTYET
   static ShellRuntime*
   GetShellRuntime(JSContext* cx)
   {
       return GetShellRuntime(cx->runtime());
   }
  -#endif
   
   static char*
   GetLine(FILE* file, const char * prompt)
  @@ -1221,7 +1236,6 @@
       return data;
   }
   
  -#ifdef       NOTYET
   static bool
   ShellInterruptCallback(JSContext* cx)
   {
  @@ -1259,7 +1273,6 @@
   
       return result;
   }
  -#endif
   
   /*
    * Some UTF-8 files, notably those written using Notepad, have a Unicode
  @@ -1286,7 +1299,6 @@
           ungetc(ch1, file);
   }
   
  -#ifdef       NOTYET
   static void
   RunFile(JSContext* cx, const char* filename, FILE* file, bool compileOnly)
   {
  @@ -1338,19 +1350,19 @@
           }
   #ifdef  FIXME
           int64_t t2 = PRMJ_Now() - t1;
  +        if (printTiming)
  +            printf("runtime = %.3f ms\n", double(t2) / PRMJ_USEC_PER_MSEC);
   #else
           struct timeval tv;
           gettimeofday(&tv, NULL);
           int64_t t2 = 1000 * 1000 * tv.tv_sec + tv.tv_usec;
           t2 -= t1;
  -#endif
           if (printTiming)
  -            printf("runtime = %.3f ms\n", double(t2) / PRMJ_USEC_PER_MSEC);
  +            printf("runtime = %.3f ms\n", double(t2) / 1000.);
  +#endif
       }
   }
  -#endif
   
  -#ifdef  NOTYET
   static bool
   InitModuleLoader(JSContext* cx)
   {
  @@ -1377,7 +1389,6 @@
       RootedValue rv(cx);
       return Evaluate(cx, options, src, srcLen, &rv);
   }
  -#endif
   
   #ifdef       NOTYET
   static bool
  @@ -1400,7 +1411,6 @@
   }
   #endif
   
  -#ifdef       NOTYET
   static bool
   GetImportMethod(JSContext* cx, HandleObject loader, MutableHandleFunction 
resultOut)
   {
  @@ -1417,7 +1427,6 @@
       resultOut.set(&object->as<JSFunction>());
       return true;
   }
  -#endif
   
   #ifdef       NOTYET
   static void
  @@ -1875,7 +1884,7 @@
       return true;
   }
   
  -#ifdef       NOTYET
  +#ifndef      NOTYET
   class AutoNewContext
   {
     private:
  @@ -1920,7 +1929,6 @@
   };
   #endif
   
  -#ifdef       NOTYET
   static void
   my_LargeAllocFailCallback(void* data)
   {
  @@ -1937,7 +1945,6 @@
       AutoKeepAtoms keepAtoms(cx->perThreadData);
       rt->gc.gc(GC_NORMAL, JS::gcreason::SHARED_MEMORY_LIMIT);
   }
  -#endif
   
   static const uint32_t CacheEntry_SOURCE = 0;
   static const uint32_t CacheEntry_BYTECODE = 1;
  @@ -2392,7 +2399,7 @@
       if (!JS_ExecuteScript(cx, script))
           return false;
   
  -#ifdef       NOTYET
  +#ifdef       FIXME
       int64_t endClock = PRMJ_Now();
       args.rval().setDouble((endClock - startClock) / 
double(PRMJ_USEC_PER_MSEC));
   #else
  @@ -2587,17 +2594,13 @@
       return PrintInternal(cx, args, gErrFile);
   }
   
  -#ifdef       NOTYET
   static bool
   Help(JSContext* cx, unsigned argc, Value* vp);
  -#endif
   
   static bool
   Quit(JSContext* cx, unsigned argc, Value* vp)
   {
  -#ifdef       FIXME
       ShellRuntime* sr = GetShellRuntime(cx);
  -#endif
   
   #ifdef JS_MORE_DETERMINISTIC
       // Print a message to stderr in more-deterministic builds to help 
jsfunfuzz
  @@ -2620,14 +2623,12 @@
           return false;
       }
   
  -#ifdef       FIXME
       sr->exitCode = code;
       sr->quitting = true;
  -#endif
       return false;
   }
   
  -#ifdef  NOTYET
  +#ifndef  NOTYET
   static bool
   StartTimingMutator(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -2648,7 +2649,7 @@
   }
   #endif
   
  -#ifdef  NOTYET
  +#ifndef  NOTYET
   static bool
   StopTimingMutator(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -2726,7 +2727,6 @@
       return true;
   }
   
  -#ifdef  NOTYET
   static JSScript*
   ValueToScript(JSContext* cx, Value vArg, JSFunction** funp = nullptr)
   {
  @@ -2777,7 +2777,6 @@
   
       return script;
   }
  -#endif
   
   static JSScript*
   GetTopScript(JSContext* cx)
  @@ -2786,7 +2785,6 @@
       return iter.done() ? nullptr : iter.script();
   }
   
  -#ifdef  NOTYET
   static bool
   GetScriptAndPCArgs(JSContext* cx, unsigned argc, Value* argv, 
MutableHandleScript scriptp,
                      int32_t* ip)
  @@ -2817,9 +2815,7 @@
   
       return true;
   }
  -#endif
   
  -#ifdef  NOTYET
   static bool
   LineToPC(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -2849,9 +2845,7 @@
       args.rval().setInt32(script->pcToOffset(pc));
       return true;
   }
  -#endif
   
  -#ifdef  NOTYET
   static bool
   PCToLine(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -2868,7 +2862,6 @@
       args.rval().setInt32(lineno);
       return true;
   }
  -#endif
   
   #ifdef DEBUG
   
  @@ -3544,7 +3537,7 @@
       JS_GlobalObjectTraceHook
   };
   
  -#ifdef  NOTYET
  +#ifndef  NOTYET
   static JSObject*
   NewSandbox(JSContext* cx, bool lazy)
   {
  @@ -3571,7 +3564,7 @@
   }
   #endif
   
  -#ifdef  NOTYET
  +#ifndef  NOTYET
   static bool
   EvalInContext(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -3804,7 +3797,7 @@
       return int32_t(t1 - t2) < 0;
   }
   
  -#ifdef       NOTYET
  +#ifndef      NOTYET  /* XXX segfault */
   static bool
   Sleep_fn(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -3825,9 +3818,15 @@
               JS_ReportError(cx, "Excessive sleep interval");
               return false;
           }
  +#ifdef       FIXME
           t_ticks = (t_secs <= 0.0)
                     ? 0
                     : int64_t(PRMJ_USEC_PER_SEC * t_secs);
  +#else
  +        t_ticks = (t_secs <= 0.0)
  +                  ? 0
  +                  : int64_t(1000. * 1000. * t_secs);
  +#endif
       }
       PR_Lock(sr->watchdogLock);
   #ifdef  FIXME
  @@ -4009,7 +4008,6 @@
       }
   }
   
  -#ifdef       NOTYET
   static bool
   SetTimeoutValue(JSContext* cx, double t)
   {
  @@ -4025,7 +4023,6 @@
       }
       return true;
   }
  -#endif
   
   #ifdef  NOTYET
   static bool
  @@ -4062,7 +4059,6 @@
   }
   #endif
   
  -#ifdef       NOTYET
   static bool
   InterruptIf(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -4081,9 +4077,8 @@
       args.rval().setUndefined();
       return true;
   }
  -#endif
   
  -#ifdef  NOTYET
  +#ifndef  NOTYET
   static bool
   InvokeInterruptCallbackWrapper(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -4115,7 +4110,7 @@
   }
   #endif
   
  -#ifdef       NOTYET
  +#ifndef      NOTYET
   static bool
   SetInterruptCallback(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -4266,7 +4261,7 @@
       return false;
   }
   
  -#ifdef  NOTYET
  +#ifndef  NOTYET
   static bool
   Compile(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -4304,7 +4299,7 @@
   }
   #endif
   
  -#ifdef  NOTYET
  +#ifndef  NOTYET
   static bool
   ParseModule(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -4362,7 +4357,7 @@
   }
   #endif
   
  -#ifdef  NOTYET
  +#ifndef  NOTYET
   static bool
   SetModuleResolveHook(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -4387,7 +4382,6 @@
   }
   #endif
   
  -#ifdef       NOTYET
   static bool
   GetModuleLoadPath(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -4395,7 +4389,6 @@
       args.rval().setString(JS_NewStringCopyZ(cx, moduleLoadPath));
       return true;
   }
  -#endif
   
   #ifdef  NOTYET
   static bool
  @@ -4447,7 +4440,7 @@
   }
   #endif
   
  -#ifdef  NOTYET
  +#ifndef  NOTYET
   static bool
   SyntaxParse(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -4500,7 +4493,6 @@
   }
   #endif
   
  -#ifdef  NOTYET
   class OffThreadState {
     public:
       enum State {
  @@ -4576,21 +4568,15 @@
       void* token;
       char16_t* source;
   };
  -#endif
   
  -#ifdef  NOTYET
   static OffThreadState offThreadState;
  -#endif
   
  -#ifdef  NOTYET
   static void
   OffThreadCompileScriptCallback(void* token, void* callbackData)
   {
       offThreadState.markDone(token);
   }
  -#endif
   
  -#ifdef  NOTYET
   static bool
   OffThreadCompileScript(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -4680,7 +4666,6 @@
       args.rval().setUndefined();
       return true;
   }
  -#endif
   
   #ifdef  NOTYET
   static bool
  @@ -4939,7 +4924,6 @@
   }
   #endif
   
  -#ifdef       NOTYET
   static bool
   ThisFilename(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -4958,7 +4942,6 @@
       args.rval().setString(str);
       return true;
   }
  -#endif
   
   static bool
   WrapWithProto(JSContext* cx, unsigned argc, Value* vp)
  @@ -4986,7 +4969,7 @@
       return true;
   }
   
  -#ifdef       NOTYET
  +#ifndef      NOTYET
   static bool
   NewGlobal(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -5091,7 +5074,6 @@
       return true;
   }
   
  -#ifdef  NOTYET
   static bool
   GetSelfHostedValue(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -5108,9 +5090,7 @@
       RootedPropertyName srcName(cx, srcAtom->asPropertyName());
       return cx->runtime()->cloneSelfHostedValue(cx, srcName, args.rval());
   }
  -#endif
   
  -#ifdef       NOTYET
   class ShellSourceHook: public SourceHook {
       // The function we should call to lazily retrieve source code.
       PersistentRootedFunction fun;
  @@ -5145,9 +5125,7 @@
           return true;
       }
   };
  -#endif
   
  -#ifdef  NOTYET
   static bool
   WithSourceHook(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -5178,7 +5156,6 @@
       js::SetSourceHook(cx->runtime(), Move(savedHook));
       return result;
   }
  -#endif
   
   static bool
   IsCachingEnabled(JSContext* cx, unsigned argc, Value* vp)
  @@ -5192,12 +5169,10 @@
   SetCachingEnabled(JSContext* cx, unsigned argc, Value* vp)
   {
       CallArgs args = CallArgsFromVp(argc, vp);
  -#ifdef       FIXME
       if (GetShellRuntime(cx)->isWorker) {
           JS_ReportError(cx, "Caching is not supported in workers");
           return false;
       }
  -#endif
   
       jsCachingEnabled = ToBoolean(args.get(0));
       args.rval().setUndefined();
  @@ -5210,7 +5185,6 @@
       fprintf(stderr, "PROFILER EVENT: %s\n", msg);
   }
   
  -#ifdef       NOTYET
   static bool
   PrintProfilerEvents(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -5220,9 +5194,7 @@
       args.rval().setUndefined();
       return true;
   }
  -#endif
   
  -#ifdef       NOTYET
   #if defined(JS_SIMULATOR_ARM) || defined(JS_SIMULATOR_MIPS64)
   typedef Vector<char16_t, 0, SystemAllocPolicy> StackChars;
   Vector<StackChars, 0, SystemAllocPolicy> stacks;
  @@ -5272,9 +5244,7 @@
       }
   }
   #endif
  -#endif       /* NOTYET */
   
  -#ifdef       NOTYET
   static bool
   EnableSingleStepProfiling(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -5291,9 +5261,7 @@
       return false;
   #endif
   }
  -#endif
   
  -#ifdef       NOTYET
   static bool
   DisableSingleStepProfiling(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -5324,7 +5292,6 @@
       return false;
   #endif
   }
  -#endif
   
   static bool
   IsLatin1(JSContext* cx, unsigned argc, Value* vp)
  @@ -5362,7 +5329,6 @@
       return sharedArrayBufferMailboxLock != nullptr;
   }
   
  -#ifdef       NOTYET
   static void
   DestructSharedArrayBufferMailbox()
   {
  @@ -5371,9 +5337,8 @@
           sharedArrayBufferMailbox->dropReference();
       PR_DestroyLock(sharedArrayBufferMailboxLock);
   }
  -#endif
   
  -#ifdef  NOTYET
  +#ifdef       NOTYET
   static bool
   GetSharedArrayBuffer(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -5398,7 +5363,7 @@
   }
   #endif
   
  -#ifdef  NOTYET
  +#ifdef       NOTYET
   static bool
   SetSharedArrayBuffer(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -5646,7 +5611,6 @@
   #endif
   #endif       /* NOTYET */
   
  -#ifdef       NOTYET
   namespace js {
   namespace shell {
   
  @@ -5722,7 +5686,6 @@
   
   } // namespace shell
   } // namespace js
  -#endif
   
   #ifdef       NOTYET
   static bool
  @@ -5852,7 +5815,7 @@
   }
   #endif
   
  -static const JSFunctionSpec global_functions[] = {
  +static const JSFunctionSpec shell_functions[] = {
       JS_FN("version",                 Version,                        0,0),
       JS_FN("options",                 Options,                        0,0),
       JS_FN("load",                    Load,                           1,0),
  @@ -5899,13 +5862,17 @@
       JS_FN("compile",                 Compile,                        1,0),
       JS_FN("parseModule",             ParseModule,                    1,0),
       JS_FN("setModuleResolveHook",    SetModuleResolveHook,           1,0),
  +#endif       /* NOTYET */
       JS_FN("getModuleLoadPath",               GetModuleLoadPath,              
0,0),
  +#ifdef       NOTYET
       JS_FN("parse",                   Parse,                          1,0),
       JS_FN("syntaxParse",             SyntaxParse,                    1,0),
       JS_FN("offThreadCompileScript",  OffThreadCompileScript,         1,0),
       JS_FN("runOffThreadScript",              runOffThreadScript,             
0,0),
       JS_FN("timeout",                 Timeout,                        1,0),
  +#endif       /* NOTYET */
       JS_FN("interruptIf",             InterruptIf,                    1,0),
  +#ifdef       NOTYET
       JS_FN("invokeInterruptCallback", InvokeInterruptCallbackWrapper, 0,0),
       JS_FN("setInterruptCallback",    SetInterruptCallback,           1,0),
       JS_FN("enableLastWarning",               EnableLastWarning,              
0,0),
  @@ -5917,7 +5884,9 @@
   #ifdef       NOTYET
       JS_FN("decompileFunction",               DecompileFunction,              
1,0),
       JS_FN("decompileThis",           DecompileThisScript,            0,0),
  +#endif       /* NOTYET */
       JS_FN("thisFilename",            ThisFilename,                   0,0),
  +#ifdef       NOTYET
       JS_FN("newGlobal",                       NewGlobal,                      
1,0),
       JS_FN("nukeCCW",                 NukeCCW,                        1,0),
   #endif       /* NOTYET */
  @@ -5927,11 +5896,9 @@
       JS_FN("isCachingEnabled",                IsCachingEnabled,               
0,0),
       JS_FN("setCachingEnabled",               SetCachingEnabled,              
1,0),
       JS_FN("cacheEntry",                      CacheEntry,                     
1,0),
  -#ifdef       NOTYET
       JS_FN("printProfilerEvents",     PrintProfilerEvents,            0,0),
       JS_FN("enableSingleStepProfiling",       EnableSingleStepProfiling,      
0,0),
       JS_FN("disableSingleStepProfiling",      DisableSingleStepProfiling,     
0,0),
  -#endif       /* NOTYET */
       JS_FN("isLatin1",                        IsLatin1,                       
1,0),
       JS_FN("stackPointerInfo",                StackPointerInfo,               
0,0),
   #ifdef       NOTYET
  @@ -6381,7 +6348,7 @@
   #undef EXTERNAL_FUNCTION_COUNT
   #endif       /* NOTYET */
   
  -#ifdef       NOTYET
  +#ifndef      NOTYET
   static bool
   PrintHelpString(JSContext* cx, Value v)
   {
  @@ -6405,7 +6372,7 @@
   }
   #endif
   
  -#ifdef       NOTYET
  +#ifndef      NOTYET
   static bool
   PrintHelp(JSContext* cx, HandleObject obj)
   {
  @@ -6423,7 +6390,7 @@
   }
   #endif
   
  -#ifdef       NOTYET
  +#ifndef      NOTYET
   static bool
   Help(JSContext* cx, unsigned argc, Value* vp)
   {
  @@ -6467,27 +6434,22 @@
   }
   #endif
   
  -#ifdef       NOTYET
   static const JSErrorFormatString jsShell_ErrorFormatString[JSShellErr_Limit] 
= {
   #define MSG_DEF(name, count, exception, format) \
       { format, count, JSEXN_ERR } ,
   #include "jsshell.msg"
   #undef MSG_DEF
   };
  -#endif
   
  -#ifdef       NOTYET
   const JSErrorFormatString*
  -js::shell::my_GetErrorMessage(void* userRef, const unsigned errorNumber)
  +my_GetErrorMessage(void* userRef, const unsigned errorNumber)
   {
       if (errorNumber == 0 || errorNumber >= JSShellErr_Limit)
           return nullptr;
   
       return &jsShell_ErrorFormatString[errorNumber];
   }
  -#endif
   
  -#ifdef  NOTYET
   static bool
   CreateLastWarningObject(JSContext* cx, JSErrorReport* report)
   {
  @@ -6524,9 +6486,7 @@
       GetShellRuntime(cx)->lastWarning.setObject(*warningObj);
       return true;
   }
  -#endif
   
  -#ifdef       NOTYET
   static bool
   PrintStackTrace(JSContext* cx, HandleValue exn)
   {
  @@ -6562,8 +6522,57 @@
   
       return true;
   }
  +
  +#ifdef       FIXME
  +void
  +my_ErrorReporter(JSContext* cx, const char* message, JSErrorReport* report)
  +{
  +    ShellRuntime* sr = GetShellRuntime(cx);
  +
  +#ifdef  FIXME
  +    if (report && JSREPORT_IS_WARNING(report->flags) && 
sr->lastWarningEnabled) {
  +        JS::AutoSaveExceptionState savedExc(cx);
  +        if (!CreateLastWarningObject(cx, report)) {
  +            fputs("Unhandled error happened while creating last warning 
object.\n", gOutFile);
  +            fflush(gOutFile);
  +        }
  +        savedExc.restore();
  +    }
  +#endif
  +
  +    // Get exception object before printing and clearing exception.
  +    RootedValue exn(cx);
  +    if (JS_IsExceptionPending(cx))
  +        (void) JS_GetPendingException(cx, &exn);
  +
  +#ifdef  FIXME
  +    sr->gotError = PrintError(cx, gErrFile, message, report, reportWarnings);
  +#endif
  +    if (!exn.isUndefined()) {
  +        JS::AutoSaveExceptionState savedExc(cx);
  +        if (!PrintStackTrace(cx, exn))
  +            fputs("(Unable to print stack trace)\n", gOutFile);
  +        savedExc.restore();
  +    }
  +
  +    if (report->exnType != JSEXN_NONE && 
!JSREPORT_IS_WARNING(report->flags)) {
  +        if (report->errorNumber == JSMSG_OUT_OF_MEMORY)
  +            sr->exitCode = EXITCODE_OUT_OF_MEMORY;
  +        else
  +            sr->exitCode = EXITCODE_RUNTIME_ERROR;
  +    }
  +}
   #endif
   
  +static void
  +my_OOMCallback(JSContext* cx, void* data)
  +{
  +    // If a script is running, the engine is about to throw the string "out 
of
  +    // memory", which may or may not be caught. Otherwise the engine will 
just
  +    // unwind and return null/false, with no exception set.
  +    if (!JS_IsRunning(cx))
  +        GetShellRuntime(cx)->gotError = true;
  +}
   
   /*==============================================================*/
   static bool
  @@ -6804,7 +6813,6 @@
       SetReservedSlot(obj, DOM_OBJECT_SLOT, PrivateValue((void*)0x1234));
   }
   
  -#ifdef       NOTYET
   static bool
   dom_constructor(JSContext* cx, unsigned argc, JS::Value* vp)
   {
  @@ -6830,7 +6838,6 @@
       args.rval().setObject(*domObj);
       return true;
   }
  -#endif
   
   static bool
   InstanceClassHasProtoAtDepth(const Class* clasp, uint32_t protoID, uint32_t 
depth)
  @@ -7134,16 +7141,17 @@
           if (!JS_DefineDebuggerObject(cx, glob))
               return nullptr;
   
  -#ifdef       FIXME
           if (!JS::RegisterPerfMeasurement(cx, glob))
               return nullptr;
  +#ifdef       FIXME
           if (!JS_DefineFunctionsWithHelp(cx, glob, shell_functions) ||
               !JS_DefineProfilingFunctions(cx, glob))
           {
               return nullptr;
           }
   #else
  -        if (!JS_DefineFunctions(cx, glob, global_functions))
  +        if (!JS_DefineFunctions(cx, glob, shell_functions) ||
  +            !JS_DefineProfilingFunctions(cx, glob))
           {
               return nullptr;
           }
  @@ -7181,12 +7189,10 @@
               return nullptr;
   
           /* Initialize FakeDOMObject. */
  -#ifdef       FIXME
           static const js::DOMCallbacks DOMcallbacks = {
               InstanceClassHasProtoAtDepth
           };
           SetDOMCallbacks(cx->runtime(), &DOMcallbacks);
  -#endif
   
   #ifdef       FIXME
           RootedObject domProto(cx, JS_InitClass(cx, glob, nullptr, 
&dom_class, dom_constructor,
  @@ -8392,7 +8398,7 @@
       I->rt = rt;
    
       JS_SetErrorReporter(rt, rpmjssReportError);
  -    JS::SetOutOfMemoryCallback(rt, rpmjssOOMCallback, nullptr);
  +    JS::SetOutOfMemoryCallback(rt, my_OOMCallback, nullptr);
   
       // XXX SetRuntimeOptions(rt, op);
   
  @@ -8431,20 +8437,6 @@
        I->global = glob;
       }
   
  -#ifdef       HACK
  -     ok = JS_InitStandardClasses(I->cx, global);
  -assert(ok);
  -#ifdef  JS_HAS_CTYPES
  -    ok = JS_InitCTypesClass(I->cx, I->global);
  -assert(ok);
  -#endif
  -
  -#ifdef       NOTYET
  -    ok = JS_DefineFunctions(I->cx, I->global, _functions);
  -assert(ok);
  -#endif
  -#endif
  -
       return I;
   }
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmjss.inp
  ============================================================================
  $ cvs diff -u -r1.1.2.6 -r1.1.2.7 rpmjss.inp
  --- rpm/rpmio/rpmjss.inp      2 Jul 2017 13:59:57 -0000       1.1.2.6
  +++ rpm/rpmio/rpmjss.inp      3 Jul 2017 08:06:01 -0000       1.1.2.7
  @@ -42,17 +42,17 @@
   //setSharedArrayBuffer()
   //shapeOf()
   //arrayInfo()
  -//sleep()
  +sleep(1)
   //compile()
   //parseModule()
   //setModuleResolveHook()
  -//getModuleLoadPath()
  +getModuleLoadPath()
   //parse()
   //syntaxParse()
   //offThreadCompileScript()
   //runOffThreadScript()
   //timeout()
  -//interruptIf()
  +interruptIf(true)
   //invokeInterruptCallback()
   //setInterruptCallback()
   //enableLastWarnong()
  @@ -61,18 +61,18 @@
   elapsed()
   //decompileFunction()
   //decompileThis()
  -//thisFilename()
  +thisFilename()
   //newGlobal()
   //nukeCCW()
   createMappedArrayBuffer("js/createMappedArrayBuffer")
   getMaxArgs()
   objectEmulatingUndefined()
   isCachingEnabled()
  -//setCachingEnabled()
  +setCachingEnabled(true)
   cacheEntry("cacheEntry")
  -//printProfilerEvents()
  -//enableSingleStepProfiling()
  -//disableSingleStepProfiling()
  +printProfilerEvents()
  +enableSingleStepProfiling()
  +disableSingleStepProfiling()
   isLatin1("isLatin1")
   stackPointerInfo()
   //entryPoints()
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to