/// <summary> /// Loads a source code of the serialized script /// </summary> /// <param name="sourceContext">A cookie identifying the script that can be used /// by debuggable script contexts</param> /// <param name="value">The script returned</param> /// <param name="parseAttributes">Attribute mask for parsing the script</param> /// <returns>true if the operation succeeded, false otherwise</returns> private bool LoadScriptSourceCode(JsSourceContext sourceContext, out JsValue value, out JsParseScriptAttributes parseAttributes) { if (_codeBytes == null) { lock (_scriptLoadingSynchronizer) { if (_codeBytes == null) { Encoding encoding = _parseAttributes.HasFlag(JsParseScriptAttributes.ArrayBufferIsUtf16Encoded) ? Encoding.Unicode : Encoding.UTF8; _codeBytes = encoding.GetBytes(_code); } } } bool result; parseAttributes = _parseAttributes; try { value = JsValue.CreateExternalArrayBuffer(_codeBytes); result = true; } catch (OriginalException) { value = JsValue.Invalid; result = false; } return(result); }