ServiceWorker registration should store any script fetched through importScripts
[WebKit-https.git] / Source / WebCore / workers / service / server / SWServerToContextConnection.cpp
index 3c26172..57ce37d 100644 (file)
@@ -131,6 +131,12 @@ void SWServerToContextConnection::skipWaiting(ServiceWorkerIdentifier serviceWor
     didFinishSkipWaiting(callbackID);
 }
 
+void SWServerToContextConnection::setScriptResource(ServiceWorkerIdentifier serviceWorkerIdentifier, URL&& scriptURL, String&& script, URL&& responseURL, String&& mimeType)
+{
+    if (auto* worker = SWServerWorker::existingWorkerForIdentifier(serviceWorkerIdentifier))
+        worker->setScriptResource(WTFMove(scriptURL), ServiceWorkerContextData::ImportedScript { WTFMove(script), WTFMove(responseURL), WTFMove(mimeType) });
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(SERVICE_WORKER)