Avoid crashes on GCC-compiled binaries by avoiding a use-after-move
that's the result of differring call conventions.

Rubber-stamped by Carlos Garcia Campos.

* NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::startFetch): Copy the SW identifier from
the ServiceWorkerFetchTask before it's moved into the lambda.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@251278 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog
index 41a2680..f9e6505 100644
--- a/Source/WebKit/ChangeLog
+++ b/Source/WebKit/ChangeLog
@@ -1,3 +1,14 @@
+2019-10-18  Zan Dobersek  <zdobersek@igalia.com>
+
+        Avoid crashes on GCC-compiled binaries by avoiding a use-after-move
+        that's the result of differring call conventions.
+
+        Rubber-stamped by Carlos Garcia Campos.
+
+        * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
+        (WebKit::WebSWServerConnection::startFetch): Copy the SW identifier from
+        the ServiceWorkerFetchTask before it's moved into the lambda.
+
 2019-10-17  Mark Lam  <mark.lam@apple.com>
 
         Use constexpr in more places and remove some unnecessary external linkage.
diff --git a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp
index c6b7258..a190864 100644
--- a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp
+++ b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp
@@ -186,7 +186,8 @@
         if (!worker->contextConnection())
             server().createContextConnection(worker->registrableDomain());
 
-        server().runServiceWorkerIfNecessary(task->serviceWorkerIdentifier(), [weakThis = WTFMove(weakThis), this, task = WTFMove(task)](auto* contextConnection) mutable {
+        auto identifier = task->serviceWorkerIdentifier();
+        server().runServiceWorkerIfNecessary(identifier, [weakThis = WTFMove(weakThis), this, task = WTFMove(task)](auto* contextConnection) mutable {
             if (!task)
                 return;