OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 | 1327 |
1328 if (canGetResponseBodyBlob(requestId)) { | 1328 if (canGetResponseBodyBlob(requestId)) { |
1329 getResponseBodyBlob(requestId, std::move(callback)); | 1329 getResponseBodyBlob(requestId, std::move(callback)); |
1330 return; | 1330 return; |
1331 } | 1331 } |
1332 | 1332 |
1333 callback->sendFailure( | 1333 callback->sendFailure( |
1334 Response::Error("No data found for resource with given identifier")); | 1334 Response::Error("No data found for resource with given identifier")); |
1335 } | 1335 } |
1336 | 1336 |
1337 Response InspectorNetworkAgent::addBlockedURL(const String& url) { | 1337 Response InspectorNetworkAgent::setBlockedURLs( |
1338 protocol::DictionaryValue* blockedURLs = | 1338 std::unique_ptr<protocol::Array<String>> urls) { |
1339 m_state->getObject(NetworkAgentState::blockedURLs); | 1339 std::unique_ptr<protocol::DictionaryValue> newList = |
1340 if (!blockedURLs) { | 1340 protocol::DictionaryValue::create(); |
1341 std::unique_ptr<protocol::DictionaryValue> newList = | 1341 for (size_t i = 0; i < urls->length(); i++) |
1342 protocol::DictionaryValue::create(); | 1342 newList->setBoolean(urls->get(i), true); |
1343 blockedURLs = newList.get(); | 1343 m_state->setObject(NetworkAgentState::blockedURLs, std::move(newList)); |
1344 m_state->setObject(NetworkAgentState::blockedURLs, std::move(newList)); | |
1345 } | |
1346 blockedURLs->setBoolean(url, true); | |
1347 return Response::OK(); | 1344 return Response::OK(); |
1348 } | 1345 } |
1349 | 1346 |
1350 Response InspectorNetworkAgent::removeBlockedURL(const String& url) { | |
1351 protocol::DictionaryValue* blockedURLs = | |
1352 m_state->getObject(NetworkAgentState::blockedURLs); | |
1353 if (blockedURLs) | |
1354 blockedURLs->remove(url); | |
1355 return Response::OK(); | |
1356 } | |
1357 | |
1358 Response InspectorNetworkAgent::replayXHR(const String& requestId) { | 1347 Response InspectorNetworkAgent::replayXHR(const String& requestId) { |
1359 String actualRequestId = requestId; | 1348 String actualRequestId = requestId; |
1360 | 1349 |
1361 XHRReplayData* xhrReplayData = m_resourcesData->xhrReplayData(requestId); | 1350 XHRReplayData* xhrReplayData = m_resourcesData->xhrReplayData(requestId); |
1362 if (!xhrReplayData) | 1351 if (!xhrReplayData) |
1363 return Response::Error("Given id does not correspond to XHR"); | 1352 return Response::Error("Given id does not correspond to XHR"); |
1364 | 1353 |
1365 ExecutionContext* executionContext = xhrReplayData->getExecutionContext(); | 1354 ExecutionContext* executionContext = xhrReplayData->getExecutionContext(); |
1366 if (executionContext->isContextDestroyed()) { | 1355 if (executionContext->isContextDestroyed()) { |
1367 m_resourcesData->setXHRReplayData(requestId, 0); | 1356 m_resourcesData->setXHRReplayData(requestId, 0); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 TaskRunnerHelper::get(TaskType::UnspecedLoading, | 1545 TaskRunnerHelper::get(TaskType::UnspecedLoading, |
1557 inspectedFrames->root()), | 1546 inspectedFrames->root()), |
1558 this, | 1547 this, |
1559 &InspectorNetworkAgent::removeFinishedReplayXHRFired) {} | 1548 &InspectorNetworkAgent::removeFinishedReplayXHRFired) {} |
1560 | 1549 |
1561 bool InspectorNetworkAgent::shouldForceCORSPreflight() { | 1550 bool InspectorNetworkAgent::shouldForceCORSPreflight() { |
1562 return m_state->booleanProperty(NetworkAgentState::cacheDisabled, false); | 1551 return m_state->booleanProperty(NetworkAgentState::cacheDisabled, false); |
1563 } | 1552 } |
1564 | 1553 |
1565 } // namespace blink | 1554 } // namespace blink |
OLD | NEW |