6
6
using OriginalJsEngine = MsieJavaScriptEngine . MsieJsEngine ;
7
7
using OriginalJsEngineLoadException = MsieJavaScriptEngine . JsEngineLoadException ;
8
8
using OriginalJsEngineMode = MsieJavaScriptEngine . JsEngineMode ;
9
+ using OriginalJsException = MsieJavaScriptEngine . JsException ;
9
10
using OriginalJsRuntimeException = MsieJavaScriptEngine . JsRuntimeException ;
11
+ using OriginalJsScriptInterruptedException = MsieJavaScriptEngine . JsScriptInterruptedException ;
10
12
using OriginalJsEngineSettings = MsieJavaScriptEngine . JsEngineSettings ;
11
13
using OriginalTypeConverter = MsieJavaScriptEngine . Utilities . TypeConverter ;
12
14
using OriginalUndefined = MsieJavaScriptEngine . Undefined ;
@@ -112,18 +114,35 @@ private static object MapToHostType(object value)
112
114
return value ;
113
115
}
114
116
115
- private JsRuntimeException ConvertScriptExceptionToHostException (
116
- OriginalJsRuntimeException scriptException )
117
+ private JsException ConvertScriptExceptionToHostException (
118
+ OriginalJsException scriptException )
117
119
{
118
- var hostException = new JsRuntimeException ( scriptException . Message ,
119
- EngineName , _engineVersion , scriptException )
120
+ JsException hostException ;
121
+
122
+ if ( scriptException is OriginalJsRuntimeException )
120
123
{
121
- ErrorCode = scriptException . ErrorCode ,
122
- Category = scriptException . Category ,
123
- LineNumber = scriptException . LineNumber ,
124
- ColumnNumber = scriptException . ColumnNumber ,
125
- SourceFragment = scriptException . SourceFragment
126
- } ;
124
+ var scriptRuntimeException = ( OriginalJsRuntimeException ) scriptException ;
125
+ hostException = new JsRuntimeException ( scriptRuntimeException . Message ,
126
+ EngineName , _engineVersion , scriptRuntimeException )
127
+ {
128
+ ErrorCode = scriptRuntimeException . ErrorCode ,
129
+ Category = scriptRuntimeException . Category ,
130
+ LineNumber = scriptRuntimeException . LineNumber ,
131
+ ColumnNumber = scriptRuntimeException . ColumnNumber ,
132
+ SourceFragment = scriptRuntimeException . SourceFragment
133
+ } ;
134
+ }
135
+ else if ( scriptException is OriginalJsScriptInterruptedException )
136
+ {
137
+ var scriptInterruptedException = ( OriginalJsScriptInterruptedException ) scriptException ;
138
+ hostException = new JsScriptInterruptedException ( CoreStrings . Runtime_ScriptInterrupted ,
139
+ EngineName , _engineVersion , scriptInterruptedException ) ;
140
+ }
141
+ else
142
+ {
143
+ hostException = new JsException ( scriptException . Message ,
144
+ EngineName , _engineVersion , scriptException ) ;
145
+ }
127
146
128
147
return hostException ;
129
148
}
@@ -145,7 +164,7 @@ protected override object InnerEvaluate(string expression, string documentName)
145
164
{
146
165
result = _jsEngine . Evaluate ( expression , documentName ) ;
147
166
}
148
- catch ( OriginalJsRuntimeException e )
167
+ catch ( OriginalJsException e )
149
168
{
150
169
throw ConvertScriptExceptionToHostException ( e ) ;
151
170
}
@@ -178,7 +197,7 @@ protected override void InnerExecute(string code, string documentName)
178
197
{
179
198
_jsEngine . Execute ( code , documentName ) ;
180
199
}
181
- catch ( OriginalJsRuntimeException e )
200
+ catch ( OriginalJsException e )
182
201
{
183
202
throw ConvertScriptExceptionToHostException ( e ) ;
184
203
}
@@ -202,7 +221,7 @@ protected override object InnerCallFunction(string functionName, params object[]
202
221
{
203
222
result = _jsEngine . CallFunction ( functionName , processedArgs ) ;
204
223
}
205
- catch ( OriginalJsRuntimeException e )
224
+ catch ( OriginalJsException e )
206
225
{
207
226
throw ConvertScriptExceptionToHostException ( e ) ;
208
227
}
@@ -227,7 +246,7 @@ protected override bool InnerHasVariable(string variableName)
227
246
{
228
247
result = _jsEngine . HasVariable ( variableName ) ;
229
248
}
230
- catch ( OriginalJsRuntimeException e )
249
+ catch ( OriginalJsException e )
231
250
{
232
251
throw ConvertScriptExceptionToHostException ( e ) ;
233
252
}
@@ -243,7 +262,7 @@ protected override object InnerGetVariableValue(string variableName)
243
262
{
244
263
result = _jsEngine . GetVariableValue ( variableName ) ;
245
264
}
246
- catch ( OriginalJsRuntimeException e )
265
+ catch ( OriginalJsException e )
247
266
{
248
267
throw ConvertScriptExceptionToHostException ( e ) ;
249
268
}
@@ -268,7 +287,7 @@ protected override void InnerSetVariableValue(string variableName, object value)
268
287
{
269
288
_jsEngine . SetVariableValue ( variableName , processedValue ) ;
270
289
}
271
- catch ( OriginalJsRuntimeException e )
290
+ catch ( OriginalJsException e )
272
291
{
273
292
throw ConvertScriptExceptionToHostException ( e ) ;
274
293
}
@@ -280,7 +299,7 @@ protected override void InnerRemoveVariable(string variableName)
280
299
{
281
300
_jsEngine . RemoveVariable ( variableName ) ;
282
301
}
283
- catch ( OriginalJsRuntimeException e )
302
+ catch ( OriginalJsException e )
284
303
{
285
304
throw ConvertScriptExceptionToHostException ( e ) ;
286
305
}
@@ -294,7 +313,7 @@ protected override void InnerEmbedHostObject(string itemName, object value)
294
313
{
295
314
_jsEngine . EmbedHostObject ( itemName , processedValue ) ;
296
315
}
297
- catch ( OriginalJsRuntimeException e )
316
+ catch ( OriginalJsException e )
298
317
{
299
318
throw ConvertScriptExceptionToHostException ( e ) ;
300
319
}
@@ -306,15 +325,15 @@ protected override void InnerEmbedHostType(string itemName, Type type)
306
325
{
307
326
_jsEngine . EmbedHostType ( itemName , type ) ;
308
327
}
309
- catch ( OriginalJsRuntimeException e )
328
+ catch ( OriginalJsException e )
310
329
{
311
330
throw ConvertScriptExceptionToHostException ( e ) ;
312
331
}
313
332
}
314
333
315
334
protected override void InnerInterrupt ( )
316
335
{
317
- throw new NotImplementedException ( ) ;
336
+ _jsEngine . Interrupt ( ) ;
318
337
}
319
338
320
339
protected override void InnerCollectGarbage ( )
@@ -345,7 +364,7 @@ public override string Version
345
364
/// </summary>
346
365
public override bool SupportsScriptInterruption
347
366
{
348
- get { return false ; }
367
+ get { return true ; }
349
368
}
350
369
351
370
/// <summary>
0 commit comments