NetworkDataTask should check its client before calling shouldCaptureExtraNetworkLoadM...
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Feb 2019 04:57:09 +0000 (04:57 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Feb 2019 04:57:09 +0000 (04:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194732

Reviewed by Geoffrey Garen.

NetworkDataTask may be kept alive if refing it after its NetworkLoad is gone.
This might happen for instance in DownloadManager or when checking for TLS certificates.
In that case, if the NetworkLoad gets destroyed, it clears the client of the NetworkDataTask.
To ensure that NetworkDataTask does not try to use its client, add a null check.

* NetworkProcess/NetworkDataTask.cpp:
(WebKit::NetworkDataTask::shouldCaptureExtraNetworkLoadMetrics const):

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

Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkDataTask.cpp

index 815fd08..8522ca4 100644 (file)
@@ -1,3 +1,18 @@
+2019-02-15  Youenn Fablet  <youenn@apple.com>
+
+        NetworkDataTask should check its client before calling shouldCaptureExtraNetworkLoadMetrics
+        https://bugs.webkit.org/show_bug.cgi?id=194732
+
+        Reviewed by Geoffrey Garen.
+
+        NetworkDataTask may be kept alive if refing it after its NetworkLoad is gone.
+        This might happen for instance in DownloadManager or when checking for TLS certificates.
+        In that case, if the NetworkLoad gets destroyed, it clears the client of the NetworkDataTask.
+        To ensure that NetworkDataTask does not try to use its client, add a null check.
+
+        * NetworkProcess/NetworkDataTask.cpp:
+        (WebKit::NetworkDataTask::shouldCaptureExtraNetworkLoadMetrics const):
+
 2019-02-15  Chris Dumez  <cdumez@apple.com>
 
         [PSON] Allow tweaking WebProcess cache parameters via user defaults
index c69d650..3e5adaf 100644 (file)
@@ -114,7 +114,7 @@ void NetworkDataTask::didReceiveResponse(ResourceResponse&& response, ResponseCo
 
 bool NetworkDataTask::shouldCaptureExtraNetworkLoadMetrics() const
 {
-    return m_client->shouldCaptureExtraNetworkLoadMetrics();
+    return m_client ? m_client->shouldCaptureExtraNetworkLoadMetrics() : false;
 }
 
 void NetworkDataTask::failureTimerFired()