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

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

Issue 2094903002: [Devtools] Fixed websocket initiators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed initiators for websockets Created 4 years, 5 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 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 return initiatorObject; 812 return initiatorObject;
813 } 813 }
814 814
815 if (m_isRecalculatingStyle && m_styleRecalculationInitiator) 815 if (m_isRecalculatingStyle && m_styleRecalculationInitiator)
816 return m_styleRecalculationInitiator->clone(); 816 return m_styleRecalculationInitiator->clone();
817 817
818 return protocol::Network::Initiator::create() 818 return protocol::Network::Initiator::create()
819 .setType(protocol::Network::Initiator::TypeEnum::Other).build(); 819 .setType(protocol::Network::Initiator::TypeEnum::Other).build();
820 } 820 }
821 821
822 void InspectorNetworkAgent::didCreateWebSocket(Document*, unsigned long identifi er, const KURL& requestURL, const String&) 822 void InspectorNetworkAgent::didCreateWebSocket(Document* document, unsigned long identifier, const KURL& requestURL, const String&)
823 { 823 {
824 frontend()->webSocketCreated(IdentifiersFactory::requestId(identifier), urlW ithoutFragment(requestURL).getString()); 824 std::unique_ptr<protocol::Runtime::StackTrace> currentStackTrace = SourceLoc ation::capture(document)->buildInspectorObject();
825 if (!currentStackTrace) {
826 frontend()->webSocketCreated(IdentifiersFactory::requestId(identifier), urlWithoutFragment(requestURL).getString());
827 return;
828 }
829
830 std::unique_ptr<protocol::Network::Initiator> initiatorObject = protocol::Ne twork::Initiator::create()
831 .setType(protocol::Network::Initiator::TypeEnum::Script).build();
832 initiatorObject->setStack(std::move(currentStackTrace));
833 frontend()->webSocketCreated(IdentifiersFactory::requestId(identifier), urlW ithoutFragment(requestURL).getString(), std::move(initiatorObject));
825 } 834 }
826 835
827 void InspectorNetworkAgent::willSendWebSocketHandshakeRequest(Document*, unsigne d long identifier, const WebSocketHandshakeRequest* request) 836 void InspectorNetworkAgent::willSendWebSocketHandshakeRequest(Document*, unsigne d long identifier, const WebSocketHandshakeRequest* request)
828 { 837 {
829 DCHECK(request); 838 DCHECK(request);
830 std::unique_ptr<protocol::Network::WebSocketRequest> requestObject = protoco l::Network::WebSocketRequest::create() 839 std::unique_ptr<protocol::Network::WebSocketRequest> requestObject = protoco l::Network::WebSocketRequest::create()
831 .setHeaders(buildObjectForHeaders(request->headerFields())).build(); 840 .setHeaders(buildObjectForHeaders(request->headerFields())).build();
832 frontend()->webSocketWillSendHandshakeRequest(IdentifiersFactory::requestId( identifier), monotonicallyIncreasingTime(), currentTime(), std::move(requestObje ct)); 841 frontend()->webSocketWillSendHandshakeRequest(IdentifiersFactory::requestId( identifier), monotonicallyIncreasingTime(), currentTime(), std::move(requestObje ct));
833 } 842 }
834 843
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 , m_removeFinishedReplayXHRTimer(this, &InspectorNetworkAgent::removeFinishe dReplayXHRFired) 1132 , m_removeFinishedReplayXHRTimer(this, &InspectorNetworkAgent::removeFinishe dReplayXHRFired)
1124 { 1133 {
1125 } 1134 }
1126 1135
1127 bool InspectorNetworkAgent::shouldForceCORSPreflight() 1136 bool InspectorNetworkAgent::shouldForceCORSPreflight()
1128 { 1137 {
1129 return m_state->booleanProperty(NetworkAgentState::cacheDisabled, false); 1138 return m_state->booleanProperty(NetworkAgentState::cacheDisabled, false);
1130 } 1139 }
1131 1140
1132 } // namespace blink 1141 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698