Regression r252209: Layout Test fast/workers/worker-close-more.html is failing
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Nov 2019 18:24:23 +0000 (18:24 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Nov 2019 18:24:23 +0000 (18:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=203995
<rdar://problem/57020558>

Reviewed by Ryosuke Niwa.

We should not dispatch events on a MessagePort objects in a WorkerGlobalScope which is
closing (i.e. WorkerGlobalScope.close() has been called).

No new tests, covered by fast/workers/worker-close-more.html.

* dom/MessagePort.cpp:
(WebCore::MessagePort::dispatchEvent):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252242 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/dom/MessagePort.cpp

index 2564791..4b84c24 100644 (file)
@@ -1,3 +1,19 @@
+2019-11-08  Chris Dumez  <cdumez@apple.com>
+
+        Regression r252209: Layout Test fast/workers/worker-close-more.html is failing
+        https://bugs.webkit.org/show_bug.cgi?id=203995
+        <rdar://problem/57020558>
+
+        Reviewed by Ryosuke Niwa.
+
+        We should not dispatch events on a MessagePort objects in a WorkerGlobalScope which is
+        closing (i.e. WorkerGlobalScope.close() has been called).
+
+        No new tests, covered by fast/workers/worker-close-more.html.
+
+        * dom/MessagePort.cpp:
+        (WebCore::MessagePort::dispatchEvent):
+
 2019-11-08  Peng Liu  <peng.liu6@apple.com>
 
         Picture-in-Picture events are not fired when enter/exit the Picture-in-Picture mode through modern media controls
index 2444949..d43b262 100644 (file)
@@ -288,6 +288,9 @@ void MessagePort::dispatchEvent(Event& event)
     if (m_closed)
         return;
 
+    if (is<WorkerGlobalScope>(*m_scriptExecutionContext) && downcast<WorkerGlobalScope>(*m_scriptExecutionContext).isClosing())
+        return;
+
     EventTarget::dispatchEvent(event);
 }