/// <summary>
        /// Executes a script
        /// </summary>
        /// <remarks>
        /// Requires an active script context.
        /// </remarks>
        /// <param name="script">The script to run</param>
        /// <param name="sourceContext">The cookie identifying the script that can be used
        /// by script contexts that have debugging enabled</param>
        /// <param name="sourceName">The location the script came from</param>
        /// <returns>The result of the script, if any</returns>
        public static JsValue RunScript(string script, JsSourceContext sourceContext, string sourceName)
        {
            JsValue     result;
            JsErrorCode errorCode;

            if (Utils.IsWindows())
            {
                errorCode = NativeMethods.JsRunScript(script, sourceContext, sourceName, out result);
                JsErrorHelpers.ThrowIfError(errorCode);
            }
            else
            {
                JsValue scriptValue = JsValue.FromString(script);
                scriptValue.AddRef();

                JsValue sourceUrlValue = JsValue.FromString(sourceName);
                sourceUrlValue.AddRef();

                try
                {
                    errorCode = NativeMethods.JsRun(scriptValue, sourceContext, sourceUrlValue,
                                                    JsParseScriptAttributes.None, out result);
                    JsErrorHelpers.ThrowIfError(errorCode);
                }
                finally
                {
                    scriptValue.Release();
                    sourceUrlValue.Release();
                }
            }

            return(result);
        }
 internal static extern JsErrorCode JsRunSerializedScript(string script, byte[] buffer,
                                                          JsSourceContext sourceContext, string sourceUrl, out JsValue result);
 internal static extern JsErrorCode JsRunSerializedScriptWithCallback(
     JsSerializedScriptLoadSourceCallback scriptLoadCallback,
     JsSerializedScriptUnloadCallback scriptUnloadCallback, byte[] buffer,
     JsSourceContext sourceContext, string sourceUrl, out JsValue result);
 internal static extern JsErrorCode JsRunScript(string script, JsSourceContext sourceContext,
                                                string sourceUrl, out JsValue result);
 internal static extern JsErrorCode JsRunSerialized(JsValue buffer,
                                                    JsSerializedLoadScriptCallback scriptLoadCallback, JsSourceContext sourceContext,
                                                    JsValue sourceUrl, out JsValue result);
 internal static extern JsErrorCode JsRun(JsValue script, JsSourceContext sourceContext, JsValue sourceUrl,
                                          JsParseScriptAttributes parseAttributes, out JsValue result);