Move URL from WebCore to WTF
[WebKit-https.git] / Source / WebCore / workers / WorkerScriptLoader.h
index d688b38..04a41c2 100644 (file)
 
 #pragma once
 
+#include "ContentSecurityPolicyResponseHeaders.h"
+#include "FetchOptions.h"
 #include "ResourceError.h"
 #include "ResourceRequest.h"
 #include "ThreadableLoader.h"
 #include "ThreadableLoaderClient.h"
-#include "URL.h"
 #include <memory>
 #include <wtf/FastMalloc.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
+#include <wtf/URL.h>
 #include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
@@ -52,14 +54,16 @@ public:
         return adoptRef(*new WorkerScriptLoader);
     }
 
-    void loadSynchronously(ScriptExecutionContext*, const URL&, FetchOptions::Mode, FetchOptions::Cache, ContentSecurityPolicyEnforcement, const String& initiatorIdentifier);
-    void loadAsynchronously(ScriptExecutionContext&, ResourceRequest&&, FetchOptions::Mode, FetchOptions::Cache, FetchOptions::Redirect, ContentSecurityPolicyEnforcement, WorkerScriptLoaderClient&);
+    std::optional<Exception> loadSynchronously(ScriptExecutionContext*, const URL&, FetchOptions::Mode, FetchOptions::Cache, ContentSecurityPolicyEnforcement, const String& initiatorIdentifier);
+    void loadAsynchronously(ScriptExecutionContext&, ResourceRequest&&, FetchOptions&&, ContentSecurityPolicyEnforcement, ServiceWorkersMode, WorkerScriptLoaderClient&);
 
     void notifyError();
 
     String script();
+    const ContentSecurityPolicyResponseHeaders& contentSecurityPolicy() const { return m_contentSecurityPolicy; }
     const URL& url() const { return m_url; }
     const URL& responseURL() const;
+    const String& responseMIMEType() const { return m_responseMIMEType; }
     bool failed() const { return m_failed; }
     unsigned long identifier() const { return m_identifier; }
     const ResourceError& error() const { return m_error; }
@@ -69,6 +73,8 @@ public:
     void didFinishLoading(unsigned long identifier) override;
     void didFail(const ResourceError&) override;
 
+    void cancel();
+
 private:
     friend class WTF::RefCounted<WorkerScriptLoader>;
 
@@ -85,6 +91,9 @@ private:
     StringBuilder m_script;
     URL m_url;
     URL m_responseURL;
+    String m_responseMIMEType;
+    FetchOptions::Destination m_destination;
+    ContentSecurityPolicyResponseHeaders m_contentSecurityPolicy;
     unsigned long m_identifier { 0 };
     bool m_failed { false };
     bool m_finishing { false };