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

Side by Side Diff: third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp

Issue 2703603003: [Devtools] Changed protocol to use setBlockedURLs instead of add/remove (Closed)
Patch Set: Merge Created 3 years, 9 months 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 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 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1325 1325
1326 if (canGetResponseBodyBlob(requestId)) { 1326 if (canGetResponseBodyBlob(requestId)) {
1327 getResponseBodyBlob(requestId, std::move(callback)); 1327 getResponseBodyBlob(requestId, std::move(callback));
1328 return; 1328 return;
1329 } 1329 }
1330 1330
1331 callback->sendFailure( 1331 callback->sendFailure(
1332 Response::Error("No data found for resource with given identifier")); 1332 Response::Error("No data found for resource with given identifier"));
1333 } 1333 }
1334 1334
1335 Response InspectorNetworkAgent::addBlockedURL(const String& url) { 1335 Response InspectorNetworkAgent::setBlockedURLs(
1336 protocol::DictionaryValue* blockedURLs = 1336 std::unique_ptr<protocol::Array<String>> urls) {
1337 m_state->getObject(NetworkAgentState::blockedURLs); 1337 std::unique_ptr<protocol::DictionaryValue> newList =
1338 if (!blockedURLs) { 1338 protocol::DictionaryValue::create();
1339 std::unique_ptr<protocol::DictionaryValue> newList = 1339 for (size_t i = 0; i < urls->length(); i++)
1340 protocol::DictionaryValue::create(); 1340 newList->setBoolean(urls->get(i), true);
1341 blockedURLs = newList.get(); 1341 m_state->setObject(NetworkAgentState::blockedURLs, std::move(newList));
1342 m_state->setObject(NetworkAgentState::blockedURLs, std::move(newList));
1343 }
1344 blockedURLs->setBoolean(url, true);
1345 return Response::OK(); 1342 return Response::OK();
1346 } 1343 }
1347 1344
1348 Response InspectorNetworkAgent::removeBlockedURL(const String& url) {
1349 protocol::DictionaryValue* blockedURLs =
1350 m_state->getObject(NetworkAgentState::blockedURLs);
1351 if (blockedURLs)
1352 blockedURLs->remove(url);
1353 return Response::OK();
1354 }
1355
1356 Response InspectorNetworkAgent::replayXHR(const String& requestId) { 1345 Response InspectorNetworkAgent::replayXHR(const String& requestId) {
1357 String actualRequestId = requestId; 1346 String actualRequestId = requestId;
1358 1347
1359 XHRReplayData* xhrReplayData = m_resourcesData->xhrReplayData(requestId); 1348 XHRReplayData* xhrReplayData = m_resourcesData->xhrReplayData(requestId);
1360 if (!xhrReplayData) 1349 if (!xhrReplayData)
1361 return Response::Error("Given id does not correspond to XHR"); 1350 return Response::Error("Given id does not correspond to XHR");
1362 1351
1363 ExecutionContext* executionContext = xhrReplayData->getExecutionContext(); 1352 ExecutionContext* executionContext = xhrReplayData->getExecutionContext();
1364 if (executionContext->isContextDestroyed()) { 1353 if (executionContext->isContextDestroyed()) {
1365 m_resourcesData->setXHRReplayData(requestId, 0); 1354 m_resourcesData->setXHRReplayData(requestId, 0);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1554 TaskRunnerHelper::get(TaskType::UnspecedLoading, 1543 TaskRunnerHelper::get(TaskType::UnspecedLoading,
1555 inspectedFrames->root()), 1544 inspectedFrames->root()),
1556 this, 1545 this,
1557 &InspectorNetworkAgent::removeFinishedReplayXHRFired) {} 1546 &InspectorNetworkAgent::removeFinishedReplayXHRFired) {}
1558 1547
1559 bool InspectorNetworkAgent::shouldForceCORSPreflight() { 1548 bool InspectorNetworkAgent::shouldForceCORSPreflight() {
1560 return m_state->booleanProperty(NetworkAgentState::cacheDisabled, false); 1549 return m_state->booleanProperty(NetworkAgentState::cacheDisabled, false);
1561 } 1550 }
1562 1551
1563 } // namespace blink 1552 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698