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

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

Issue 2739323003: DevTools protocol interception, blocking & modification of requests (Closed)
Patch Set: Add missing expects plus tweak test output of Network.interceptedRedirect for clarity 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 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 750
751 if (response.getSecurityStyle() != ResourceResponse::SecurityStyleUnknown && 751 if (response.getSecurityStyle() != ResourceResponse::SecurityStyleUnknown &&
752 response.getSecurityStyle() != 752 response.getSecurityStyle() !=
753 ResourceResponse::SecurityStyleUnauthenticated) { 753 ResourceResponse::SecurityStyleUnauthenticated) {
754 const ResourceResponse::SecurityDetails* responseSecurityDetails = 754 const ResourceResponse::SecurityDetails* responseSecurityDetails =
755 response.getSecurityDetails(); 755 response.getSecurityDetails();
756 m_resourcesData->setCertificate(requestId, 756 m_resourcesData->setCertificate(requestId,
757 responseSecurityDetails->certificate); 757 responseSecurityDetails->certificate);
758 } 758 }
759 759
760 if (resourceResponse && !resourceIsEmpty) 760 String interceptId =
761 response.httpHeaderField(HTTPNames::X_DevTools_Intercept_Id);
762 if (!interceptId.isEmpty()) {
763 const_cast<ResourceResponse&>(response).clearHTTPHeaderField(
764 HTTPNames::X_DevTools_Intercept_Id);
765 }
766
767 if (resourceResponse && !resourceIsEmpty) {
761 frontend()->responseReceived(requestId, frameId, loaderId, 768 frontend()->responseReceived(requestId, frameId, loaderId,
762 monotonicallyIncreasingTime(), 769 monotonicallyIncreasingTime(),
763 InspectorPageAgent::resourceTypeJson(type), 770 InspectorPageAgent::resourceTypeJson(type),
764 std::move(resourceResponse)); 771 std::move(resourceResponse), interceptId);
772 }
765 // If we revalidated the resource and got Not modified, send content length 773 // If we revalidated the resource and got Not modified, send content length
766 // following didReceiveResponse as there will be no calls to didReceiveData 774 // following didReceiveResponse as there will be no calls to didReceiveData
767 // from the network stack. 775 // from the network stack.
768 if (isNotModified && cachedResource && cachedResource->encodedSize()) 776 if (isNotModified && cachedResource && cachedResource->encodedSize())
769 didReceiveData(frame, identifier, 0, cachedResource->encodedSize()); 777 didReceiveData(frame, identifier, 0, cachedResource->encodedSize());
770 } 778 }
771 779
772 static bool isErrorStatusCode(int statusCode) { 780 static bool isErrorStatusCode(int statusCode) {
773 return statusCode >= 400; 781 return statusCode >= 400;
774 } 782 }
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 TaskRunnerHelper::get(TaskType::UnspecedLoading, 1554 TaskRunnerHelper::get(TaskType::UnspecedLoading,
1547 inspectedFrames->root()), 1555 inspectedFrames->root()),
1548 this, 1556 this,
1549 &InspectorNetworkAgent::removeFinishedReplayXHRFired) {} 1557 &InspectorNetworkAgent::removeFinishedReplayXHRFired) {}
1550 1558
1551 bool InspectorNetworkAgent::shouldForceCORSPreflight() { 1559 bool InspectorNetworkAgent::shouldForceCORSPreflight() {
1552 return m_state->booleanProperty(NetworkAgentState::cacheDisabled, false); 1560 return m_state->booleanProperty(NetworkAgentState::cacheDisabled, false);
1553 } 1561 }
1554 1562
1555 } // namespace blink 1563 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698