Unreviewed, follow-up patch for comments
https://bugs.webkit.org/show_bug.cgi?id=188265

* bindings/js/JSExecState.cpp:
(WebCore::JSExecState::didLeaveScriptContext):
Do nothing if `context` is nullptr. It is OK since we do not need to drain microtasks / rejected
promise events after ScriptExecutionContext is gone.

* dom/Microtasks.cpp:
(WebCore::MicrotaskQueue::contextQueue):
Drop unnecessary assertion since it is subsumed by downcast<>.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@234854 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/bindings/js/JSExecState.cpp b/Source/WebCore/bindings/js/JSExecState.cpp
index 2117776..20dd255 100644
--- a/Source/WebCore/bindings/js/JSExecState.cpp
+++ b/Source/WebCore/bindings/js/JSExecState.cpp
@@ -37,6 +37,8 @@
 void JSExecState::didLeaveScriptContext(JSC::ExecState* exec)
 {
     ScriptExecutionContext* context = scriptExecutionContextFromExecState(exec);
+    if (!context)
+        return;
     MicrotaskQueue::contextQueue(*context).performMicrotaskCheckpoint();
     context->ensureRejectedPromiseTracker().processQueueSoon();
 }