Exemple #1
0
        public Rooted <JS.Value> Evaluate(
            JSHandleObject scope, string scriptSource, out JSError error,
            string filename = null, uint lineNumber = 0
            )
        {
            var prior = ReportUncaughtExceptions;

            try {
                ReportUncaughtExceptions = false;

                var isAlreadyThrowing = Exception.IsPending;

                var result = Evaluate(scope, scriptSource, filename, lineNumber);

                if (Exception.IsPending && !isAlreadyThrowing)
                {
                    var exc = Exception.Get();
                    if (exc.Value.ValueType == JSValueType.OBJECT)
                    {
                        error = new JSError(this, exc.Value.AsObject);
                    }
                    else
                    {
                        exc   = Exception.Get();
                        error = null;
                    }
                    Exception.Clear();
                }
                else
                {
                    error = null;
                }

                return(result);
            } finally {
                ReportUncaughtExceptions = prior;
            }
        }
Exemple #2
0
 public JSRuntimeException(JSError error)
     : base(error.ToString())
 {
 }