|
Lines 43-48
a/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp_sec1
|
| 43 |
#include "Document.h" |
43 |
#include "Document.h" |
| 44 |
#include "DocumentLoader.h" |
44 |
#include "DocumentLoader.h" |
| 45 |
#include "DocumentThreadableLoader.h" |
45 |
#include "DocumentThreadableLoader.h" |
|
|
46 |
#include "FormData.h" |
| 46 |
#include "Frame.h" |
47 |
#include "Frame.h" |
| 47 |
#include "FrameLoader.h" |
48 |
#include "FrameLoader.h" |
| 48 |
#include "HTTPHeaderMap.h" |
49 |
#include "HTTPHeaderMap.h" |
|
Lines 841-852
void InspectorNetworkAgent::disable(ErrorString&)
a/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp_sec2
|
| 841 |
m_resourcesData->clear(); |
842 |
m_resourcesData->clear(); |
| 842 |
m_extraRequestHeaders.clear(); |
843 |
m_extraRequestHeaders.clear(); |
| 843 |
|
844 |
|
|
|
845 |
continuePendingRequests(); |
| 844 |
continuePendingResponses(); |
846 |
continuePendingResponses(); |
| 845 |
|
847 |
|
| 846 |
setResourceCachingDisabled(false); |
848 |
setResourceCachingDisabled(false); |
| 847 |
} |
849 |
} |
| 848 |
|
850 |
|
| 849 |
bool InspectorNetworkAgent::shouldIntercept(URL url) |
851 |
bool InspectorNetworkAgent::shouldIntercept(URL url, NetworkStage networkStage) |
| 850 |
{ |
852 |
{ |
| 851 |
url.removeFragmentIdentifier(); |
853 |
url.removeFragmentIdentifier(); |
| 852 |
|
854 |
|
|
Lines 855-860
bool InspectorNetworkAgent::shouldIntercept(URL url)
a/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp_sec3
|
| 855 |
return false; |
857 |
return false; |
| 856 |
|
858 |
|
| 857 |
for (auto& intercept : m_intercepts) { |
859 |
for (auto& intercept : m_intercepts) { |
|
|
860 |
if (intercept.networkStage != networkStage) |
| 861 |
continue; |
| 862 |
if (intercept.url.isEmpty()) |
| 863 |
return true; |
| 858 |
auto searchStringType = intercept.isRegex ? ContentSearchUtilities::SearchStringType::Regex : ContentSearchUtilities::SearchStringType::ExactString; |
864 |
auto searchStringType = intercept.isRegex ? ContentSearchUtilities::SearchStringType::Regex : ContentSearchUtilities::SearchStringType::ExactString; |
| 859 |
auto regex = ContentSearchUtilities::createRegularExpressionForSearchString(intercept.url, intercept.caseSensitive, searchStringType); |
865 |
auto regex = ContentSearchUtilities::createRegularExpressionForSearchString(intercept.url, intercept.caseSensitive, searchStringType); |
| 860 |
if (regex.match(urlString) != -1) |
866 |
if (regex.match(urlString) != -1) |
|
Lines 864-869
bool InspectorNetworkAgent::shouldIntercept(URL url)
a/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp_sec4
|
| 864 |
return false; |
870 |
return false; |
| 865 |
} |
871 |
} |
| 866 |
|
872 |
|
|
|
873 |
void InspectorNetworkAgent::continuePendingRequests() |
| 874 |
{ |
| 875 |
for (auto& pendingRequest : m_pendingInterceptRequests.values()) { |
| 876 |
ResourceLoader* loader = pendingRequest->m_loader.get(); |
| 877 |
if (loader->identifier()) |
| 878 |
pendingRequest->m_completionHandler(&loader->request()); |
| 879 |
} |
| 880 |
m_pendingInterceptRequests.clear(); |
| 881 |
} |
| 882 |
|
| 867 |
void InspectorNetworkAgent::continuePendingResponses() |
883 |
void InspectorNetworkAgent::continuePendingResponses() |
| 868 |
{ |
884 |
{ |
| 869 |
for (auto& pendingInterceptResponse : m_pendingInterceptResponses.values()) |
885 |
for (auto& pendingInterceptResponse : m_pendingInterceptResponses.values()) |
|
Lines 1029-1090
void InspectorNetworkAgent::setInterceptionEnabled(ErrorString& errorString, boo
a/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp_sec5
|
| 1029 |
|
1045 |
|
| 1030 |
m_interceptionEnabled = enabled; |
1046 |
m_interceptionEnabled = enabled; |
| 1031 |
|
1047 |
|
| 1032 |
if (!m_interceptionEnabled) |
1048 |
if (!m_interceptionEnabled) { |
|
|
1049 |
continuePendingRequests(); |
| 1033 |
continuePendingResponses(); |
1050 |
continuePendingResponses(); |
|
|
1051 |
} |
| 1034 |
} |
1052 |
} |
| 1035 |
|
1053 |
|
| 1036 |
void InspectorNetworkAgent::addInterception(ErrorString& errorString, const String& url, const bool* optionalCaseSensitive, const bool* optionalIsRegex, const String* networkStageString) |
1054 |
void InspectorNetworkAgent::addInterception(ErrorString& errorString, const String& url, const String& networkStageString, const bool* optionalCaseSensitive, const bool* optionalIsRegex) |
| 1037 |
{ |
1055 |
{ |
| 1038 |
if (networkStageString) { |
|
|
| 1039 |
auto networkStage = Inspector::Protocol::InspectorHelpers::parseEnumValueFromString<Inspector::Protocol::Network::NetworkStage>(*networkStageString); |
| 1040 |
if (!networkStage) { |
| 1041 |
errorString = makeString("Unknown networkStage: "_s, *networkStageString); |
| 1042 |
return; |
| 1043 |
} |
| 1044 |
} |
| 1045 |
|
| 1046 |
Intercept intercept; |
1056 |
Intercept intercept; |
| 1047 |
intercept.url = url; |
1057 |
intercept.url = url; |
| 1048 |
if (optionalCaseSensitive) |
1058 |
if (optionalCaseSensitive) |
| 1049 |
intercept.caseSensitive = *optionalCaseSensitive; |
1059 |
intercept.caseSensitive = *optionalCaseSensitive; |
| 1050 |
if (optionalIsRegex) |
1060 |
if (optionalIsRegex) |
| 1051 |
intercept.isRegex = *optionalIsRegex; |
1061 |
intercept.isRegex = *optionalIsRegex; |
| 1052 |
|
1062 |
auto networkStage = Inspector::Protocol::InspectorHelpers::parseEnumValueFromString<Inspector::Protocol::Network::NetworkStage>(networkStageString); |
| 1053 |
// FIXME: Support intercepting requests. |
1063 |
if (!networkStage) { |
|
|
1064 |
errorString = makeString("Unknown networkStage: "_s, networkStageString); |
| 1065 |
return; |
| 1066 |
} |
| 1067 |
intercept.networkStage = networkStage.value(); |
| 1054 |
|
1068 |
|
| 1055 |
if (!m_intercepts.appendIfNotContains(intercept)) |
1069 |
if (!m_intercepts.appendIfNotContains(intercept)) |
| 1056 |
errorString = "Intercept for given url and given isRegex already exists"_s; |
1070 |
errorString = "Intercept for given url and given isRegex already exists"_s; |
| 1057 |
} |
1071 |
} |
| 1058 |
|
1072 |
|
| 1059 |
void InspectorNetworkAgent::removeInterception(ErrorString& errorString, const String& url, const bool* optionalCaseSensitive, const bool* optionalIsRegex, const String* networkStageString) |
1073 |
void InspectorNetworkAgent::removeInterception(ErrorString& errorString, const String& url, const String& networkStageString, const bool* optionalCaseSensitive, const bool* optionalIsRegex) |
| 1060 |
{ |
1074 |
{ |
| 1061 |
if (networkStageString) { |
|
|
| 1062 |
auto networkStage = Inspector::Protocol::InspectorHelpers::parseEnumValueFromString<Inspector::Protocol::Network::NetworkStage>(*networkStageString); |
| 1063 |
if (!networkStage) { |
| 1064 |
errorString = makeString("Unknown networkStage: "_s, *networkStageString); |
| 1065 |
return; |
| 1066 |
} |
| 1067 |
} |
| 1068 |
|
| 1069 |
Intercept intercept; |
1075 |
Intercept intercept; |
| 1070 |
intercept.url = url; |
1076 |
intercept.url = url; |
| 1071 |
if (optionalCaseSensitive) |
1077 |
if (optionalCaseSensitive) |
| 1072 |
intercept.caseSensitive = *optionalCaseSensitive; |
1078 |
intercept.caseSensitive = *optionalCaseSensitive; |
| 1073 |
if (optionalIsRegex) |
1079 |
if (optionalIsRegex) |
| 1074 |
intercept.isRegex = *optionalIsRegex; |
1080 |
intercept.isRegex = *optionalIsRegex; |
| 1075 |
|
1081 |
auto networkStage = Inspector::Protocol::InspectorHelpers::parseEnumValueFromString<Inspector::Protocol::Network::NetworkStage>(networkStageString); |
| 1076 |
// FIXME: Support intercepting requests. |
1082 |
if (!networkStage) { |
|
|
1083 |
errorString = makeString("Unknown networkStage: "_s, networkStageString); |
| 1084 |
return; |
| 1085 |
} |
| 1086 |
intercept.networkStage = networkStage.value(); |
| 1077 |
|
1087 |
|
| 1078 |
if (!m_intercepts.removeAll(intercept)) |
1088 |
if (!m_intercepts.removeAll(intercept)) |
| 1079 |
errorString = "Missing intercept for given url and given isRegex"_s; |
1089 |
errorString = "Missing intercept for given url and given isRegex"_s; |
| 1080 |
} |
1090 |
} |
| 1081 |
|
1091 |
|
| 1082 |
bool InspectorNetworkAgent::willInterceptRequest(const ResourceRequest& request) |
1092 |
bool InspectorNetworkAgent::willIntercept(const ResourceRequest& request) |
|
|
1093 |
{ |
| 1094 |
if (!m_interceptionEnabled) |
| 1095 |
return false; |
| 1096 |
|
| 1097 |
return shouldIntercept(request.url(), NetworkStage::Request) || shouldIntercept(request.url(), NetworkStage::Response); |
| 1098 |
} |
| 1099 |
|
| 1100 |
bool InspectorNetworkAgent::shouldInterceptRequest(const ResourceRequest& request) |
| 1083 |
{ |
1101 |
{ |
| 1084 |
if (!m_interceptionEnabled) |
1102 |
if (!m_interceptionEnabled) |
| 1085 |
return false; |
1103 |
return false; |
| 1086 |
|
1104 |
|
| 1087 |
return shouldIntercept(request.url()); |
1105 |
return shouldIntercept(request.url(), NetworkStage::Request); |
| 1088 |
} |
1106 |
} |
| 1089 |
|
1107 |
|
| 1090 |
bool InspectorNetworkAgent::shouldInterceptResponse(const ResourceResponse& response) |
1108 |
bool InspectorNetworkAgent::shouldInterceptResponse(const ResourceResponse& response) |
|
Lines 1092-1098
bool InspectorNetworkAgent::shouldInterceptResponse(const ResourceResponse& resp
a/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp_sec6
|
| 1092 |
if (!m_interceptionEnabled) |
1110 |
if (!m_interceptionEnabled) |
| 1093 |
return false; |
1111 |
return false; |
| 1094 |
|
1112 |
|
| 1095 |
return shouldIntercept(response.url()); |
1113 |
return shouldIntercept(response.url(), NetworkStage::Response); |
|
|
1114 |
} |
| 1115 |
|
| 1116 |
void InspectorNetworkAgent::interceptRequest(ResourceLoader& loader, CompletionHandler<void(const ResourceRequest*)>&& handler) |
| 1117 |
{ |
| 1118 |
ASSERT(m_enabled); |
| 1119 |
ASSERT(m_interceptionEnabled); |
| 1120 |
|
| 1121 |
String requestId = IdentifiersFactory::requestId(loader.identifier()); |
| 1122 |
if (m_pendingInterceptRequests.contains(requestId)) { |
| 1123 |
handler(&loader.request()); |
| 1124 |
return; |
| 1125 |
} |
| 1126 |
m_pendingInterceptRequests.set(requestId, makeUnique<PendingInterceptRequest>(&loader, WTFMove(handler))); |
| 1127 |
m_frontendDispatcher->requestIntercepted(requestId, buildObjectForResourceRequest(loader.request())); |
| 1096 |
} |
1128 |
} |
| 1097 |
|
1129 |
|
| 1098 |
void InspectorNetworkAgent::interceptResponse(const ResourceResponse& response, unsigned long identifier, CompletionHandler<void(const ResourceResponse&, RefPtr<SharedBuffer>)>&& handler) |
1130 |
void InspectorNetworkAgent::interceptResponse(const ResourceResponse& response, unsigned long identifier, CompletionHandler<void(const ResourceResponse&, RefPtr<SharedBuffer>)>&& handler) |
|
Lines 1112-1129
void InspectorNetworkAgent::interceptResponse(const ResourceResponse& response,
a/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp_sec7
|
| 1112 |
m_frontendDispatcher->responseIntercepted(requestId, buildObjectForResourceResponse(response, nullptr)); |
1144 |
m_frontendDispatcher->responseIntercepted(requestId, buildObjectForResourceResponse(response, nullptr)); |
| 1113 |
} |
1145 |
} |
| 1114 |
|
1146 |
|
| 1115 |
void InspectorNetworkAgent::interceptContinue(ErrorString& errorString, const String& requestId) |
1147 |
void InspectorNetworkAgent::interceptContinue(ErrorString& errorString, const String& requestId, const String& networkStageString) |
| 1116 |
{ |
1148 |
{ |
|
|
1149 |
auto networkStage = Inspector::Protocol::InspectorHelpers::parseEnumValueFromString<Inspector::Protocol::Network::NetworkStage>(networkStageString); |
| 1150 |
if (!networkStage) { |
| 1151 |
errorString = makeString("Unknown networkStage: "_s, networkStageString); |
| 1152 |
return; |
| 1153 |
} |
| 1154 |
|
| 1155 |
if (networkStage.value() == NetworkStage::Request) { |
| 1156 |
auto pendingInterceptRequest = m_pendingInterceptRequests.take(requestId); |
| 1157 |
if (pendingInterceptRequest) { |
| 1158 |
pendingInterceptRequest->m_completionHandler(&pendingInterceptRequest->m_loader->request()); |
| 1159 |
return; |
| 1160 |
} |
| 1161 |
errorString = "Missing pending intercept request for given requestId"_s; |
| 1162 |
return; |
| 1163 |
} |
| 1164 |
|
| 1117 |
auto pendingInterceptResponse = m_pendingInterceptResponses.take(requestId); |
1165 |
auto pendingInterceptResponse = m_pendingInterceptResponses.take(requestId); |
| 1118 |
if (!pendingInterceptResponse) { |
1166 |
if (pendingInterceptResponse) { |
| 1119 |
errorString = "Missing pending intercept response for given requestId"_s; |
1167 |
pendingInterceptResponse->respondWithOriginalResponse(); |
|
|
1168 |
return; |
| 1169 |
} |
| 1170 |
errorString = "Missing pending intercept response for given requestId"_s; |
| 1171 |
} |
| 1172 |
|
| 1173 |
void InspectorNetworkAgent::interceptWithRequest(ErrorString& errorString, const String& requestId, const String* method, const String* url, const JSON::Object* headers, const String* postData) |
| 1174 |
{ |
| 1175 |
auto pendingRequest = m_pendingInterceptRequests.take(requestId); |
| 1176 |
if (pendingRequest) { |
| 1177 |
ResourceLoader* loader = pendingRequest->m_loader.get(); |
| 1178 |
if (!loader->identifier()) { |
| 1179 |
// Do not throw upon continue of canceled requests. |
| 1180 |
return; |
| 1181 |
} |
| 1182 |
// Safe to const cast at this point, we are only adjusting the method / headers / post. |
| 1183 |
ResourceRequest request = loader->request(); |
| 1184 |
if (url) |
| 1185 |
request.setURL(URL({ }, *url)); |
| 1186 |
if (method) |
| 1187 |
request.setHTTPMethod(*method); |
| 1188 |
if (headers) { |
| 1189 |
HTTPHeaderMap explicitHeaders; |
| 1190 |
for (auto& [key, value] : *headers) { |
| 1191 |
String headerValue; |
| 1192 |
if (value->asString(headerValue)) |
| 1193 |
explicitHeaders.add(key, headerValue); |
| 1194 |
} |
| 1195 |
request.setHTTPHeaderFields(WTFMove(explicitHeaders)); |
| 1196 |
} |
| 1197 |
if (postData) { |
| 1198 |
Vector<uint8_t> buffer; |
| 1199 |
if (!base64Decode(*postData, buffer)) { |
| 1200 |
errorString = "Unable to decode given postData"_s; |
| 1201 |
return; |
| 1202 |
} |
| 1203 |
request.setHTTPBody(FormData::create(buffer)); |
| 1204 |
} |
| 1205 |
pendingRequest->m_completionHandler(&request); |
| 1120 |
return; |
1206 |
return; |
| 1121 |
} |
1207 |
} |
| 1122 |
|
1208 |
|
| 1123 |
pendingInterceptResponse->respondWithOriginalResponse(); |
1209 |
errorString = "Missing pending intercept request for given requestId"_s; |
| 1124 |
} |
1210 |
} |
| 1125 |
|
1211 |
|
| 1126 |
void InspectorNetworkAgent::interceptWithResponse(ErrorString& errorString, const String& requestId, const String& content, bool base64Encoded, const String* mimeType, const int* status, const String* statusText, const JSON::Object* headers) |
1212 |
void InspectorNetworkAgent::interceptWithResponse(ErrorString& errorString, const String& requestId, const String* content, const bool* base64Encoded, const String* mimeType, const int* status, const String* statusText, const JSON::Object* headers) |
| 1127 |
{ |
1213 |
{ |
| 1128 |
auto pendingInterceptResponse = m_pendingInterceptResponses.take(requestId); |
1214 |
auto pendingInterceptResponse = m_pendingInterceptResponses.take(requestId); |
| 1129 |
if (!pendingInterceptResponse) { |
1215 |
if (!pendingInterceptResponse) { |
|
Lines 1152-1171
void InspectorNetworkAgent::interceptWithResponse(ErrorString& errorString, cons
a/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp_sec8
|
| 1152 |
} |
1238 |
} |
| 1153 |
|
1239 |
|
| 1154 |
RefPtr<SharedBuffer> overrideData; |
1240 |
RefPtr<SharedBuffer> overrideData; |
| 1155 |
if (base64Encoded) { |
1241 |
if (base64Encoded && *base64Encoded && content) { |
| 1156 |
Vector<uint8_t> buffer; |
1242 |
Vector<uint8_t> buffer; |
| 1157 |
if (!base64Decode(content, buffer)) { |
1243 |
if (!base64Decode(*content, buffer)) { |
| 1158 |
errorString = "Unable to decode given content"_s; |
1244 |
errorString = "Unable to decode given content"_s; |
| 1159 |
pendingInterceptResponse->respondWithOriginalResponse(); |
1245 |
pendingInterceptResponse->respondWithOriginalResponse(); |
| 1160 |
return; |
1246 |
return; |
| 1161 |
} |
1247 |
} |
| 1162 |
overrideData = SharedBuffer::create(WTFMove(buffer)); |
1248 |
overrideData = SharedBuffer::create(WTFMove(buffer)); |
| 1163 |
} else |
1249 |
} else if (content) |
| 1164 |
overrideData = SharedBuffer::create(content.utf8().data(), content.utf8().length()); |
1250 |
overrideData = SharedBuffer::create(content->utf8().data(), content->utf8().length()); |
| 1165 |
|
1251 |
|
| 1166 |
pendingInterceptResponse->respond(overrideResponse, overrideData); |
1252 |
pendingInterceptResponse->respond(overrideResponse, overrideData); |
| 1167 |
} |
1253 |
} |
| 1168 |
|
1254 |
|
|
|
1255 |
void InspectorNetworkAgent::interceptRequestWithResponse(ErrorString& errorString, const String& requestId, const String& content, const bool* base64Encoded, const String& mimeType, int status, const String& statusText, const JSON::Object& headers) |
| 1256 |
{ |
| 1257 |
auto pendingRequest = m_pendingInterceptRequests.take(requestId); |
| 1258 |
if (!pendingRequest) { |
| 1259 |
errorString = "Missing pending intercept response for given requestId"_s; |
| 1260 |
return; |
| 1261 |
} |
| 1262 |
|
| 1263 |
RefPtr<ResourceLoader> loader = pendingRequest->m_loader.get(); |
| 1264 |
if (!loader->identifier()) { |
| 1265 |
errorString = "Unable to fulfill request, it has already been processed"_s; |
| 1266 |
return; |
| 1267 |
} |
| 1268 |
RefPtr<SharedBuffer> data; |
| 1269 |
if (base64Encoded && *base64Encoded) { |
| 1270 |
Vector<uint8_t> buffer; |
| 1271 |
if (!base64Decode(content, buffer)) { |
| 1272 |
errorString = "Unable to decode given content"_s; |
| 1273 |
return; |
| 1274 |
} |
| 1275 |
data = SharedBuffer::create(WTFMove(buffer)); |
| 1276 |
} else |
| 1277 |
data = SharedBuffer::create(content.utf8().data(), content.utf8().length()); |
| 1278 |
|
| 1279 |
// Mimic data URL load behavior - report didReceiveResponse & didFinishLoading. |
| 1280 |
ResourceResponse response(pendingRequest->m_loader->url(), mimeType, data->size(), String()); |
| 1281 |
response.setSource(ResourceResponse::Source::InspectorOverride); |
| 1282 |
response.setHTTPStatusCode(status); |
| 1283 |
response.setHTTPStatusText(statusText); |
| 1284 |
HTTPHeaderMap explicitHeaders; |
| 1285 |
for (auto& header : headers) { |
| 1286 |
String headerValue; |
| 1287 |
if (header.value->asString(headerValue)) |
| 1288 |
explicitHeaders.add(header.key, headerValue); |
| 1289 |
} |
| 1290 |
response.setHTTPHeaderFields(WTFMove(explicitHeaders)); |
| 1291 |
response.setHTTPHeaderField(HTTPHeaderName::ContentType, response.mimeType()); |
| 1292 |
loader->didReceiveResponse(response, [loader, buffer = data.releaseNonNull()]() mutable { |
| 1293 |
if (buffer->size()) |
| 1294 |
loader->didReceiveBuffer(WTFMove(buffer), buffer->size(), DataPayloadWholeResource); |
| 1295 |
loader->didFinishLoading(NetworkLoadMetrics()); |
| 1296 |
}); |
| 1297 |
pendingRequest->m_completionHandler(nullptr); |
| 1298 |
} |
| 1299 |
|
| 1300 |
void InspectorNetworkAgent::interceptRequestWithError(ErrorString& errorString, const String& requestId, const String& errorTypeString) |
| 1301 |
{ |
| 1302 |
auto pendingRequest = m_pendingInterceptRequests.take(requestId); |
| 1303 |
if (!pendingRequest) { |
| 1304 |
errorString = "Missing pending intercept response for given requestId"_s; |
| 1305 |
return; |
| 1306 |
} |
| 1307 |
|
| 1308 |
ResourceLoader* loader = pendingRequest->m_loader.get(); |
| 1309 |
if (!loader->identifier()) { |
| 1310 |
errorString = "Unable to abort request, it has already been processed"_s; |
| 1311 |
return; |
| 1312 |
} |
| 1313 |
|
| 1314 |
auto errorType = Inspector::Protocol::InspectorHelpers::parseEnumValueFromString<Inspector::Protocol::Network::ResourceErrorType>(errorTypeString); |
| 1315 |
if (!errorType) { |
| 1316 |
errorString = "Unknown error type"_s; |
| 1317 |
return; |
| 1318 |
} |
| 1319 |
|
| 1320 |
ResourceError error; |
| 1321 |
switch (errorType.value()) { |
| 1322 |
case Inspector::Protocol::Network::ResourceErrorType::General: |
| 1323 |
error = ResourceError(errorDomainWebKitInternal, 0, loader->url(), "Request intercepted"_s, ResourceError::Type::General); |
| 1324 |
break; |
| 1325 |
case Inspector::Protocol::Network::ResourceErrorType::AccessControl: |
| 1326 |
error = ResourceError(errorDomainWebKitInternal, 0, loader->url(), "Access denied"_s, ResourceError::Type::AccessControl); |
| 1327 |
break; |
| 1328 |
case Inspector::Protocol::Network::ResourceErrorType::Cancellation: |
| 1329 |
error = ResourceError(errorDomainWebKitInternal, 0, loader->url(), "Request canceled"_s, ResourceError::Type::Cancellation); |
| 1330 |
break; |
| 1331 |
case Inspector::Protocol::Network::ResourceErrorType::Timeout: |
| 1332 |
error = ResourceError(errorDomainWebKitInternal, 0, loader->url(), "Request timed out"_s, ResourceError::Type::Timeout); |
| 1333 |
break; |
| 1334 |
default: |
| 1335 |
ASSERT_NOT_REACHED(); |
| 1336 |
return; |
| 1337 |
} |
| 1338 |
loader->didFail(error); |
| 1339 |
pendingRequest->m_completionHandler(nullptr); |
| 1340 |
} |
| 1341 |
|
| 1169 |
bool InspectorNetworkAgent::shouldTreatAsText(const String& mimeType) |
1342 |
bool InspectorNetworkAgent::shouldTreatAsText(const String& mimeType) |
| 1170 |
{ |
1343 |
{ |
| 1171 |
return startsWithLettersIgnoringASCIICase(mimeType, "text/") |
1344 |
return startsWithLettersIgnoringASCIICase(mimeType, "text/") |