Changeset 202614 in webkit
- Timestamp:
- Jun 28, 2016 11:25:59 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r202611 r202614 1 2016-06-28 Youenn Fablet <youennf@gmail.com> 2 3 Remove ThreadableLoaderOptions origin 4 https://bugs.webkit.org/show_bug.cgi?id=159221 5 6 Reviewed by Sam Weinig. 7 8 No change of behavior. 9 10 * loader/DocumentThreadableLoader.cpp: 11 (WebCore::DocumentThreadableLoader::loadResourceSynchronously): Adding origing parameter. 12 (WebCore::DocumentThreadableLoader::create): Ditto. 13 (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Ditto. 14 (WebCore::DocumentThreadableLoader::redirectReceived): Setting m_origin. 15 (WebCore::DocumentThreadableLoader::securityOrigin): Checking m_origin. 16 * loader/DocumentThreadableLoader.h: Adding m_origin member. 17 * loader/ThreadableLoader.cpp: 18 (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions): Removing origin. 19 (WebCore::ThreadableLoaderOption::isolatedCopy): Deleted. 20 * loader/ThreadableLoader.h: Removing origin parameter and isolatedCopy function. 21 * loader/WorkerThreadableLoader.cpp: 22 (WebCore::LoaderTaskOptions::LoaderTaskOptions): Structure to pass loader task options from one thread to another. 23 (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge): 24 * page/EventSource.cpp: 25 (WebCore::EventSource::connect): Removing setting of the origin. 26 * workers/WorkerScriptLoader.cpp: 27 (WebCore::WorkerScriptLoader::loadSynchronously): Ditto. 28 (WebCore::WorkerScriptLoader::loadAsynchronously): Ditto. 29 * xml/XMLHttpRequest.cpp: 30 (WebCore::XMLHttpRequest::createRequest): Ditto. 31 1 32 2016-06-28 Commit Queue <commit-queue@webkit.org> 2 33 -
trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp
r202542 r202614 57 57 namespace WebCore { 58 58 59 void DocumentThreadableLoader::loadResourceSynchronously(Document& document, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options, std::unique_ptr<ContentSecurityPolicy>&& contentSecurityPolicy)59 void DocumentThreadableLoader::loadResourceSynchronously(Document& document, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options, RefPtr<SecurityOrigin>&& origin, std::unique_ptr<ContentSecurityPolicy>&& contentSecurityPolicy) 60 60 { 61 61 // The loader will be deleted as soon as this function exits. 62 RefPtr<DocumentThreadableLoader> loader = adoptRef(new DocumentThreadableLoader(document, client, LoadSynchronously, request, options, WTFMove( contentSecurityPolicy)));62 RefPtr<DocumentThreadableLoader> loader = adoptRef(new DocumentThreadableLoader(document, client, LoadSynchronously, request, options, WTFMove(origin), WTFMove(contentSecurityPolicy))); 63 63 ASSERT(loader->hasOneRef()); 64 64 } … … 66 66 void DocumentThreadableLoader::loadResourceSynchronously(Document& document, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options) 67 67 { 68 loadResourceSynchronously(document, request, client, options, nullptr );69 } 70 71 RefPtr<DocumentThreadableLoader> DocumentThreadableLoader::create(Document& document, ThreadableLoaderClient& client, const ResourceRequest& request, const ThreadableLoaderOptions& options, std::unique_ptr<ContentSecurityPolicy>&& contentSecurityPolicy)72 { 73 RefPtr<DocumentThreadableLoader> loader = adoptRef(new DocumentThreadableLoader(document, client, LoadAsynchronously, request, options, WTFMove( contentSecurityPolicy)));68 loadResourceSynchronously(document, request, client, options, nullptr, nullptr); 69 } 70 71 RefPtr<DocumentThreadableLoader> DocumentThreadableLoader::create(Document& document, ThreadableLoaderClient& client, const ResourceRequest& request, const ThreadableLoaderOptions& options, RefPtr<SecurityOrigin>&& origin, std::unique_ptr<ContentSecurityPolicy>&& contentSecurityPolicy) 72 { 73 RefPtr<DocumentThreadableLoader> loader = adoptRef(new DocumentThreadableLoader(document, client, LoadAsynchronously, request, options, WTFMove(origin), WTFMove(contentSecurityPolicy))); 74 74 if (!loader->isLoading()) 75 75 loader = nullptr; … … 79 79 RefPtr<DocumentThreadableLoader> DocumentThreadableLoader::create(Document& document, ThreadableLoaderClient& client, const ResourceRequest& request, const ThreadableLoaderOptions& options) 80 80 { 81 return create(document, client, request, options, nullptr );82 } 83 84 DocumentThreadableLoader::DocumentThreadableLoader(Document& document, ThreadableLoaderClient& client, BlockingBehavior blockingBehavior, const ResourceRequest& request, const ThreadableLoaderOptions& options, std::unique_ptr<ContentSecurityPolicy>&& contentSecurityPolicy)81 return create(document, client, request, options, nullptr, nullptr); 82 } 83 84 DocumentThreadableLoader::DocumentThreadableLoader(Document& document, ThreadableLoaderClient& client, BlockingBehavior blockingBehavior, const ResourceRequest& request, const ThreadableLoaderOptions& options, RefPtr<SecurityOrigin>&& origin, std::unique_ptr<ContentSecurityPolicy>&& contentSecurityPolicy) 85 85 : m_client(&client) 86 86 , m_document(document) 87 87 , m_options(options) 88 , m_origin(WTFMove(origin)) 88 89 , m_sameOriginRequest(securityOrigin()->canRequest(request.url())) 89 90 , m_simpleRequest(true) … … 240 241 // should be the original URL origin.) 241 242 if (!m_sameOriginRequest && !originalOrigin->isSameSchemeHostPort(requestOrigin.get())) 242 m_o ptions.securityOrigin = SecurityOrigin::createUnique();243 m_origin = SecurityOrigin::createUnique(); 243 244 // Force any subsequent request to use these checks. 244 245 m_sameOriginRequest = false; … … 445 446 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const 446 447 { 447 return m_o ptions.securityOrigin ? m_options.securityOrigin.get() : m_document.securityOrigin();448 return m_origin ? m_origin.get() : m_document.securityOrigin(); 448 449 } 449 450 -
trunk/Source/WebCore/loader/DocumentThreadableLoader.h
r201924 r202614 33 33 34 34 #include "CrossOriginPreflightChecker.h" 35 #include "SecurityOrigin.h" 35 36 #include "ThreadableLoader.h" 36 37 … … 39 40 class ContentSecurityPolicy; 40 41 class Document; 41 class SecurityOrigin;42 42 class ThreadableLoaderClient; 43 43 … … 45 45 WTF_MAKE_FAST_ALLOCATED; 46 46 public: 47 static void loadResourceSynchronously(Document&, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, std::unique_ptr<ContentSecurityPolicy>&&);47 static void loadResourceSynchronously(Document&, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, RefPtr<SecurityOrigin>&&, std::unique_ptr<ContentSecurityPolicy>&&); 48 48 static void loadResourceSynchronously(Document&, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); 49 49 50 static RefPtr<DocumentThreadableLoader> create(Document&, ThreadableLoaderClient&, const ResourceRequest&, const ThreadableLoaderOptions&, std::unique_ptr<ContentSecurityPolicy>&&);50 static RefPtr<DocumentThreadableLoader> create(Document&, ThreadableLoaderClient&, const ResourceRequest&, const ThreadableLoaderOptions&, RefPtr<SecurityOrigin>&&, std::unique_ptr<ContentSecurityPolicy>&&); 51 51 static RefPtr<DocumentThreadableLoader> create(Document&, ThreadableLoaderClient&, const ResourceRequest&, const ThreadableLoaderOptions&); 52 52 … … 71 71 }; 72 72 73 DocumentThreadableLoader(Document&, ThreadableLoaderClient&, BlockingBehavior, const ResourceRequest&, const ThreadableLoaderOptions&, std::unique_ptr<ContentSecurityPolicy>&&);73 DocumentThreadableLoader(Document&, ThreadableLoaderClient&, BlockingBehavior, const ResourceRequest&, const ThreadableLoaderOptions&, RefPtr<SecurityOrigin>&&, std::unique_ptr<ContentSecurityPolicy>&&); 74 74 75 75 void clearResource(); … … 109 109 Document& m_document; 110 110 ThreadableLoaderOptions m_options; 111 RefPtr<SecurityOrigin> m_origin; 111 112 bool m_sameOriginRequest; 112 113 bool m_simpleRequest; -
trunk/Source/WebCore/loader/ThreadableLoader.cpp
r201324 r202614 50 50 } 51 51 52 ThreadableLoaderOptions::ThreadableLoaderOptions(const ResourceLoaderOptions& baseOptions, PreflightPolicy preflightPolicy, CrossOriginRequestPolicy crossOriginRequestPolicy, ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement, RefPtr<SecurityOrigin>&& securityOrigin,String&& initiator)52 ThreadableLoaderOptions::ThreadableLoaderOptions(const ResourceLoaderOptions& baseOptions, PreflightPolicy preflightPolicy, CrossOriginRequestPolicy crossOriginRequestPolicy, ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement, String&& initiator) 53 53 : ResourceLoaderOptions(baseOptions) 54 54 , preflightPolicy(preflightPolicy) 55 55 , crossOriginRequestPolicy(crossOriginRequestPolicy) 56 56 , contentSecurityPolicyEnforcement(contentSecurityPolicyEnforcement) 57 , securityOrigin(WTFMove(securityOrigin))58 57 , initiator(WTFMove(initiator)) 59 58 { 60 }61 62 std::unique_ptr<ThreadableLoaderOptions> ThreadableLoaderOptions::isolatedCopy() const63 {64 RefPtr<SecurityOrigin> securityOriginCopy;65 if (securityOrigin)66 securityOriginCopy = securityOrigin->isolatedCopy();67 return std::make_unique<ThreadableLoaderOptions>(*this, preflightPolicy, crossOriginRequestPolicy, contentSecurityPolicyEnforcement, WTFMove(securityOriginCopy), initiator.isolatedCopy());68 59 } 69 60 -
trunk/Source/WebCore/loader/ThreadableLoader.h
r201324 r202614 68 68 struct ThreadableLoaderOptions : ResourceLoaderOptions { 69 69 ThreadableLoaderOptions(); 70 ThreadableLoaderOptions(const ResourceLoaderOptions&, PreflightPolicy, CrossOriginRequestPolicy, ContentSecurityPolicyEnforcement, RefPtr<SecurityOrigin>&&,String&& initiator);70 ThreadableLoaderOptions(const ResourceLoaderOptions&, PreflightPolicy, CrossOriginRequestPolicy, ContentSecurityPolicyEnforcement, String&& initiator); 71 71 ~ThreadableLoaderOptions(); 72 73 std::unique_ptr<ThreadableLoaderOptions> isolatedCopy() const;74 72 75 73 PreflightPolicy preflightPolicy { ConsiderPreflight }; -
trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp
r202542 r202614 84 84 } 85 85 86 struct LoaderTaskOptions { 87 LoaderTaskOptions(const ThreadableLoaderOptions&, const String&, const SecurityOrigin&); 88 ThreadableLoaderOptions options; 89 String referrer; 90 RefPtr<SecurityOrigin> origin; 91 }; 92 93 LoaderTaskOptions::LoaderTaskOptions(const ThreadableLoaderOptions& options, const String& referrer, const SecurityOrigin& origin) 94 : options(options, options.preflightPolicy, options.crossOriginRequestPolicy, options.contentSecurityPolicyEnforcement, options.initiator.isolatedCopy()) 95 , referrer(referrer.isolatedCopy()) 96 , origin(origin.isolatedCopy()) 97 { 98 } 99 86 100 WorkerThreadableLoader::MainThreadBridge::MainThreadBridge(ThreadableLoaderClientWrapper& workerClientWrapper, WorkerLoaderProxy& loaderProxy, const String& taskMode, 87 101 const ResourceRequest& request, const ThreadableLoaderOptions& options, const String& outgoingReferrer, … … 97 111 contentSecurityPolicyCopy->copyStateFrom(contentSecurityPolicy); 98 112 99 m_loaderProxy.postTaskToLoader([this, request = request.isolatedCopy(), options = options.isolatedCopy(), contentSecurityPolicyCopy = WTFMove(contentSecurityPolicyCopy), outgoingReferrer = outgoingReferrer.isolatedCopy()](ScriptExecutionContext& context) mutable { 113 auto optionsCopy = std::make_unique<LoaderTaskOptions>(options, outgoingReferrer, *securityOrigin); 114 115 m_loaderProxy.postTaskToLoader([this, request = request.isolatedCopy(), options = WTFMove(optionsCopy), contentSecurityPolicyCopy = WTFMove(contentSecurityPolicyCopy)](ScriptExecutionContext& context) mutable { 100 116 ASSERT(isMainThread()); 101 117 Document& document = downcast<Document>(context); 102 118 103 request.setHTTPReferrer(outgoingReferrer); 104 105 // FIXME: If the a site requests a local resource, then this will return a non-zero value but the sync path 106 // will return a 0 value. Either this should return 0 or the other code path should do a callback with 107 // a failure. 108 m_mainThreadLoader = DocumentThreadableLoader::create(document, *this, request, *options, WTFMove(contentSecurityPolicyCopy)); 119 request.setHTTPReferrer(options->referrer); 120 121 // 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. 122 // Either this should return 0 or the other code path should call a failure callback. 123 m_mainThreadLoader = DocumentThreadableLoader::create(document, *this, request, options->options, WTFMove(options->origin), WTFMove(contentSecurityPolicyCopy)); 109 124 ASSERT(m_mainThreadLoader || m_loadingFinished); 110 125 }); -
trunk/Source/WebCore/page/EventSource.cpp
r202542 r202614 114 114 options.crossOriginRequestPolicy = UseAccessControl; 115 115 options.setDataBufferingPolicy(DoNotBufferData); 116 options.securityOrigin = &origin;117 116 options.contentSecurityPolicyEnforcement = scriptExecutionContext()->shouldBypassMainWorldContentSecurityPolicy() ? ContentSecurityPolicyEnforcement::DoNotEnforce : ContentSecurityPolicyEnforcement::EnforceConnectSrcDirective; 118 117 -
trunk/Source/WebCore/workers/WorkerScriptLoader.cpp
r202480 r202614 69 69 options.crossOriginRequestPolicy = crossOriginRequestPolicy; 70 70 options.setSendLoadCallbacks(SendCallbacks); 71 options.securityOrigin = scriptExecutionContext->securityOrigin();72 71 options.contentSecurityPolicyEnforcement = contentSecurityPolicyEnforcement; 73 72 74 73 WorkerThreadableLoader::loadResourceSynchronously(downcast<WorkerGlobalScope>(scriptExecutionContext), *request, *this, options); 75 74 } 76 75 77 76 void WorkerScriptLoader::loadAsynchronously(ScriptExecutionContext* scriptExecutionContext, const URL& url, CrossOriginRequestPolicy crossOriginRequestPolicy, ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement, WorkerScriptLoaderClient* client) 78 77 { … … 89 88 options.crossOriginRequestPolicy = crossOriginRequestPolicy; 90 89 options.setSendLoadCallbacks(SendCallbacks); 91 options.securityOrigin = scriptExecutionContext->securityOrigin();92 90 options.contentSecurityPolicyEnforcement = contentSecurityPolicyEnforcement; 93 91 -
trunk/Source/WebCore/xml/XMLHttpRequest.cpp
r202480 r202614 716 716 options.setCredentialRequest(m_includeCredentials ? ClientRequestedCredentials : ClientDidNotRequestCredentials); 717 717 options.crossOriginRequestPolicy = UseAccessControl; 718 options.securityOrigin = securityOrigin();719 718 options.contentSecurityPolicyEnforcement = scriptExecutionContext()->shouldBypassMainWorldContentSecurityPolicy() ? ContentSecurityPolicyEnforcement::DoNotEnforce : ContentSecurityPolicyEnforcement::EnforceConnectSrcDirective; 720 719 options.initiator = cachedResourceRequestInitiators().xmlhttprequest;
Note: See TracChangeset
for help on using the changeset viewer.