Title: [269284] trunk/Source/WebCore
Revision
269284
Author
[email protected]
Date
2020-11-02 19:39:58 -0800 (Mon, 02 Nov 2020)

Log Message

REGRESSION (r269214): ASSERTION FAILED: m_state == CLOSED in WebCore::EventSource::abortConnectionAttempt
https://bugs.webkit.org/show_bug.cgi?id=218457
<rdar://problem/70963581>

Reviewed by Geoffrey Garen.

When EventSource::didFail() gets called with an AccessControl error, it calls abortConnectionAttempt()
which cancels the load (by calling doExplicitLoadCancellation()). The expectation is that cancelling
the load will cause EventSource::didFail() to get called again, this time with a cancellation error,
which will set m_state to CLOSED. We're hitting the assertion because EventSource::didFail() is not
getting called with a cancellation error when the loader is a WorkerThreadableLoader and thus m_state
is not set to CLOSED as expected.

The reason for this is that MainThreadBridge::cancel() would return early and not call
ThreadableLoaderClientWrapper::didFail() if ThreadableLoaderClientWrapper::done() returns true.
ThreadableLoaderClientWrapper::done() returns true when ThreadableLoaderClientWrapper::didFail()
was already called previously, which is what's happening in our test. To address the issue,
MainThreadBridge::cancel() now calls ThreadableLoaderClientWrapper::didFail() no matter what.
This ensures consistency with the DocumentThreadableLoader.

No new tests, covered by existing test crashing on the bots.

* loader/WorkerThreadableLoader.cpp:
(WebCore::WorkerThreadableLoader::MainThreadBridge::cancel):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (269283 => 269284)


--- trunk/Source/WebCore/ChangeLog	2020-11-03 03:21:39 UTC (rev 269283)
+++ trunk/Source/WebCore/ChangeLog	2020-11-03 03:39:58 UTC (rev 269284)
@@ -1,5 +1,32 @@
 2020-11-02  Chris Dumez  <[email protected]>
 
+        REGRESSION (r269214): ASSERTION FAILED: m_state == CLOSED in WebCore::EventSource::abortConnectionAttempt
+        https://bugs.webkit.org/show_bug.cgi?id=218457
+        <rdar://problem/70963581>
+
+        Reviewed by Geoffrey Garen.
+
+        When EventSource::didFail() gets called with an AccessControl error, it calls abortConnectionAttempt()
+        which cancels the load (by calling doExplicitLoadCancellation()). The expectation is that cancelling
+        the load will cause EventSource::didFail() to get called again, this time with a cancellation error,
+        which will set m_state to CLOSED. We're hitting the assertion because EventSource::didFail() is not
+        getting called with a cancellation error when the loader is a WorkerThreadableLoader and thus m_state
+        is not set to CLOSED as expected.
+
+        The reason for this is that MainThreadBridge::cancel() would return early and not call
+        ThreadableLoaderClientWrapper::didFail() if ThreadableLoaderClientWrapper::done() returns true.
+        ThreadableLoaderClientWrapper::done() returns true when ThreadableLoaderClientWrapper::didFail()
+        was already called previously, which is what's happening in our test. To address the issue,
+        MainThreadBridge::cancel() now calls ThreadableLoaderClientWrapper::didFail() no matter what.
+        This ensures consistency with the DocumentThreadableLoader.
+
+        No new tests, covered by existing test crashing on the bots.
+
+        * loader/WorkerThreadableLoader.cpp:
+        (WebCore::WorkerThreadableLoader::MainThreadBridge::cancel):
+
+2020-11-02  Chris Dumez  <[email protected]>
+
         Regression(r269227) imported/w3c/web-platform-tests/service-workers/service-worker/referrer-toplevel-script-fetch.https.html is a flaky crash
         https://bugs.webkit.org/show_bug.cgi?id=218468
         <rdar://problem/70969071>

Modified: trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp (269283 => 269284)


--- trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp	2020-11-03 03:21:39 UTC (rev 269283)
+++ trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp	2020-11-03 03:39:58 UTC (rev 269284)
@@ -176,10 +176,6 @@
         m_mainThreadLoader = nullptr;
     });
 
-    if (m_workerClientWrapper->done()) {
-        clearClientWrapper();
-        return;
-    }
     // Taking a ref of client wrapper as call to didFail may take out the last reference of it.
     Ref<ThreadableLoaderClientWrapper> protectedWorkerClientWrapper(*m_workerClientWrapper);
     // If the client hasn't reached a termination state, then transition it by sending a cancellation error.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to