Changeset 182866 in webkit
- Timestamp:
- Apr 15, 2015, 3:56:56 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
loader/ThreadableLoader.cpp (modified) (1 diff)
-
loader/ThreadableLoader.h (modified) (1 diff)
-
loader/WorkerThreadableLoader.cpp (modified) (2 diffs)
-
platform/CrossThreadCopier.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r182865 r182866 1 2015-04-15 Alexey Proskuryakov <ap@apple.com> 2 3 No thread safety when passing ThreadableLoaderOptions from a worker thread 4 https://bugs.webkit.org/show_bug.cgi?id=143790 5 6 Reviewed by Geoffrey Garen. 7 8 * loader/ThreadableLoader.h: 9 * loader/ThreadableLoader.cpp: (WebCore::ThreadableLoaderOptions::isolatedCopy): Added. 10 11 * loader/WorkerThreadableLoader.cpp: 12 (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge): Don't just send 13 a structure with strings to a different thread, that's bad. 14 15 * platform/CrossThreadCopier.h: I think that this is dead code, but for this bug, 16 just removing a clearly wrong specialization. 17 1 18 2015-04-15 Alex Christensen <achristensen@webkit.org> 2 19 -
trunk/Source/WebCore/loader/ThreadableLoader.cpp
r174225 r182866 52 52 } 53 53 54 std::unique_ptr<ThreadableLoaderOptions> ThreadableLoaderOptions::isolatedCopy() const 55 { 56 std::unique_ptr<ThreadableLoaderOptions> copy = std::make_unique<ThreadableLoaderOptions>(); 57 copy->preflightPolicy = preflightPolicy; 58 copy->crossOriginRequestPolicy = crossOriginRequestPolicy; 59 if (securityOrigin) 60 copy->securityOrigin = securityOrigin->isolatedCopy(); 61 copy->initiator = initiator.string().isolatedCopy(); 62 return copy; 63 } 64 54 65 PassRefPtr<ThreadableLoader> ThreadableLoader::create(ScriptExecutionContext* context, ThreadableLoaderClient* client, const ResourceRequest& request, const ThreadableLoaderOptions& options) 55 66 { -
trunk/Source/WebCore/loader/ThreadableLoader.h
r181480 r182866 64 64 ~ThreadableLoaderOptions(); 65 65 66 std::unique_ptr<ThreadableLoaderOptions> isolatedCopy() const; 67 66 68 PreflightPolicy preflightPolicy; // If AccessControl is used, how to determine if a preflight is needed. 67 69 CrossOriginRequestPolicy crossOriginRequestPolicy; -
trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp
r182707 r182866 92 92 93 93 auto* requestData = request.copyData().release(); 94 auto* optionsCopy = options.isolatedCopy().release(); 94 95 StringCapture capturedOutgoingReferrer(outgoingReferrer); 95 m_loaderProxy.postTaskToLoader([this, requestData, options , capturedOutgoingReferrer](ScriptExecutionContext& context) {96 m_loaderProxy.postTaskToLoader([this, requestData, optionsCopy, capturedOutgoingReferrer](ScriptExecutionContext& context) { 96 97 ASSERT(isMainThread()); 97 98 Document& document = downcast<Document>(context); … … 99 100 auto request = ResourceRequest::adopt(std::unique_ptr<CrossThreadResourceRequestData>(requestData)); 100 101 request->setHTTPReferrer(capturedOutgoingReferrer.string()); 102 103 auto options = std::unique_ptr<ThreadableLoaderOptions>(optionsCopy); 101 104 102 105 // FIXME: If the a site requests a local resource, then this will return a non-zero value but the sync path 103 106 // will return a 0 value. Either this should return 0 or the other code path should do a callback with 104 107 // a failure. 105 m_mainThreadLoader = DocumentThreadableLoader::create(document, *this, *request, options);108 m_mainThreadLoader = DocumentThreadableLoader::create(document, *this, *request, *options); 106 109 ASSERT(m_mainThreadLoader); 107 110 }); -
trunk/Source/WebCore/platform/CrossThreadCopier.h
r182707 r182866 93 93 // To allow a type to be passed across threads using its copy constructor, add a forward declaration of the type and 94 94 // a CopyThreadCopierBase<false, false, TypeName> : public CrossThreadCopierPassThrough<TypeName> { }; to this file. 95 template<> struct CrossThreadCopierBase<false, false, ThreadableLoaderOptions> : public CrossThreadCopierPassThrough<ThreadableLoaderOptions> {96 };97 98 95 template<> struct CrossThreadCopierBase<false, false, IntRect> : public CrossThreadCopierPassThrough<IntRect> { 99 96 };
Note:
See TracChangeset
for help on using the changeset viewer.