Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(577)

Side by Side Diff: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp

Issue 2436623004: [Fetch, Loader] Expect on-heap objects will never get destroyed with a reference (Closed)
Patch Set: fix Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013, Intel Corporation 3 * Copyright (C) 2013, Intel Corporation
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 // Remove any headers that may have been added by the network layer that cause 640 // Remove any headers that may have been added by the network layer that cause
641 // access control to fail. 641 // access control to fail.
642 crossOriginRequest.clearHTTPReferrer(); 642 crossOriginRequest.clearHTTPReferrer();
643 crossOriginRequest.clearHTTPOrigin(); 643 crossOriginRequest.clearHTTPOrigin();
644 crossOriginRequest.clearHTTPUserAgent(); 644 crossOriginRequest.clearHTTPUserAgent();
645 // Add any CORS simple request headers which we previously saved from the 645 // Add any CORS simple request headers which we previously saved from the
646 // original request. 646 // original request.
647 for (const auto& header : m_simpleRequestHeaders) 647 for (const auto& header : m_simpleRequestHeaders)
648 crossOriginRequest.setHTTPHeaderField(header.key, header.value); 648 crossOriginRequest.setHTTPHeaderField(header.key, header.value);
649 makeCrossOriginAccessRequest(crossOriginRequest); 649 makeCrossOriginAccessRequest(crossOriginRequest);
650 // |this| may be dead here.
651 650
652 return false; 651 return false;
653 } 652 }
654 653
655 void DocumentThreadableLoader::redirectBlocked() { 654 void DocumentThreadableLoader::redirectBlocked() {
656 m_checker.redirectBlocked(); 655 m_checker.redirectBlocked();
657 656
658 // Tells the client that a redirect was received but not followed (for an 657 // Tells the client that a redirect was received but not followed (for an
659 // unknown reason). 658 // unknown reason).
660 ThreadableLoaderClient* client = m_client; 659 ThreadableLoaderClient* client = m_client;
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 955
957 // Prevent handleSuccessfulFinish() from bypassing access check. 956 // Prevent handleSuccessfulFinish() from bypassing access check.
958 m_actualRequest = ResourceRequest(); 957 m_actualRequest = ResourceRequest();
959 958
960 ThreadableLoaderClient* client = m_client; 959 ThreadableLoaderClient* client = m_client;
961 clear(); 960 clear();
962 client->didFailAccessControlCheck(error); 961 client->didFailAccessControlCheck(error);
963 } 962 }
964 963
965 void DocumentThreadableLoader::handleError(const ResourceError& error) { 964 void DocumentThreadableLoader::handleError(const ResourceError& error) {
966 // Copy the ResourceError instance to make it sure that the passed
967 // ResourceError is alive during didFail() even when the Resource is
968 // destructed during didFail().
969 ResourceError copiedError = error;
970
971 ThreadableLoaderClient* client = m_client; 965 ThreadableLoaderClient* client = m_client;
972 clear(); 966 clear();
973 client->didFail(copiedError); 967 client->didFail(error);
974 } 968 }
975 969
976 void DocumentThreadableLoader::loadRequestAsync( 970 void DocumentThreadableLoader::loadRequestAsync(
977 const ResourceRequest& request, 971 const ResourceRequest& request,
978 ResourceLoaderOptions resourceLoaderOptions) { 972 ResourceLoaderOptions resourceLoaderOptions) {
979 if (!m_actualRequest.isNull()) 973 if (!m_actualRequest.isNull())
980 resourceLoaderOptions.dataBufferingPolicy = BufferData; 974 resourceLoaderOptions.dataBufferingPolicy = BufferData;
981 975
982 if (m_options.timeoutMilliseconds > 0) { 976 if (m_options.timeoutMilliseconds > 0) {
983 m_timeoutTimer.startOneShot(m_options.timeoutMilliseconds / 1000.0, 977 m_timeoutTimer.startOneShot(m_options.timeoutMilliseconds / 1000.0,
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 } 1131 }
1138 1132
1139 DEFINE_TRACE(DocumentThreadableLoader) { 1133 DEFINE_TRACE(DocumentThreadableLoader) {
1140 visitor->trace(m_resource); 1134 visitor->trace(m_resource);
1141 visitor->trace(m_document); 1135 visitor->trace(m_document);
1142 ThreadableLoader::trace(visitor); 1136 ThreadableLoader::trace(visitor);
1143 RawResourceClient::trace(visitor); 1137 RawResourceClient::trace(visitor);
1144 } 1138 }
1145 1139
1146 } // namespace blink 1140 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698