Make ResourceLoaderOptions derive from FetchOptions
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Jul 2016 17:03:27 +0000 (17:03 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Jul 2016 17:03:27 +0000 (17:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=159345

Patch by Youenn Fablet <youenn@apple.com> on 2016-07-01
Reviewed by Alex Christensen.

No change of behavior.

* Modules/fetch/FetchLoader.cpp:
(WebCore::FetchLoader::start):
* loader/CrossOriginPreflightChecker.cpp:
(WebCore::CrossOriginPreflightChecker::startPreflight):
* loader/ResourceLoaderOptions.h:
(WebCore::ResourceLoaderOptions::fetchOptions): Deleted.
(WebCore::ResourceLoaderOptions::setFetchOptions): Deleted.
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal):
* loader/ThreadableLoader.h: Removing securityOrigin field (left over from https://bugs.webkit.org/show_bug.cgi?id=159221)

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

Source/WebCore/ChangeLog
Source/WebCore/Modules/fetch/FetchLoader.cpp
Source/WebCore/loader/CrossOriginPreflightChecker.cpp
Source/WebCore/loader/ResourceLoaderOptions.h
Source/WebCore/loader/SubresourceLoader.cpp
Source/WebCore/loader/ThreadableLoader.h

index 1208eeb..a6d622b 100644 (file)
@@ -1,3 +1,23 @@
+2016-07-01  Youenn Fablet  <youenn@apple.com>
+
+        Make ResourceLoaderOptions derive from FetchOptions
+        https://bugs.webkit.org/show_bug.cgi?id=159345
+
+        Reviewed by Alex Christensen.
+
+        No change of behavior.
+
+        * Modules/fetch/FetchLoader.cpp:
+        (WebCore::FetchLoader::start):
+        * loader/CrossOriginPreflightChecker.cpp:
+        (WebCore::CrossOriginPreflightChecker::startPreflight):
+        * loader/ResourceLoaderOptions.h:
+        (WebCore::ResourceLoaderOptions::fetchOptions): Deleted.
+        (WebCore::ResourceLoaderOptions::setFetchOptions): Deleted.
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::willSendRequestInternal):
+        * loader/ThreadableLoader.h: Removing securityOrigin field (left over from https://bugs.webkit.org/show_bug.cgi?id=159221)
+
 2016-07-01  Per Arne Vollan  <pvollan@apple.com>
 
         [Win] Animations tests are crashing in debug mode.
index df4a7e7..6e79e54 100644 (file)
@@ -73,7 +73,6 @@ void FetchLoader::start(ScriptExecutionContext& context, Blob& blob)
 
 void FetchLoader::start(ScriptExecutionContext& context, const FetchRequest& request)
 {
-    // FIXME: Compute loading options according fetch options.
     ThreadableLoaderOptions options;
     options.setSendLoadCallbacks(SendCallbacks);
     options.setSniffContent(DoNotSniffContent);
@@ -82,7 +81,9 @@ void FetchLoader::start(ScriptExecutionContext& context, const FetchRequest& req
     options.setAllowCredentials(AllowStoredCredentials);
     options.crossOriginRequestPolicy = DenyCrossOriginRequests;
     options.contentSecurityPolicyEnforcement = ContentSecurityPolicyEnforcement::DoNotEnforce;
-    options.setFetchOptions(request.fetchOptions());
+
+    // FIXME: Pass directly all fetch options to loader options.
+    options.redirect = request.fetchOptions().redirect;
 
     m_loader = ThreadableLoader::create(&context, this, request.internalRequest(), options);
     m_isStarted = m_loader;
index b8f8c30..7ea4d7e 100644 (file)
@@ -109,7 +109,7 @@ void CrossOriginPreflightChecker::startPreflight()
     // Keep buffering the data for the preflight request.
     options.setDataBufferingPolicy(BufferData);
 
-    options.fetchOptions().redirect = FetchOptions::Redirect::Manual;
+    options.redirect = FetchOptions::Redirect::Manual;
 
     CachedResourceRequest preflightRequest(createAccessControlPreflightRequest(m_request, m_loader.securityOrigin()), options);
     if (RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled())
index 1267b31..8578832 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef ResourceLoaderOptions_h
-#define ResourceLoaderOptions_h
+#pragma once
 
 #include "FetchOptions.h"
 #include "ResourceHandleTypes.h"
 
 namespace WebCore {
-    
+
 enum SendCallbackPolicy {
     SendCallbacks,
     DoNotSendCallbacks
@@ -82,7 +81,7 @@ enum class CachingPolicy : uint8_t {
     DisallowCaching
 };
 
-struct ResourceLoaderOptions {
+struct ResourceLoaderOptions : public FetchOptions {
     ResourceLoaderOptions()
         : m_sendLoadCallbacks(DoNotSendCallbacks)
         , m_sniffContent(DoNotSniffContent)
@@ -136,9 +135,6 @@ struct ResourceLoaderOptions {
     void setDefersLoadingPolicy(DefersLoadingPolicy defersLoadingPolicy) { m_defersLoadingPolicy = defersLoadingPolicy; }
     CachingPolicy cachingPolicy() const { return m_cachingPolicy; }
     void setCachingPolicy(CachingPolicy cachingPolicy) { m_cachingPolicy = cachingPolicy; }
-    const FetchOptions& fetchOptions() const { return m_fetchOptions; }
-    FetchOptions& fetchOptions() { return m_fetchOptions; }
-    void setFetchOptions(const FetchOptions& fetchOptions) { m_fetchOptions = fetchOptions; }
 
     unsigned m_sendLoadCallbacks : 1;
     unsigned m_sniffContent : 1;
@@ -152,9 +148,6 @@ struct ResourceLoaderOptions {
     ContentSecurityPolicyImposition m_contentSecurityPolicyImposition { ContentSecurityPolicyImposition::DoPolicyCheck };
     DefersLoadingPolicy m_defersLoadingPolicy { DefersLoadingPolicy::AllowDefersLoading };
     CachingPolicy m_cachingPolicy { CachingPolicy::AllowCaching };
-    FetchOptions m_fetchOptions;
 };
 
-} // namespace WebCore    
-
-#endif // ResourceLoaderOptions_h
+} // namespace WebCore
index d4f7ee0..bd9934d 100644 (file)
@@ -175,8 +175,8 @@ void SubresourceLoader::willSendRequestInternal(ResourceRequest& newRequest, con
 
     ASSERT(!newRequest.isNull());
     if (!redirectResponse.isNull()) {
-        if (options().fetchOptions().redirect != FetchOptions::Redirect::Follow) {
-            if (options().fetchOptions().redirect == FetchOptions::Redirect::Error) {
+        if (options().redirect != FetchOptions::Redirect::Follow) {
+            if (options().redirect == FetchOptions::Redirect::Error) {
                 cancel();
                 return;
             }
index e343ed3..34c07ad 100644 (file)
@@ -73,7 +73,6 @@ namespace WebCore {
         PreflightPolicy preflightPolicy { ConsiderPreflight };
         CrossOriginRequestPolicy crossOriginRequestPolicy { DenyCrossOriginRequests };
         ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement { ContentSecurityPolicyEnforcement::EnforceConnectSrcDirective };
-        RefPtr<SecurityOrigin> securityOrigin;
         String initiator; // This cannot be an AtomicString, as isolatedCopy() wouldn't create an object that's safe for passing to another thread.
     };