| 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 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 | 1340 |
| 1341 if (canGetResponseBodyBlob(requestId)) { | 1341 if (canGetResponseBodyBlob(requestId)) { |
| 1342 getResponseBodyBlob(requestId, std::move(callback)); | 1342 getResponseBodyBlob(requestId, std::move(callback)); |
| 1343 return; | 1343 return; |
| 1344 } | 1344 } |
| 1345 | 1345 |
| 1346 callback->sendFailure( | 1346 callback->sendFailure( |
| 1347 Response::Error("No data found for resource with given identifier")); | 1347 Response::Error("No data found for resource with given identifier")); |
| 1348 } | 1348 } |
| 1349 | 1349 |
| 1350 Response InspectorNetworkAgent::addBlockedURL(const String& url) { | 1350 Response InspectorNetworkAgent::setBlockedURLs( |
| 1351 protocol::DictionaryValue* blockedURLs = | 1351 std::unique_ptr<protocol::Array<String>> urls) { |
| 1352 m_state->getObject(NetworkAgentState::blockedURLs); | 1352 std::unique_ptr<protocol::DictionaryValue> newList = |
| 1353 if (!blockedURLs) { | 1353 protocol::DictionaryValue::create(); |
| 1354 std::unique_ptr<protocol::DictionaryValue> newList = | 1354 for (size_t i = 0; i < urls->length(); i++) |
| 1355 protocol::DictionaryValue::create(); | 1355 newList->setBoolean(urls->get(i), true); |
| 1356 blockedURLs = newList.get(); | 1356 m_state->setObject(NetworkAgentState::blockedURLs, std::move(newList)); |
| 1357 m_state->setObject(NetworkAgentState::blockedURLs, std::move(newList)); | |
| 1358 } | |
| 1359 blockedURLs->setBoolean(url, true); | |
| 1360 return Response::OK(); | 1357 return Response::OK(); |
| 1361 } | 1358 } |
| 1362 | 1359 |
| 1363 Response InspectorNetworkAgent::removeBlockedURL(const String& url) { | |
| 1364 protocol::DictionaryValue* blockedURLs = | |
| 1365 m_state->getObject(NetworkAgentState::blockedURLs); | |
| 1366 if (blockedURLs) | |
| 1367 blockedURLs->remove(url); | |
| 1368 return Response::OK(); | |
| 1369 } | |
| 1370 | |
| 1371 Response InspectorNetworkAgent::replayXHR(const String& requestId) { | 1360 Response InspectorNetworkAgent::replayXHR(const String& requestId) { |
| 1372 String actualRequestId = requestId; | 1361 String actualRequestId = requestId; |
| 1373 | 1362 |
| 1374 XHRReplayData* xhrReplayData = m_resourcesData->xhrReplayData(requestId); | 1363 XHRReplayData* xhrReplayData = m_resourcesData->xhrReplayData(requestId); |
| 1375 if (!xhrReplayData) | 1364 if (!xhrReplayData) |
| 1376 return Response::Error("Given id does not correspond to XHR"); | 1365 return Response::Error("Given id does not correspond to XHR"); |
| 1377 | 1366 |
| 1378 ExecutionContext* executionContext = xhrReplayData->getExecutionContext(); | 1367 ExecutionContext* executionContext = xhrReplayData->getExecutionContext(); |
| 1379 if (executionContext->isContextDestroyed()) { | 1368 if (executionContext->isContextDestroyed()) { |
| 1380 m_resourcesData->setXHRReplayData(requestId, 0); | 1369 m_resourcesData->setXHRReplayData(requestId, 0); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1548 TaskRunnerHelper::get(TaskType::UnspecedLoading, | 1537 TaskRunnerHelper::get(TaskType::UnspecedLoading, |
| 1549 inspectedFrames->root()), | 1538 inspectedFrames->root()), |
| 1550 this, | 1539 this, |
| 1551 &InspectorNetworkAgent::removeFinishedReplayXHRFired) {} | 1540 &InspectorNetworkAgent::removeFinishedReplayXHRFired) {} |
| 1552 | 1541 |
| 1553 bool InspectorNetworkAgent::shouldForceCORSPreflight() { | 1542 bool InspectorNetworkAgent::shouldForceCORSPreflight() { |
| 1554 return m_state->booleanProperty(NetworkAgentState::cacheDisabled, false); | 1543 return m_state->booleanProperty(NetworkAgentState::cacheDisabled, false); |
| 1555 } | 1544 } |
| 1556 | 1545 |
| 1557 } // namespace blink | 1546 } // namespace blink |
| OLD | NEW |