Skip to content

Commit 2f0062b

Browse files
committed
add comments documenting the new callbacks
1 parent c485553 commit 2f0062b

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

runtime/src/main/jni/NetworkDomainCallbackHandlers.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ namespace NetworkDomainCallbackHandlers {
1717
static const char* FrameId = "NSFrameIdentifier";
1818
static const char* LoaderId = "NSLoaderIdentifier";
1919

20+
/*
21+
* Fired when device is about to send HTTP request.
22+
* @param args - JS object : { requestId, timestamp, type, response }
23+
*/
2024
static void ResponseReceivedCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
2125
try {
2226
auto networkAgentInstance = V8NetworkAgentImpl::Instance;
@@ -90,6 +94,10 @@ static void ResponseReceivedCallback(const v8::FunctionCallbackInfo<v8::Value>&
9094
}
9195
}
9296

97+
/*
98+
* Fired when HTTP response is available.
99+
* @param args - JS object { requestId, url, request, timestamp, type }
100+
*/
93101
static void RequestWillBeSentCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
94102
try {
95103
auto networkAgentInstance = V8NetworkAgentImpl::Instance;
@@ -164,6 +172,10 @@ static void RequestWillBeSentCallback(const v8::FunctionCallbackInfo<v8::Value>&
164172
}
165173
}
166174

175+
/*
176+
* Called after response is received to save the response data for the provided requestId
177+
* @param args - JS object { requestId, data, hasTextContent }
178+
*/
167179
static void DataForRequestId(const v8::FunctionCallbackInfo<v8::Value>& args) {
168180
try {
169181
auto networkAgentInstance = V8NetworkAgentImpl::Instance;
@@ -229,6 +241,10 @@ static void DataForRequestId(const v8::FunctionCallbackInfo<v8::Value>& args) {
229241
}
230242
}
231243

244+
/*
245+
* Fired when HTTP request has finished loading.
246+
* @param args - JS object { requestId, timestamp }
247+
*/
232248
static void LoadingFinishedCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
233249
try {
234250
auto networkAgentInstance = V8NetworkAgentImpl::Instance;

runtime/src/main/jni/v8_inspector/src/inspector/v8-network-agent-impl.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,24 @@ class V8NetworkAgentImpl : public protocol::Network::Backend {
2626
void enable(ErrorString*) override;
2727
void disable(ErrorString*) override;
2828

29+
/*
30+
* NOT supported
31+
*/
2932
void setExtraHTTPHeaders(ErrorString*, std::unique_ptr<protocol::Network::Headers> in_headers) override;
33+
34+
/*
35+
* Returns content served for the given request.
36+
* The content of each response is stored in `m_responses` when a request completes.
37+
* @param in_requestId
38+
*/
3039
void getResponseBody(ErrorString*, const String& in_requestId, String* out_body, bool* out_base64Encoded) override;
40+
/*
41+
* NOT supported
42+
*/
3143
void setCacheDisabled(ErrorString*, bool in_cacheDisabled) override;
44+
/*
45+
* NOT supported
46+
*/
3247
void loadResource(const String& in_frameId, const String& in_url, std::unique_ptr<LoadResourceCallback> callback) override;
3348

3449
const bool enabled() {

0 commit comments

Comments
 (0)