migration to mozjs-52

[email protected] Tue, 2 Jul 2019 06:31:25 -0700 (PDT)
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <[email protected]>
Greetings!

I've been working on some updates to OpenVXI and decided to update all the libraries first.
Looks like I was able to figure out most of it, but still have some questions (also I should mention that this is my first big c/c++ endeavor)

I have this type of thing going on and I'm not sure what to replace it with as all/most of these functions seem to be obsolete but JSAPI User guide still has them in there.

bool jsScriptRes = JS_CompileUCScript (context, 
                                   tmpscript, tmpscriptlen, 
                                  options, &jsScript);
  if ( ! jsScriptRes )
    rc = VXIjsi_RESULT_SYNTAX_ERROR;
  else {
    JSObject *jsScriptObj = JS_NewScriptObject (context, jsScript);
    if (( ! jsScriptObj ) ||
        ( ! JS_AddNamedRoot (context, &jsScriptObj, SCRIPT_OBJECT_NAME) )) {
      JS_DestroyScript (context, jsScript); 
      rc = VXIjsi_RESULT_OUT_OF_MEMORY;
    } else {
      
      JS::Rooted <JS::Value> val(context, JS::UndefinedValue());
      JS::Rooted <JSObject*> robj(context, currentScope->GetJsobj( ));

      if ( JS_ExecuteScript (context, jsScript,
                             &val) ) {
        if ( retval )
          rc = retval->Set (val);
      } else if ( exception ) {
        rc = VXIjsi_RESULT_SCRIPT_EXCEPTION;
      } else if ( numBranches > maxBranches ) {
        rc = VXIjsi_RESULT_SECURITY_VIOLATION;
      } else {
        rc = VXIjsi_RESULT_NON_FATAL_ERROR;
      }

      if ( ! JS_RemoveRoot (context, &jsScriptObj) )
        rc = VXIjsi_RESULT_FATAL_ERROR;
    }
  }