11#if ! NETSTANDARD
2- using System ;
32using System . Collections . Generic ;
4- using System . Reflection ;
53
64using MsieJavaScriptEngine . Constants ;
7- #if NET40
8- using MsieJavaScriptEngine . Polyfills . System ;
9- #endif
10- using MsieJavaScriptEngine . Resources ;
11- using MsieJavaScriptEngine . Utilities ;
125
136using EXCEPINFO = System . Runtime . InteropServices . ComTypes . EXCEPINFO ;
147
@@ -19,16 +12,6 @@ namespace MsieJavaScriptEngine.ActiveScript
1912 /// </summary>
2013 internal sealed partial class ClassicActiveScriptJsEngine : ActiveScriptJsEngineBase
2114 {
22- /// <summary>
23- /// Name of resource, which contains a ECMAScript 5 Polyfill
24- /// </summary>
25- private const string ES5_POLYFILL_RESOURCE_NAME = "MsieJavaScriptEngine.Resources.ES5.min.js" ;
26-
27- /// <summary>
28- /// Name of resource, which contains a JSON2 library
29- /// </summary>
30- private const string JSON2_LIBRARY_RESOURCE_NAME = "MsieJavaScriptEngine.Resources.json2.min.js" ;
31-
3215 /// <summary>
3316 /// Flag indicating whether this JS engine is supported
3417 /// </summary>
@@ -85,9 +68,7 @@ internal sealed partial class ClassicActiveScriptJsEngine : ActiveScriptJsEngine
8568 /// <param name="settings">JS engine settings</param>
8669 public ClassicActiveScriptJsEngine ( JsEngineSettings settings )
8770 : base ( settings , ClassId . Classic , ScriptLanguageVersion . None , "6" , "Microsoft JScript " )
88- {
89- LoadResources ( _settings . UseEcmaScript5Polyfill , _settings . UseJson2Library ) ;
90- }
71+ { }
9172
9273
9374 /// <summary>
@@ -111,61 +92,6 @@ protected override string GetErrorTypeByNumber(int errorNumber)
11192 return ActiveScriptJsErrorHelpers . GetErrorTypeByNumber ( errorNumber , _runtimeErrorTypeMap ) ;
11293 }
11394
114- /// <summary>
115- /// Loads a resources
116- /// </summary>
117- /// <param name="useEcmaScript5Polyfill">Flag for whether to use the ECMAScript 5 Polyfill</param>
118- /// <param name="useJson2Library">Flag for whether to use the JSON2 library</param>
119- private void LoadResources ( bool useEcmaScript5Polyfill , bool useJson2Library )
120- {
121- Assembly assembly = GetType ( ) . GetTypeInfo ( ) . Assembly ;
122-
123- if ( useEcmaScript5Polyfill )
124- {
125- ExecuteResource ( ES5_POLYFILL_RESOURCE_NAME , assembly ) ;
126- }
127-
128- if ( useJson2Library )
129- {
130- ExecuteResource ( JSON2_LIBRARY_RESOURCE_NAME , assembly ) ;
131- }
132- }
133-
134- /// <summary>
135- /// Executes a code from embedded JS-resource
136- /// </summary>
137- /// <param name="resourceName">The case-sensitive resource name</param>
138- /// <param name="assembly">The assembly, which contains the embedded resource</param>
139- private void ExecuteResource ( string resourceName , Assembly assembly )
140- {
141- if ( resourceName == null )
142- {
143- throw new ArgumentNullException (
144- nameof ( resourceName ) ,
145- string . Format ( CommonStrings . Common_ArgumentIsNull , nameof ( resourceName ) )
146- ) ;
147- }
148-
149- if ( assembly == null )
150- {
151- throw new ArgumentNullException (
152- nameof ( assembly ) ,
153- string . Format ( CommonStrings . Common_ArgumentIsNull , nameof ( assembly ) )
154- ) ;
155- }
156-
157- if ( string . IsNullOrWhiteSpace ( resourceName ) )
158- {
159- throw new ArgumentException (
160- string . Format ( CommonStrings . Common_ArgumentIsEmpty , nameof ( resourceName ) ) ,
161- nameof ( resourceName )
162- ) ;
163- }
164-
165- string code = Utils . GetResourceAsString ( resourceName , assembly ) ;
166- Execute ( code , resourceName ) ;
167- }
168-
16995 #region ActiveScriptJsEngineBase overrides
17096
17197 /// <summary>
0 commit comments