@@ -203,11 +203,10 @@ namespace Js
203
203
}
204
204
205
205
// Notify host if current module is dynamically-loaded module, or is root module and the host hasn't been notified
206
- bool isScriptActive = scriptContext->GetThreadContext ()->IsScriptActive ();
207
206
if (this ->promise != nullptr || (isRootModule && !hadNotifyHostReady))
208
207
{
209
208
OUTPUT_TRACE_DEBUGONLY (Js::ModulePhase, _u (" \t >NotifyHostAboutModuleReady %s (ParseSource error)\n " ), this ->GetSpecifierSz ());
210
- LEAVE_SCRIPT_IF (scriptContext, isScriptActive ,
209
+ LEAVE_SCRIPT_IF_ACTIVE (scriptContext,
211
210
{
212
211
scriptContext->GetHostScriptContext ()->NotifyHostAboutModuleReady (this , this ->errorObject );
213
212
});
@@ -295,10 +294,8 @@ namespace Js
295
294
{
296
295
if (!hadNotifyHostReady && !WasEvaluated ())
297
296
{
298
- bool isScriptActive = scriptContext->GetThreadContext ()->IsScriptActive ();
299
-
300
297
OUTPUT_TRACE_DEBUGONLY (Js::ModulePhase, _u (" \t >NotifyHostAboutModuleReady %s (PostProcessDynamicModuleImport)\n " ), this ->GetSpecifierSz ());
301
- LEAVE_SCRIPT_IF (scriptContext, isScriptActive ,
298
+ LEAVE_SCRIPT_IF_ACTIVE (scriptContext,
302
299
{
303
300
hr = scriptContext->GetHostScriptContext ()->NotifyHostAboutModuleReady (this , this ->errorObject );
304
301
});
@@ -341,8 +338,7 @@ namespace Js
341
338
// TODO: move this as a promise call? if parser is called from a different thread
342
339
// We'll need to call the bytecode gen in the main thread as we are accessing GC.
343
340
ScriptContext* scriptContext = GetScriptContext ();
344
- bool isScriptActive = scriptContext->GetThreadContext ()->IsScriptActive ();
345
- Assert (!isScriptActive || this ->promise != nullptr );
341
+ Assert (!scriptContext->GetThreadContext ()->IsScriptActive () || this ->promise != nullptr );
346
342
347
343
if (ModuleDeclarationInstantiation ())
348
344
{
@@ -351,7 +347,7 @@ namespace Js
351
347
if (!hadNotifyHostReady && !WasEvaluated ())
352
348
{
353
349
OUTPUT_TRACE_DEBUGONLY (Js::ModulePhase, _u (" \t >NotifyHostAboutModuleReady %s (PrepareForModuleDeclarationInitialization)\n " ), this ->GetSpecifierSz ());
354
- LEAVE_SCRIPT_IF (scriptContext, isScriptActive ,
350
+ LEAVE_SCRIPT_IF_ACTIVE (scriptContext,
355
351
{
356
352
hr = scriptContext->GetHostScriptContext ()->NotifyHostAboutModuleReady (this , this ->errorObject );
357
353
});
@@ -378,8 +374,6 @@ namespace Js
378
374
OUTPUT_TRACE_DEBUGONLY (Js::ModulePhase, _u (" \t >NotifyParentAsNeeded (childException)\n " ), this ->GetSpecifierSz ());
379
375
NotifyParentsAsNeeded ();
380
376
381
- bool isScriptActive = scriptContext->GetThreadContext ()->IsScriptActive ();
382
-
383
377
if (this ->promise != nullptr )
384
378
{
385
379
SourceTextModuleRecord::ResolveOrRejectDynamicImportPromise (false , this ->errorObject , this ->scriptContext , this );
@@ -388,7 +382,7 @@ namespace Js
388
382
if (this ->promise != nullptr || (isRootModule && !hadNotifyHostReady))
389
383
{
390
384
OUTPUT_TRACE_DEBUGONLY (Js::ModulePhase, _u (" \t >NotifyHostAboutModuleReady %s (OnChildModuleReady)\n " ), this ->GetSpecifierSz ());
391
- LEAVE_SCRIPT_IF (scriptContext, isScriptActive ,
385
+ LEAVE_SCRIPT_IF_ACTIVE (scriptContext,
392
386
{
393
387
hr = scriptContext->GetHostScriptContext ()->NotifyHostAboutModuleReady (this , this ->errorObject );
394
388
});
0 commit comments