Diff
Modified: trunk/Source/WebCore/ChangeLog (202613 => 202614)
--- trunk/Source/WebCore/ChangeLog 2016-06-29 05:55:37 UTC (rev 202613)
+++ trunk/Source/WebCore/ChangeLog 2016-06-29 06:25:59 UTC (rev 202614)
@@ -1,3 +1,34 @@
+2016-06-28 Youenn Fablet <[email protected]>
+
+ Remove ThreadableLoaderOptions origin
+ https://bugs.webkit.org/show_bug.cgi?id=159221
+
+ Reviewed by Sam Weinig.
+
+ No change of behavior.
+
+ * loader/DocumentThreadableLoader.cpp:
+ (WebCore::DocumentThreadableLoader::loadResourceSynchronously): Adding origing parameter.
+ (WebCore::DocumentThreadableLoader::create): Ditto.
+ (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Ditto.
+ (WebCore::DocumentThreadableLoader::redirectReceived): Setting m_origin.
+ (WebCore::DocumentThreadableLoader::securityOrigin): Checking m_origin.
+ * loader/DocumentThreadableLoader.h: Adding m_origin member.
+ * loader/ThreadableLoader.cpp:
+ (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions): Removing origin.
+ (WebCore::ThreadableLoaderOption::isolatedCopy): Deleted.
+ * loader/ThreadableLoader.h: Removing origin parameter and isolatedCopy function.
+ * loader/WorkerThreadableLoader.cpp:
+ (WebCore::LoaderTaskOptions::LoaderTaskOptions): Structure to pass loader task options from one thread to another.
+ (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
+ * page/EventSource.cpp:
+ (WebCore::EventSource::connect): Removing setting of the origin.
+ * workers/WorkerScriptLoader.cpp:
+ (WebCore::WorkerScriptLoader::loadSynchronously): Ditto.
+ (WebCore::WorkerScriptLoader::loadAsynchronously): Ditto.
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::XMLHttpRequest::createRequest): Ditto.
+
2016-06-28 Commit Queue <[email protected]>
Unreviewed, rolling out r202580.
Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp (202613 => 202614)
--- trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp 2016-06-29 05:55:37 UTC (rev 202613)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp 2016-06-29 06:25:59 UTC (rev 202614)
@@ -56,21 +56,21 @@
namespace WebCore {
-void DocumentThreadableLoader::loadResourceSynchronously(Document& document, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options, std::unique_ptr<ContentSecurityPolicy>&& contentSecurityPolicy)
+void DocumentThreadableLoader::loadResourceSynchronously(Document& document, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options, RefPtr<SecurityOrigin>&& origin, std::unique_ptr<ContentSecurityPolicy>&& contentSecurityPolicy)
{
// The loader will be deleted as soon as this function exits.
- RefPtr<DocumentThreadableLoader> loader = adoptRef(new DocumentThreadableLoader(document, client, LoadSynchronously, request, options, WTFMove(contentSecurityPolicy)));
+ RefPtr<DocumentThreadableLoader> loader = adoptRef(new DocumentThreadableLoader(document, client, LoadSynchronously, request, options, WTFMove(origin), WTFMove(contentSecurityPolicy)));
ASSERT(loader->hasOneRef());
}
void DocumentThreadableLoader::loadResourceSynchronously(Document& document, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options)
{
- loadResourceSynchronously(document, request, client, options, nullptr);
+ loadResourceSynchronously(document, request, client, options, nullptr, nullptr);
}
-RefPtr<DocumentThreadableLoader> DocumentThreadableLoader::create(Document& document, ThreadableLoaderClient& client, const ResourceRequest& request, const ThreadableLoaderOptions& options, std::unique_ptr<ContentSecurityPolicy>&& contentSecurityPolicy)
+RefPtr<DocumentThreadableLoader> DocumentThreadableLoader::create(Document& document, ThreadableLoaderClient& client, const ResourceRequest& request, const ThreadableLoaderOptions& options, RefPtr<SecurityOrigin>&& origin, std::unique_ptr<ContentSecurityPolicy>&& contentSecurityPolicy)
{
- RefPtr<DocumentThreadableLoader> loader = adoptRef(new DocumentThreadableLoader(document, client, LoadAsynchronously, request, options, WTFMove(contentSecurityPolicy)));
+ RefPtr<DocumentThreadableLoader> loader = adoptRef(new DocumentThreadableLoader(document, client, LoadAsynchronously, request, options, WTFMove(origin), WTFMove(contentSecurityPolicy)));
if (!loader->isLoading())
loader = nullptr;
return loader;
@@ -78,13 +78,14 @@
RefPtr<DocumentThreadableLoader> DocumentThreadableLoader::create(Document& document, ThreadableLoaderClient& client, const ResourceRequest& request, const ThreadableLoaderOptions& options)
{
- return create(document, client, request, options, nullptr);
+ return create(document, client, request, options, nullptr, nullptr);
}
-DocumentThreadableLoader::DocumentThreadableLoader(Document& document, ThreadableLoaderClient& client, BlockingBehavior blockingBehavior, const ResourceRequest& request, const ThreadableLoaderOptions& options, std::unique_ptr<ContentSecurityPolicy>&& contentSecurityPolicy)
+DocumentThreadableLoader::DocumentThreadableLoader(Document& document, ThreadableLoaderClient& client, BlockingBehavior blockingBehavior, const ResourceRequest& request, const ThreadableLoaderOptions& options, RefPtr<SecurityOrigin>&& origin, std::unique_ptr<ContentSecurityPolicy>&& contentSecurityPolicy)
: m_client(&client)
, m_document(document)
, m_options(options)
+ , m_origin(WTFMove(origin))
, m_sameOriginRequest(securityOrigin()->canRequest(request.url()))
, m_simpleRequest(true)
, m_async(blockingBehavior == LoadAsynchronously)
@@ -239,7 +240,7 @@
// set the source origin to a globally unique identifier. (If the original request was same-origin, the origin of the new request
// should be the original URL origin.)
if (!m_sameOriginRequest && !originalOrigin->isSameSchemeHostPort(requestOrigin.get()))
- m_options.securityOrigin = SecurityOrigin::createUnique();
+ m_origin = SecurityOrigin::createUnique();
// Force any subsequent request to use these checks.
m_sameOriginRequest = false;
@@ -444,7 +445,7 @@
SecurityOrigin* DocumentThreadableLoader::securityOrigin() const
{
- return m_options.securityOrigin ? m_options.securityOrigin.get() : m_document.securityOrigin();
+ return m_origin ? m_origin.get() : m_document.securityOrigin();
}
const ContentSecurityPolicy& DocumentThreadableLoader::contentSecurityPolicy() const
Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.h (202613 => 202614)
--- trunk/Source/WebCore/loader/DocumentThreadableLoader.h 2016-06-29 05:55:37 UTC (rev 202613)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.h 2016-06-29 06:25:59 UTC (rev 202614)
@@ -32,6 +32,7 @@
#define DocumentThreadableLoader_h
#include "CrossOriginPreflightChecker.h"
+#include "SecurityOrigin.h"
#include "ThreadableLoader.h"
namespace WebCore {
@@ -38,16 +39,15 @@
class CachedRawResource;
class ContentSecurityPolicy;
class Document;
- class SecurityOrigin;
class ThreadableLoaderClient;
class DocumentThreadableLoader : public RefCounted<DocumentThreadableLoader>, public ThreadableLoader, private CachedRawResourceClient {
WTF_MAKE_FAST_ALLOCATED;
public:
- static void loadResourceSynchronously(Document&, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, std::unique_ptr<ContentSecurityPolicy>&&);
+ static void loadResourceSynchronously(Document&, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, RefPtr<SecurityOrigin>&&, std::unique_ptr<ContentSecurityPolicy>&&);
static void loadResourceSynchronously(Document&, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&);
- static RefPtr<DocumentThreadableLoader> create(Document&, ThreadableLoaderClient&, const ResourceRequest&, const ThreadableLoaderOptions&, std::unique_ptr<ContentSecurityPolicy>&&);
+ static RefPtr<DocumentThreadableLoader> create(Document&, ThreadableLoaderClient&, const ResourceRequest&, const ThreadableLoaderOptions&, RefPtr<SecurityOrigin>&&, std::unique_ptr<ContentSecurityPolicy>&&);
static RefPtr<DocumentThreadableLoader> create(Document&, ThreadableLoaderClient&, const ResourceRequest&, const ThreadableLoaderOptions&);
virtual ~DocumentThreadableLoader();
@@ -70,7 +70,7 @@
LoadAsynchronously
};
- DocumentThreadableLoader(Document&, ThreadableLoaderClient&, BlockingBehavior, const ResourceRequest&, const ThreadableLoaderOptions&, std::unique_ptr<ContentSecurityPolicy>&&);
+ DocumentThreadableLoader(Document&, ThreadableLoaderClient&, BlockingBehavior, const ResourceRequest&, const ThreadableLoaderOptions&, RefPtr<SecurityOrigin>&&, std::unique_ptr<ContentSecurityPolicy>&&);
void clearResource();
@@ -108,6 +108,7 @@
ThreadableLoaderClient* m_client;
Document& m_document;
ThreadableLoaderOptions m_options;
+ RefPtr<SecurityOrigin> m_origin;
bool m_sameOriginRequest;
bool m_simpleRequest;
bool m_async;
Modified: trunk/Source/WebCore/loader/ThreadableLoader.cpp (202613 => 202614)
--- trunk/Source/WebCore/loader/ThreadableLoader.cpp 2016-06-29 05:55:37 UTC (rev 202613)
+++ trunk/Source/WebCore/loader/ThreadableLoader.cpp 2016-06-29 06:25:59 UTC (rev 202614)
@@ -49,24 +49,15 @@
{
}
-ThreadableLoaderOptions::ThreadableLoaderOptions(const ResourceLoaderOptions& baseOptions, PreflightPolicy preflightPolicy, CrossOriginRequestPolicy crossOriginRequestPolicy, ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement, RefPtr<SecurityOrigin>&& securityOrigin, String&& initiator)
+ThreadableLoaderOptions::ThreadableLoaderOptions(const ResourceLoaderOptions& baseOptions, PreflightPolicy preflightPolicy, CrossOriginRequestPolicy crossOriginRequestPolicy, ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement, String&& initiator)
: ResourceLoaderOptions(baseOptions)
, preflightPolicy(preflightPolicy)
, crossOriginRequestPolicy(crossOriginRequestPolicy)
, contentSecurityPolicyEnforcement(contentSecurityPolicyEnforcement)
- , securityOrigin(WTFMove(securityOrigin))
, initiator(WTFMove(initiator))
{
}
-std::unique_ptr<ThreadableLoaderOptions> ThreadableLoaderOptions::isolatedCopy() const
-{
- RefPtr<SecurityOrigin> securityOriginCopy;
- if (securityOrigin)
- securityOriginCopy = securityOrigin->isolatedCopy();
- return std::make_unique<ThreadableLoaderOptions>(*this, preflightPolicy, crossOriginRequestPolicy, contentSecurityPolicyEnforcement, WTFMove(securityOriginCopy), initiator.isolatedCopy());
-}
-
RefPtr<ThreadableLoader> ThreadableLoader::create(ScriptExecutionContext* context, ThreadableLoaderClient* client, const ResourceRequest& request, const ThreadableLoaderOptions& options)
{
ASSERT(client);
Modified: trunk/Source/WebCore/loader/ThreadableLoader.h (202613 => 202614)
--- trunk/Source/WebCore/loader/ThreadableLoader.h 2016-06-29 05:55:37 UTC (rev 202613)
+++ trunk/Source/WebCore/loader/ThreadableLoader.h 2016-06-29 06:25:59 UTC (rev 202614)
@@ -67,11 +67,9 @@
struct ThreadableLoaderOptions : ResourceLoaderOptions {
ThreadableLoaderOptions();
- ThreadableLoaderOptions(const ResourceLoaderOptions&, PreflightPolicy, CrossOriginRequestPolicy, ContentSecurityPolicyEnforcement, RefPtr<SecurityOrigin>&&, String&& initiator);
+ ThreadableLoaderOptions(const ResourceLoaderOptions&, PreflightPolicy, CrossOriginRequestPolicy, ContentSecurityPolicyEnforcement, String&& initiator);
~ThreadableLoaderOptions();
- std::unique_ptr<ThreadableLoaderOptions> isolatedCopy() const;
-
PreflightPolicy preflightPolicy { ConsiderPreflight };
CrossOriginRequestPolicy crossOriginRequestPolicy { DenyCrossOriginRequests };
ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement { ContentSecurityPolicyEnforcement::EnforceConnectSrcDirective };
Modified: trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp (202613 => 202614)
--- trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp 2016-06-29 05:55:37 UTC (rev 202613)
+++ trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp 2016-06-29 06:25:59 UTC (rev 202614)
@@ -83,6 +83,20 @@
m_bridge.cancel();
}
+struct LoaderTaskOptions {
+ LoaderTaskOptions(const ThreadableLoaderOptions&, const String&, const SecurityOrigin&);
+ ThreadableLoaderOptions options;
+ String referrer;
+ RefPtr<SecurityOrigin> origin;
+};
+
+LoaderTaskOptions::LoaderTaskOptions(const ThreadableLoaderOptions& options, const String& referrer, const SecurityOrigin& origin)
+ : options(options, options.preflightPolicy, options.crossOriginRequestPolicy, options.contentSecurityPolicyEnforcement, options.initiator.isolatedCopy())
+ , referrer(referrer.isolatedCopy())
+ , origin(origin.isolatedCopy())
+{
+}
+
WorkerThreadableLoader::MainThreadBridge::MainThreadBridge(ThreadableLoaderClientWrapper& workerClientWrapper, WorkerLoaderProxy& loaderProxy, const String& taskMode,
const ResourceRequest& request, const ThreadableLoaderOptions& options, const String& outgoingReferrer,
const SecurityOrigin* securityOrigin, const ContentSecurityPolicy* contentSecurityPolicy)
@@ -96,16 +110,17 @@
auto contentSecurityPolicyCopy = std::make_unique<ContentSecurityPolicy>(*securityOrigin);
contentSecurityPolicyCopy->copyStateFrom(contentSecurityPolicy);
- m_loaderProxy.postTaskToLoader([this, request = request.isolatedCopy(), options = options.isolatedCopy(), contentSecurityPolicyCopy = WTFMove(contentSecurityPolicyCopy), outgoingReferrer = outgoingReferrer.isolatedCopy()](ScriptExecutionContext& context) mutable {
+ auto optionsCopy = std::make_unique<LoaderTaskOptions>(options, outgoingReferrer, *securityOrigin);
+
+ m_loaderProxy.postTaskToLoader([this, request = request.isolatedCopy(), options = WTFMove(optionsCopy), contentSecurityPolicyCopy = WTFMove(contentSecurityPolicyCopy)](ScriptExecutionContext& context) mutable {
ASSERT(isMainThread());
Document& document = downcast<Document>(context);
- request.setHTTPReferrer(outgoingReferrer);
+ request.setHTTPReferrer(options->referrer);
- // FIXME: If the a site requests a local resource, then this will return a non-zero value but the sync path
- // will return a 0 value. Either this should return 0 or the other code path should do a callback with
- // a failure.
- m_mainThreadLoader = DocumentThreadableLoader::create(document, *this, request, *options, WTFMove(contentSecurityPolicyCopy));
+ // FIXME: If the site requests a local resource, then this will return a non-zero value but the sync path will return a 0 value.
+ // Either this should return 0 or the other code path should call a failure callback.
+ m_mainThreadLoader = DocumentThreadableLoader::create(document, *this, request, options->options, WTFMove(options->origin), WTFMove(contentSecurityPolicyCopy));
ASSERT(m_mainThreadLoader || m_loadingFinished);
});
}
Modified: trunk/Source/WebCore/page/EventSource.cpp (202613 => 202614)
--- trunk/Source/WebCore/page/EventSource.cpp 2016-06-29 05:55:37 UTC (rev 202613)
+++ trunk/Source/WebCore/page/EventSource.cpp 2016-06-29 06:25:59 UTC (rev 202614)
@@ -113,7 +113,6 @@
options.preflightPolicy = PreventPreflight;
options.crossOriginRequestPolicy = UseAccessControl;
options.setDataBufferingPolicy(DoNotBufferData);
- options.securityOrigin = &origin;
options.contentSecurityPolicyEnforcement = scriptExecutionContext()->shouldBypassMainWorldContentSecurityPolicy() ? ContentSecurityPolicyEnforcement::DoNotEnforce : ContentSecurityPolicyEnforcement::EnforceConnectSrcDirective;
m_loader = ThreadableLoader::create(scriptExecutionContext(), this, request, options);
Modified: trunk/Source/WebCore/workers/WorkerScriptLoader.cpp (202613 => 202614)
--- trunk/Source/WebCore/workers/WorkerScriptLoader.cpp 2016-06-29 05:55:37 UTC (rev 202613)
+++ trunk/Source/WebCore/workers/WorkerScriptLoader.cpp 2016-06-29 06:25:59 UTC (rev 202614)
@@ -68,12 +68,11 @@
options.setAllowCredentials(AllowStoredCredentials);
options.crossOriginRequestPolicy = crossOriginRequestPolicy;
options.setSendLoadCallbacks(SendCallbacks);
- options.securityOrigin = scriptExecutionContext->securityOrigin();
options.contentSecurityPolicyEnforcement = contentSecurityPolicyEnforcement;
WorkerThreadableLoader::loadResourceSynchronously(downcast<WorkerGlobalScope>(scriptExecutionContext), *request, *this, options);
}
-
+
void WorkerScriptLoader::loadAsynchronously(ScriptExecutionContext* scriptExecutionContext, const URL& url, CrossOriginRequestPolicy crossOriginRequestPolicy, ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement, WorkerScriptLoaderClient* client)
{
ASSERT(client);
@@ -88,7 +87,6 @@
options.setAllowCredentials(AllowStoredCredentials);
options.crossOriginRequestPolicy = crossOriginRequestPolicy;
options.setSendLoadCallbacks(SendCallbacks);
- options.securityOrigin = scriptExecutionContext->securityOrigin();
options.contentSecurityPolicyEnforcement = contentSecurityPolicyEnforcement;
// During create, callbacks may happen which remove the last reference to this object.
Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (202613 => 202614)
--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2016-06-29 05:55:37 UTC (rev 202613)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2016-06-29 06:25:59 UTC (rev 202614)
@@ -715,7 +715,6 @@
options.setAllowCredentials((m_sameOriginRequest || m_includeCredentials) ? AllowStoredCredentials : DoNotAllowStoredCredentials);
options.setCredentialRequest(m_includeCredentials ? ClientRequestedCredentials : ClientDidNotRequestCredentials);
options.crossOriginRequestPolicy = UseAccessControl;
- options.securityOrigin = securityOrigin();
options.contentSecurityPolicyEnforcement = scriptExecutionContext()->shouldBypassMainWorldContentSecurityPolicy() ? ContentSecurityPolicyEnforcement::DoNotEnforce : ContentSecurityPolicyEnforcement::EnforceConnectSrcDirective;
options.initiator = cachedResourceRequestInitiators().xmlhttprequest;