1919using OriginalMemoryLimitExceededException = Jint . Runtime . MemoryLimitExceededException ;
2020using OriginalObjectInstance = Jint . Native . Object . ObjectInstance ;
2121using OriginalParsedScript = Jint . Prepared < Acornima . Ast . Script > ;
22+ using OriginalParsingOptions = Jint . ScriptParsingOptions ;
23+ using OriginalPreparationOptions = Jint . ScriptPreparationOptions ;
2224using OriginalRecursionDepthOverflowException = Jint . Runtime . RecursionDepthOverflowException ;
2325using OriginalScriptPreparationException = Jint . ScriptPreparationException ;
2426using OriginalStatementsCountOverflowException = Jint . Runtime . StatementsCountOverflowException ;
@@ -63,6 +65,11 @@ public sealed class JintJsEngine : JsEngineBase
6365 /// </summary>
6466 private OriginalEngine _jsEngine ;
6567
68+ /// <summary>
69+ /// Script preparation options
70+ /// </summary>
71+ private OriginalPreparationOptions _preparationOptions ;
72+
6673 /// <summary>
6774 /// Token source for canceling of script execution
6875 /// </summary>
@@ -86,7 +93,7 @@ public sealed class JintJsEngine : JsEngineBase
8693 /// <summary>
8794 /// Flag for whether to allow run the script in strict mode
8895 /// </summary>
89- private bool _strictMode ;
96+ private readonly bool _strictMode ;
9097
9198 /// <summary>
9299 /// Synchronizer of script execution
@@ -151,6 +158,14 @@ public JintJsEngine(JintSettings settings)
151158 options . SetTypeResolver ( jintSettings . AllowReflection ?
152159 CustomTypeResolvers . AllowingReflection : CustomTypeResolvers . DisallowingReflection ) ;
153160 } ) ;
161+ _preparationOptions = new OriginalPreparationOptions
162+ {
163+ ParsingOptions = new OriginalParsingOptions
164+ {
165+ CompileRegex = settings . CompileRegex ,
166+ RegexTimeout = settings . RegexTimeoutInterval
167+ }
168+ } ;
154169 _cancellationConstraint = _jsEngine . Constraints . Find < OriginalCancellationConstraint > ( ) ;
155170 if ( _debuggerBreakCallback is not null )
156171 {
@@ -378,7 +393,8 @@ protected override IPrecompiledScript InnerPrecompile(string code, string docume
378393
379394 try
380395 {
381- parsedScript = OriginalEngine . PrepareScript ( code , uniqueDocumentName , _strictMode ) ;
396+ parsedScript = OriginalEngine . PrepareScript ( code , uniqueDocumentName , _strictMode ,
397+ _preparationOptions ) ;
382398 }
383399 catch ( OriginalException e )
384400 {
@@ -710,6 +726,7 @@ public override void Dispose()
710726 _debuggerStepCallback = null ;
711727 _debuggerBreakCallback = null ;
712728 _cancellationConstraint = null ;
729+ _preparationOptions = null ;
713730
714731 if ( _cancellationTokenSource is not null )
715732 {
0 commit comments