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:   04-Jul-2017 10:51:54
  Branch: rpm-5_4                          Handle: 2017070408515300

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

  Log:
    - rpmjs45: WIP.

  Summary:
    Revision    Changes     Path
    1.1.2.22    +108 -171   rpm/rpmio/rpmjs45.cpp
    1.1.2.11    +2  -2      rpm/rpmio/rpmjss.inp
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmjs45.cpp
  ============================================================================
  $ cvs diff -u -r1.1.2.21 -r1.1.2.22 rpmjs45.cpp
  --- rpm/rpmio/rpmjs45.cpp     4 Jul 2017 06:44:09 -0000       1.1.2.21
  +++ rpm/rpmio/rpmjs45.cpp     4 Jul 2017 08:51:53 -0000       1.1.2.22
  @@ -864,7 +864,6 @@
       JS_FS_HELP_END
   };
   
  -#ifdef       NOTYET
   bool
   DefineOS(JSContext* cx, HandleObject global, bool fuzzingSafe)
   {
  @@ -879,20 +878,26 @@
   
       RootedObject osfile(cx, JS_NewPlainObject(cx));
       if (!osfile ||
  +#ifdef       FIXME
           !JS_DefineFunctionsWithHelp(cx, osfile, osfile_functions) ||
  +#endif
           !JS_DefineProperty(cx, obj, "file", osfile, 0))
       {
           return false;
       }
   
  +#ifdef       FIXME
       if (!fuzzingSafe) {
           if (!JS_DefineFunctionsWithHelp(cx, osfile, osfile_unsafe_functions))
               return false;
       }
  +#endif
   
       RootedObject ospath(cx, JS_NewPlainObject(cx));
       if (!ospath ||
  +#ifdef       FIXME
           !JS_DefineFunctionsWithHelp(cx, ospath, ospath_functions) ||
  +#endif
           !JS_DefineProperty(cx, obj, "path", ospath, 0))
       {
           return false;
  @@ -924,7 +929,6 @@
   
       return true;
   }
  -#endif
   
   } // namespace shell
   } // namespace js
  @@ -1137,6 +1141,7 @@
   static char*
   GetLine(FILE* file, const char * prompt)
   {
  +    FILE * fp = (gOutFile ? gOutFile : stdout);
   #ifdef EDITLINE
       /*
        * Use readline only if file is stdin, because there's no way to specify
  @@ -1162,8 +1167,8 @@
   
       size_t len = 0;
       if (*prompt != '\0') {
  -        fprintf(gOutFile, "%s", prompt);
  -        fflush(gOutFile);
  +        fprintf(fp, "%s", prompt);
  +        fflush(fp);
       }
   
       size_t size = 80;
  @@ -1574,9 +1579,10 @@
           else
               RunModule(cx, filename, file, compileOnly);
       } else {
  +        FILE * fp = (gOutFile ? gOutFile : stdout);
           // It's an interactive filehandle; drop into read-eval-print loop.
           MOZ_ASSERT(kind == FileScript);
  -        ReadEvalPrintLoop(cx, file, gOutFile, compileOnly);
  +        ReadEvalPrintLoop(cx, file, fp, compileOnly);
       }
   }
   
  @@ -1991,12 +1997,16 @@
   {
       MOZ_ASSERT(CacheEntry_isCacheEntry(cache));
       Value v = JS_GetReservedSlot(cache, CacheEntry_BYTECODE);
  +#ifdef       FIXME
       if (!v.isObject() || !v.toObject().is<ArrayBufferObject>())
           return nullptr;
   
       ArrayBufferObject* arrayBuffer = &v.toObject().as<ArrayBufferObject>();
       *length = arrayBuffer->byteLength();
       return arrayBuffer->dataPointer();
  +#else
  +    return nullptr;
  +#endif
   }
   
   static bool
  @@ -2004,6 +2014,7 @@
   {
       MOZ_ASSERT(CacheEntry_isCacheEntry(cache));
   
  +#ifdef       FIXME
       ArrayBufferObject::BufferContents contents =
           
ArrayBufferObject::BufferContents::create<ArrayBufferObject::PLAIN>(buffer);
       Rooted<ArrayBufferObject*> arrayBuffer(cx, ArrayBufferObject::create(cx, 
length, contents));
  @@ -2012,6 +2023,9 @@
   
       SetReservedSlot(cache, CacheEntry_BYTECODE, ObjectValue(*arrayBuffer));
       return true;
  +#else
  +    return false;
  +#endif
   }
   
   class AutoSaveFrameChain
  @@ -2186,9 +2200,7 @@
       ScopedJSFreePtr<uint8_t> saveBuffer;
   
       if (loadBytecode) {
  -#ifdef       FIXME
           loadBuffer = CacheEntry_getBytecode(cacheEntry, &loadLength);
  -#endif
           if (!loadBuffer)
               return false;
       }
  @@ -2297,10 +2309,8 @@
               }
           }
   
  -#ifdef       FIXME
           if (!CacheEntry_setBytecode(cx, cacheEntry, saveBuffer, saveLength))
               return false;
  -#endif
   
           saveBuffer.forget();
       }
  @@ -2337,6 +2347,7 @@
                       JS_ReportError(cx, "can't read %s: %s", pathname,
                                      (ptrdiff_t(cc) < 0) ? strerror(errno) : 
"short read");
                   } else {
  +#ifdef       FIXME
                       char16_t* ucbuf =
                           JS::UTF8CharsToNewTwoByteCharsZ(cx, 
JS::UTF8Chars(buf, len), &len).get();
                       if (!ucbuf) {
  @@ -2345,6 +2356,9 @@
                       }
                       str = JS_NewUCStringCopyN(cx, ucbuf, len);
                       free(ucbuf);
  +#else
  +                    str = JS_NewStringCopyN(cx, buf, len);
  +#endif
                   }
                   JS_free(cx, buf);
               }
  @@ -2545,7 +2559,7 @@
   static bool
   PutStr(JSContext* cx, unsigned argc, Value* vp)
   {
  -    FILE* gOutFile = stdout;
  +    FILE * fp = (gOutFile ? gOutFile : stdout);
       CallArgs args = CallArgsFromVp(argc, vp);
   
       if (args.length() != 0) {
  @@ -2555,9 +2569,9 @@
           char* bytes = JS_EncodeStringToUTF8(cx, str);
           if (!bytes)
               return false;
  -        fputs(bytes, gOutFile);
  +        fputs(bytes, fp);
           JS_free(cx, bytes);
  -        fflush(gOutFile);
  +        fflush(fp);
       }
   
       args.rval().setUndefined();
  @@ -2603,17 +2617,17 @@
   static bool
   Print(JSContext* cx, unsigned argc, Value* vp)
   {
  -    FILE* gOutFile = stdout;
  +    FILE * fp = (gOutFile ? gOutFile : stdout);
       CallArgs args = CallArgsFromVp(argc, vp);
  -    return PrintInternal(cx, args, gOutFile);
  +    return PrintInternal(cx, args, fp);
   }
   
   static bool
   PrintErr(JSContext* cx, unsigned argc, Value* vp)
   {
  -    FILE* gErrFile = stderr;
  +    FILE * fp = (gErrFile ? gErrFile : stderr);
       CallArgs args = CallArgsFromVp(argc, vp);
  -    return PrintInternal(cx, args, gErrFile);
  +    return PrintInternal(cx, args, fp);
   }
   
   static bool
  @@ -2689,7 +2703,8 @@
       }
       double total_ms = mutator_ms + gc_ms;
       if (total_ms > 0) {
  -        fprintf(gOutFile, "Mutator: %.3fms (%.1f%%), GC: %.3fms (%.1f%%)\n",
  +        FILE * fp = (gOutFile ? gOutFile : stdout);
  +        fprintf(fp, "Mutator: %.3fms (%.1f%%), GC: %.3fms (%.1f%%)\n",
                   mutator_ms, mutator_ms / total_ms * 100.0, gc_ms, gc_ms / 
total_ms * 100.0);
       }
   #endif
  @@ -3762,9 +3777,7 @@
           return;
       }
   
  -#ifdef       FIXME
       JS::SetLargeAllocationFailureCallback(rt, my_LargeAllocFailCallback, 
(void*)cx);
  -#endif
   
       do {
           JSAutoRequest ar(cx);
  @@ -4119,16 +4132,18 @@
       if (!ToNumber(cx, args[0], &t))
           return false;
   
  -#ifdef       FIXME
       if (args.length() > 1) {
           RootedValue value(cx, args[1]);
  -        if (!value.isObject() || !value.toObject().is<JSFunction>()) {
  +        if (!value.isObject()
  +#ifdef       FIXME
  +      || !value.toObject().is<JSFunction>()
  +#endif
  +        ) {
               JS_ReportError(cx, "Second argument must be a timeout function");
               return false;
           }
           sr->interruptFunc = value;
       }
  -#endif
   
       args.rval().setUndefined();
       return SetTimeoutValue(cx, t);
  @@ -4163,8 +4178,8 @@
       }
   
       GetShellRuntime(cx)->serviceInterrupt = true;
  -#ifdef       FIXME
       JS_RequestInterruptCallback(cx->runtime());
  +#ifdef       FIXME
       bool interruptRv = CheckForInterrupt(cx);
   #else
       bool interruptRv = false;
  @@ -4200,12 +4215,14 @@
       }
   
       RootedValue value(cx, args[0]);
  +    if (!value.isObject()
   #ifdef       FIXME
  -    if (!value.isObject() || !value.toObject().is<JSFunction>()) {
  +     || !value.toObject().is<JSFunction>()
  +#endif
  +    ) {
           JS_ReportError(cx, "Argument must be a function");
           return false;
       }
  -#endif
       GetShellRuntime(cx)->interruptFunc = value;
   
       args.rval().setUndefined();
  @@ -4276,6 +4293,7 @@
   static bool
   StackDump(JSContext* cx, unsigned argc, Value* vp)
   {
  +    FILE * fp = (gOutFile ? gOutFile : stdout);
       CallArgs args = CallArgsFromVp(argc, vp);
   
       bool showArgs = ToBoolean(args.get(0));
  @@ -4284,9 +4302,9 @@
   
       char* buf = JS::FormatStackDump(cx, nullptr, showArgs, showLocals, 
showThisProps);
       if (!buf) {
  -        fputs("Failed to format JavaScript stack for dump\n", gOutFile);
  +        fputs("Failed to format JavaScript stack for dump\n", fp);
       } else {
  -        fputs(buf, gOutFile);
  +        fputs(buf, fp);
           JS_smprintf_free(buf);
       }
   
  @@ -4342,10 +4360,10 @@
       if (!args[0].isString()) {
   #ifdef       FIXME
           const char* typeName = InformalValueTypeName(args[0]);
  -        JS_ReportError(cx, "expected string to compile, got %s", typeName);
   #else
  -        JS_ReportError(cx, "expected string to compile");
  +     const char* typeName = "???";
   #endif
  +        JS_ReportError(cx, "expected string to compile, got %s", typeName);
           return false;
       }
   
  @@ -4393,10 +4411,10 @@
       if (!args[0].isString()) {
   #ifdef       FIXME
           const char* typeName = InformalValueTypeName(args[0]);
  -        JS_ReportError(cx, "expected string to compile, got %s", typeName);
   #else
  -        JS_ReportError(cx, "expected string to compile");
  +     const char* typeName = "???";
   #endif
  +        JS_ReportError(cx, "expected string to compile, got %s", typeName);
           return false;
       }
   
  @@ -4413,10 +4431,10 @@
           if (!args[1].isString()) {
   #ifdef       FIXME
               const char* typeName = InformalValueTypeName(args[1]);
  -            JS_ReportError(cx, "expected filename string, got %s", typeName);
   #else
  -            JS_ReportError(cx, "expected filename string");
  +         const char* typeName = "???";
   #endif
  +            JS_ReportError(cx, "expected filename string, got %s", typeName);
               return false;
           }
   
  @@ -4462,18 +4480,19 @@
           return false;
       }
   
  +    if (!args[0].isObject()
  +#ifdef       FIXME
  +     || !args[0].toObject().is<JSFunction>()
  +#endif
  +    ) {
   #ifdef       FIXME
  -    if (!args[0].isObject() || !args[0].toObject().is<JSFunction>()) {
           const char* typeName = InformalValueTypeName(args[0]);
  -        JS_ReportError(cx, "expected hook function, got %s", typeName);
  -        return false;
  -    }
   #else
  -    if (!args[0].isObject()) {
  -        JS_ReportError(cx, "expected hook function");
  +        const char* typeName = "???";
  +#endif
  +        JS_ReportError(cx, "expected hook function, got %s", typeName);
           return false;
       }
  -#endif
   
       RootedFunction hook(cx, &args[0].toObject().as<JSFunction>());
       Rooted<GlobalObject*> global(cx, cx->global());
  @@ -4507,10 +4526,10 @@
       if (!args[0].isString()) {
   #ifdef       FIXME
           const char* typeName = InformalValueTypeName(args[0]);
  -        JS_ReportError(cx, "expected string to parse, got %s", typeName);
   #else
  -        JS_ReportError(cx, "expected string to parse");
  +        const char* typeName = "???";
   #endif
  +        JS_ReportError(cx, "expected string to parse, got %s", typeName);
           return false;
       }
   
  @@ -4543,11 +4562,11 @@
       ParseNode* pn = parser.parse();
       if (!pn)
           return false;
  +#endif       /* FIXME */
   #ifdef DEBUG
       DumpParseTree(pn);
       fputc('\n', stderr);
   #endif
  -#endif       /* FIXME */
       args.rval().setUndefined();
       return true;
   }
  @@ -4567,10 +4586,10 @@
       if (!args[0].isString()) {
   #ifdef       FIXME
           const char* typeName = InformalValueTypeName(args[0]);
  -        JS_ReportError(cx, "expected string to parse, got %s", typeName);
   #else
  -        JS_ReportError(cx, "expected string to parse");
  +        const char* typeName = "???";
   #endif
  +        JS_ReportError(cx, "expected string to parse, got %s", typeName);
           return false;
       }
   
  @@ -4721,10 +4740,10 @@
       if (!args[0].isString()) {
   #ifdef       FIXME
           const char* typeName = InformalValueTypeName(args[0]);
  -        JS_ReportError(cx, "expected string to parse, got %s", typeName);
   #else
  -        JS_ReportError(cx, "expected string to parse");
  +        const char* typeName = "???";
   #endif
  +        JS_ReportError(cx, "expected string to parse, got %s", typeName);
           return false;
       }
   
  @@ -4808,10 +4827,10 @@
   static bool
   runOffThreadScript(JSContext* cx, unsigned argc, Value* vp)
   {
  -#ifdef       FIXME
       CallArgs args = CallArgsFromVp(argc, vp);
   
       JSRuntime* rt = cx->runtime();
  +#ifdef       FIXME
       if (OffThreadParsingMustWaitForGC(rt))
           gc::AutoFinishGC finishgc(rt);
   
  @@ -5023,17 +5042,15 @@
   DecompileFunction(JSContext* cx, unsigned argc, Value* vp)
   {
       CallArgs args = CallArgsFromVp(argc, vp);
  +    if (args.length() < 1
  +     || !args[0].isObject()
   #ifdef       FIXME
  -    if (args.length() < 1 || !args[0].isObject() || 
!args[0].toObject().is<JSFunction>()) {
  -        args.rval().setUndefined();
  -        return true;
  -    }
  -#else
  -    if (args.length() < 1 || !args[0].isObject()) {
  +     || !args[0].toObject().is<JSFunction>()
  +#endif
  +    ) {
           args.rval().setUndefined();
           return true;
       }
  -#endif
       RootedFunction fun(cx, &args[0].toObject().as<JSFunction>());
       JSString* result = JS_DecompileFunction(cx, fun, 0);
       if (!result)
  @@ -5851,14 +5868,14 @@
   
           if (!JS_GetProperty(cx, opts, "function", &fun))
               return false;
  -#ifdef       FIXME
           if (!fun.isUndefined()) {
  +#ifdef       FIXME
               js::shell::ShellAutoEntryMonitor sarep(cx);
               if (!Call(cx, UndefinedHandleValue, fun, 
JS::HandleValueArray::empty(), &dummy))
                   return false;
               return sarep.buildResult(cx, args.rval());
  -        }
   #endif
  +        }
       }
   
       // { object: o, property: p, value: v } --- Fetch o[p], or if
  @@ -5869,8 +5886,8 @@
           if (!JS_GetProperty(cx, opts, "object", &objectv) ||
               !JS_GetProperty(cx, opts, "property", &propv))
               return false;
  -#ifdef       FIXME
           if (!objectv.isUndefined() && !propv.isUndefined()) {
  +#ifdef       FIXME
               RootedObject object(cx, ToObject(cx, objectv));
               if (!object)
                   return false;
  @@ -5896,8 +5913,8 @@
               }
   
               return sarep.buildResult(cx, args.rval());
  -        }
   #endif       /* FIXME */
  +        }
       }
   
       // { ToString: v } --- Apply JS::ToString to v.
  @@ -5906,14 +5923,14 @@
   
           if (!JS_GetProperty(cx, opts, "ToString", &v))
               return false;
  -#ifdef       FIXME
           if (!v.isUndefined()) {
  +#ifdef       FIXME
               js::shell::ShellAutoEntryMonitor sarep(cx);
               if (!JS::ToString(cx, v))
                   return false;
               return sarep.buildResult(cx, args.rval());
  -        }
   #endif       /* FIXME */
  +        }
       }
   
       // { ToNumber: v } --- Apply JS::ToNumber to v.
  @@ -5923,14 +5940,14 @@
   
           if (!JS_GetProperty(cx, opts, "ToNumber", &v))
               return false;
  -#ifdef       FIXME
           if (!v.isUndefined()) {
  +#ifdef       FIXME
               js::shell::ShellAutoEntryMonitor sarep(cx);
               if (!JS::ToNumber(cx, v, &dummy))
                   return false;
               return sarep.buildResult(cx, args.rval());
  -        }
   #endif       /* FIXME */
  +        }
       }
   
       // { eval: code } --- Apply ToString and then Evaluate to code.
  @@ -5939,8 +5956,8 @@
   
           if (!JS_GetProperty(cx, opts, "eval", &code))
               return false;
  -#ifdef       FIXME
           if (!code.isUndefined()) {
  +#ifdef       FIXME
               RootedString codeString(cx, ToString(cx, code));
               if (!codeString || !codeString->ensureFlat(cx))
                   return false;
  @@ -5970,96 +5987,14 @@
                   return false;
   #endif
               return sarep.buildResult(cx, args.rval());
  -        }
   #endif       /* FIXME */
  +        }
       }
   
       JS_ReportError(cx, "bad 'params' object");
       return false;
   }
   
  -static const JSFunctionSpec shell_functions[] = {
  -    JS_FN("version",                 Version,                        0,0),
  -    JS_FN("options",                 Options,                        0,0),
  -    JS_FN("load",                    Load,                           1,0),
  -    JS_FN("loadRelativeToScript",    LoadScriptRelativeToScript,     1,0),
  -    JS_FN("evaluate",                        Evaluate,                       
2,0),
  -    JS_FN("run",                     Run,                            1,0),
  -    JS_FN("readline",                        ReadLine,                       
0,0),
  -    JS_FN("print",                   Print,                          0,0),
  -    JS_FN("printErr",                        PrintErr,                       
0,0),
  -    JS_FN("putstr",                  PutStr,                         0,0),
  -    JS_FN("dateNow",                 Now,                            0,0),
  -#ifdef       NOTYET
  -    JS_FN("help",                    Help,                           0,0),
  -#endif       /* NOTYET */
  -    JS_FN("quit",                    Quit,                           0,0),
  -    JS_FN("assertEq",                        AssertEq,                       
2,0),
  -    JS_FN("startTimingMutator",              StartTimingMutator,             
0,0),
  -    JS_FN("stopTimingMutator",               StopTimingMutator,              
0,0),
  -    JS_FN("throwError",                      ThrowError,                     
0,0),
  -#ifdef DEBUG
  -    JS_FN("disassemble",             DisassembleToString,            1,0),
  -    JS_FN("dis",                     Disassemble,                    1,0),
  -    JS_FN("disfile",                 DisassFile,                     1,0),
  -    JS_FN("dissrc",                  DisassWithSrc,                  1,0),
  -    JS_FN("notes",                   Notes,                          1,0),
  -    JS_FN("stackDump",                       StackDump,                      
3,0),
  -#endif       /* DEBUG */
  -    JS_FN("intern",                  Intern,                         1,0),
  -    JS_FN("getslx",                  GetSLX,                         1,0),
  -    JS_FN("evalcx",                  EvalInContext,                  1,0),
  -    JS_FN("evalInWorker",            EvalInWorker,                   1,0),
  -    JS_FN("getSharedArrayBuffer",    GetSharedArrayBuffer,           0,0),
  -    JS_FN("setSharedArrayBuffer",    SetSharedArrayBuffer,           0,0),
  -    JS_FN("shapeOf",                 ShapeOf,                        1,0),
  -#ifdef DEBUG
  -    JS_FN("arrayInfo",                       ArrayInfo,                      
1,0),
  -#endif
  -    JS_FN("sleep",                   Sleep_fn,                       1,0),
  -    JS_FN("compile",                 Compile,                        1,0),
  -    JS_FN("parseModule",             ParseModule,                    1,0),
  -    JS_FN("setModuleResolveHook",    SetModuleResolveHook,           1,0),
  -    JS_FN("getModuleLoadPath",               GetModuleLoadPath,              
0,0),
  -    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),
  -    JS_FN("interruptIf",             InterruptIf,                    1,0),
  -    JS_FN("invokeInterruptCallback", InvokeInterruptCallbackWrapper, 0,0),
  -    JS_FN("setInterruptCallback",    SetInterruptCallback,           1,0),
  -    JS_FN("enableLastWarning",               EnableLastWarning,              
0,0),
  -    JS_FN("disableLastWarning",              DisableLastWarning,             
0,0),
  -    JS_FN("getLastWarning",          GetLastWarning,                 0,0),
  -    JS_FN("clearLastWarning",                ClearLastWarning,               
0,0),
  -    JS_FN("elapsed",                 Elapsed,                        0,0),
  -    JS_FN("decompileFunction",               DecompileFunction,              
1,0),
  -    JS_FN("decompileThis",           DecompileThisScript,            0,0),
  -    JS_FN("thisFilename",            ThisFilename,                   0,0),
  -    JS_FN("newGlobal",                       NewGlobal,                      
1,0),
  -    JS_FN("nukeCCW",                 NukeCCW,                        1,0),
  -    JS_FN("createMappedArrayBuffer", CreateMappedArrayBuffer,        1,0),
  -    JS_FN("getMaxArgs",                      GetMaxArgs,                     
0,0),
  -    JS_FN("objectEmulatingUndefined",        ObjectEmulatingUndefined,       
0,0),
  -    JS_FN("isCachingEnabled",                IsCachingEnabled,               
0,0),
  -    JS_FN("setCachingEnabled",               SetCachingEnabled,              
1,0),
  -    JS_FN("cacheEntry",                      CacheEntry,                     
1,0),
  -    JS_FN("printProfilerEvents",     PrintProfilerEvents,            0,0),
  -    JS_FN("enableSingleStepProfiling",       EnableSingleStepProfiling,      
0,0),
  -    JS_FN("disableSingleStepProfiling",      DisableSingleStepProfiling,     
0,0),
  -    JS_FN("isLatin1",                        IsLatin1,                       
1,0),
  -    JS_FN("stackPointerInfo",                StackPointerInfo,               
0,0),
  -    JS_FN("entryPoints",             EntryPoints,                    1,0),
  -
  -#ifdef       NOTYET
  -    JS_FS("require",                 Require,                        0,0),
  -#endif       /* NOTYET */
  -    JS_FS_END
  -};
  -
  -/*==============================================================*/
  -#ifdef       NOTYET
   static const JSFunctionSpecWithHelp shell_functions[] = {
       JS_FN_HELP("version", Version, 0, 0,
   "version([number])",
  @@ -6449,7 +6384,6 @@
   
       JS_FS_HELP_END
   };
  -#endif       /* NOTYET */
   
   /*==============================================================*/
   static const JSFunctionSpecWithHelp console_functions[] = {
  @@ -6494,8 +6428,10 @@
   static bool
   PrintHelpString(JSContext* cx, Value v)
   {
  +    FILE * fp = (gOutFile ? gOutFile : stdout);
       JSString* str = v.toString();
   
  +#ifdef       FIXME
       JSLinearString* linear = str->ensureLinear(cx);
       if (!linear)
           return false;
  @@ -6503,12 +6439,18 @@
       JS::AutoCheckCannotGC nogc;
       if (linear->hasLatin1Chars()) {
           for (const Latin1Char* p = linear->latin1Chars(nogc); *p; p++)
  -            fprintf(gOutFile, "%c", char(*p));
  +            fprintf(fp, "%c", char(*p));
       } else {
           for (const char16_t* p = linear->twoByteChars(nogc); *p; p++)
  -            fprintf(gOutFile, "%c", char(*p));
  +            fprintf(fp, "%c", char(*p));
       }
  -    fprintf(gOutFile, "\n");
  +    fprintf(fp, "\n");
  +#else
  +    JSAutoByteString chars(cx, str);
  +    if (!chars)
  +        return false;
  +    fprintf(fp, "%.*s\n", (int)chars.length(), chars.ptr());
  +#endif
   
       return true;
   }
  @@ -6532,8 +6474,9 @@
   static bool
   Help(JSContext* cx, unsigned argc, Value* vp)
   {
  +    FILE * fp = (gOutFile ? gOutFile : stdout);
       CallArgs args = CallArgsFromVp(argc, vp);
  -    fprintf(gOutFile, "%s\n", JS_GetImplementationVersion());
  +    fprintf(fp, "%s\n", JS_GetImplementationVersion());
   
       RootedObject obj(cx);
       if (args.length() == 0) {
  @@ -6627,6 +6570,7 @@
   static bool
   PrintStackTrace(JSContext* cx, HandleValue exn)
   {
  +    FILE * fp = (gErrFile ? gErrFile : stderr);
       if (!exn.isObject())
           return false;
   
  @@ -6654,8 +6598,8 @@
       if (!stack)
           return false;
   
  -    fputs("Stack:\n", gErrFile);
  -    fputs(stack.get(), gErrFile);
  +    fputs("Stack:\n", fp);
  +    fputs(stack.get(), fp);
   
       return true;
   }
  @@ -6664,14 +6608,15 @@
   void
   my_ErrorReporter(JSContext* cx, const char* message, JSErrorReport* report)
   {
  +    FILE * fp = (gOutFile ? gOutFile : stdout);
       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);
  +            fputs("Unhandled error happened while creating last warning 
object.\n", fp);
  +            fflush(fp);
           }
           savedExc.restore();
       }
  @@ -6683,12 +6628,12 @@
           (void) JS_GetPendingException(cx, &exn);
   
   #ifdef  FIXME
  -    sr->gotError = PrintError(cx, gErrFile, message, report, reportWarnings);
  +    sr->gotError = PrintError(cx, fp, message, report, reportWarnings);
   #endif
       if (!exn.isUndefined()) {
           JS::AutoSaveExceptionState savedExc(cx);
           if (!PrintStackTrace(cx, exn))
  -            fputs("(Unable to print stack trace)\n", gOutFile);
  +            fputs("(Unable to print stack trace)\n", fp);
           savedExc.restore();
       }
   
  @@ -6957,6 +6902,7 @@
   
       RootedObject callee(cx, &args.callee());
       RootedValue protov(cx);
  +#ifdef       FIXME
       if (!GetProperty(cx, callee, callee, cx->names().prototype, &protov))
           return false;
   
  @@ -6974,6 +6920,9 @@
   
       args.rval().setObject(*domObj);
       return true;
  +#else
  +    return false;
  +#endif
   }
   
   static bool
  @@ -7280,19 +7229,11 @@
   
           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, shell_functions) ||
  -            !JS_DefineProfilingFunctions(cx, glob))
  -        {
  -            return nullptr;
  -        }
  -#endif
   
   #ifdef       FIXME
           if (!js::DefineTestingFunctions(cx, glob, fuzzingSafe, 
disableOOMFunctions))
  @@ -7308,10 +7249,8 @@
                   return nullptr;
           }
   
  -#ifdef       FIXME
  -        if (!DefineOS(cx, glob, fuzzingSafe))
  +        if (!js::shell::DefineOS(cx, glob, fuzzingSafe))
               return nullptr;
  -#endif
   
           RootedObject performanceObj(cx, JS_NewObject(cx, nullptr));
           if (!performanceObj)
  @@ -7335,7 +7274,6 @@
           };
           SetDOMCallbacks(cx->runtime(), &DOMcallbacks);
   
  -#ifdef       FIXME
           RootedObject domProto(cx, JS_InitClass(cx, glob, nullptr, 
&dom_class, dom_constructor,
                                                  0, dom_props, dom_methods, 
nullptr, nullptr));
           if (!domProto)
  @@ -7343,7 +7281,6 @@
   
           /* Initialize FakeDOMObject.prototype */
           InitDOMObject(domProto);
  -#endif
   
   #ifdef       FIXME
           if (!js::InitModuleClasses(cx, glob))
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmjss.inp
  ============================================================================
  $ cvs diff -u -r1.1.2.10 -r1.1.2.11 rpmjss.inp
  --- rpm/rpmio/rpmjss.inp      4 Jul 2017 06:44:09 -0000       1.1.2.10
  +++ rpm/rpmio/rpmjss.inp      4 Jul 2017 08:51:53 -0000       1.1.2.11
  @@ -23,7 +23,6 @@
   var foo = "printErr"; printErr(foo)
   var foo = "putstr"; putstr(foo)
   dateNow()
  -//help()
   var foo = 0; assertEq(foo, foo)
   startTimingMutator()
   stopTimingMutator()
  @@ -77,4 +76,5 @@
   isLatin1("isLatin1")
   stackPointerInfo()
   entryPoints()
  -quit
  +help(help)
  +quit()
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to