@@ -149,19 +149,6 @@ public static uint Idle()
149149 return ticks ;
150150 }
151151
152- /// <summary>
153- /// Parses a script and returns a function representing the script
154- /// </summary>
155- /// <remarks>
156- /// Requires an active script context.
157- /// </remarks>
158- /// <param name="script">The script to parse</param>
159- /// <returns>A function representing the script code</returns>
160- public static JsValue ParseScript ( string script )
161- {
162- return ParseScript ( script , JsSourceContext . None , string . Empty ) ;
163- }
164-
165152 /// <summary>
166153 /// Parses a script and returns a function representing the script
167154 /// </summary>
@@ -218,28 +205,13 @@ public static JsValue ParseScript(string script, JsSourceContext sourceContext,
218205 /// </remarks>
219206 /// <param name="script">The script to parse</param>
220207 /// <param name="buffer">The serialized script</param>
221- /// <returns>A function representing the script code</returns>
222- public static JsValue ParseSerializedScript ( string script , byte [ ] buffer )
223- {
224- return ParseSerializedScript ( script , buffer , JsSourceContext . None , string . Empty ) ;
225- }
226-
227- /// <summary>
228- /// Parses a serialized script and returns a function representing the script
229- /// </summary>
230- /// <remarks>
231- /// <para>Requires an active script context.</para>
232- /// <para>The runtime will hold on to the buffer until all instances of any functions created from
233- /// the buffer are garbage collected.</para>
234- /// </remarks>
235- /// <param name="script">The script to parse</param>
236- /// <param name="buffer">The serialized script</param>
208+ /// <param name="scriptLoadCallback">Callback to load the source code of the serialized script</param>
237209 /// <param name="sourceContext">A cookie identifying the script that can be used
238210 /// by debuggable script contexts</param>
239211 /// <param name="sourceUrl">The location the script came from</param>
240212 /// <returns>A function representing the script code</returns>
241- public static JsValue ParseSerializedScript ( string script , byte [ ] buffer , JsSourceContext sourceContext ,
242- string sourceUrl )
213+ public static JsValue ParseSerializedScript ( string script , byte [ ] buffer ,
214+ JsSerializedLoadScriptCallback scriptLoadCallback , JsSourceContext sourceContext , string sourceUrl )
243215 {
244216 JsValue result ;
245217 JsErrorCode errorCode ;
@@ -254,16 +226,6 @@ public static JsValue ParseSerializedScript(string script, byte[] buffer, JsSour
254226 JsValue bufferValue = JsValue . CreateExternalArrayBuffer ( buffer ) ;
255227 bufferValue . AddRef ( ) ;
256228
257- JsSerializedLoadScriptCallback scriptLoadCallback = ( JsSourceContext context ,
258- out JsValue value , out JsParseScriptAttributes parseAttributes ) =>
259- {
260- byte [ ] bytes = Encoding . GetEncoding ( 0 ) . GetBytes ( script ) ;
261- value = JsValue . CreateExternalArrayBuffer ( bytes ) ;
262- parseAttributes = JsParseScriptAttributes . None ;
263-
264- return true ;
265- } ;
266-
267229 JsValue sourceUrlValue = JsValue . FromString ( sourceUrl ) ;
268230 sourceUrlValue . AddRef ( ) ;
269231
@@ -283,19 +245,6 @@ public static JsValue ParseSerializedScript(string script, byte[] buffer, JsSour
283245 return result ;
284246 }
285247
286- /// <summary>
287- /// Executes a script
288- /// </summary>
289- /// <remarks>
290- /// Requires an active script context
291- /// </remarks>
292- /// <param name="script">The script to run</param>
293- /// <returns>The result of the script, if any</returns>
294- public static JsValue RunScript ( string script )
295- {
296- return RunScript ( script , JsSourceContext . None , string . Empty ) ;
297- }
298-
299248 /// <summary>
300249 /// Executes a script
301250 /// </summary>
@@ -352,28 +301,13 @@ public static JsValue RunScript(string script, JsSourceContext sourceContext, st
352301 /// </remarks>
353302 /// <param name="script">The source code of the serialized script</param>
354303 /// <param name="buffer">The serialized script</param>
355- /// <returns>The result of running the script, if any</returns>
356- public static JsValue RunSerializedScript ( string script , byte [ ] buffer )
357- {
358- return RunSerializedScript ( script , buffer , JsSourceContext . None , string . Empty ) ;
359- }
360-
361- /// <summary>
362- /// Runs a serialized script
363- /// </summary>
364- /// <remarks>
365- /// <para>Requires an active script context.</para>
366- /// <para>The runtime will hold on to the buffer until all instances of any functions created from
367- /// the buffer are garbage collected.</para>
368- /// </remarks>
369- /// <param name="script">The source code of the serialized script</param>
370- /// <param name="buffer">The serialized script</param>
304+ /// <param name="scriptLoadCallback">Callback to load the source code of the serialized script</param>
371305 /// <param name="sourceContext">A cookie identifying the script that can be used
372306 /// by debuggable script contexts</param>
373307 /// <param name="sourceUrl">The location the script came from</param>
374308 /// <returns>The result of running the script, if any</returns>
375- public static JsValue RunSerializedScript ( string script , byte [ ] buffer , JsSourceContext sourceContext ,
376- string sourceUrl )
309+ public static JsValue RunSerializedScript ( string script , byte [ ] buffer ,
310+ JsSerializedLoadScriptCallback scriptLoadCallback , JsSourceContext sourceContext , string sourceUrl )
377311 {
378312 JsValue result ;
379313 JsErrorCode errorCode ;
@@ -388,16 +322,6 @@ public static JsValue RunSerializedScript(string script, byte[] buffer, JsSource
388322 JsValue bufferValue = JsValue . CreateExternalArrayBuffer ( buffer ) ;
389323 bufferValue . AddRef ( ) ;
390324
391- JsSerializedLoadScriptCallback scriptLoadCallback = ( JsSourceContext context ,
392- out JsValue value , out JsParseScriptAttributes parseAttributes ) =>
393- {
394- byte [ ] bytes = Encoding . GetEncoding ( 0 ) . GetBytes ( script ) ;
395- value = JsValue . CreateExternalArrayBuffer ( bytes ) ;
396- parseAttributes = JsParseScriptAttributes . None ;
397-
398- return true ;
399- } ;
400-
401325 JsValue sourceUrlValue = JsValue . FromString ( sourceUrl ) ;
402326 sourceUrlValue . AddRef ( ) ;
403327
0 commit comments