File: events.go

package info (click to toggle)
golang-github-chromedp-cdproto 0.0~git20230109.6b041c6-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 4,584 kB
  • sloc: makefile: 2
file content (312 lines) | stat: -rw-r--r-- 19,823 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
package network

// Code generated by cdproto-gen. DO NOT EDIT.

import (
	"github.com/chromedp/cdproto/cdp"
)

// EventDataReceived fired when data chunk was received over the network.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-dataReceived
type EventDataReceived struct {
	RequestID         RequestID          `json:"requestId"`         // Request identifier.
	Timestamp         *cdp.MonotonicTime `json:"timestamp"`         // Timestamp.
	DataLength        int64              `json:"dataLength"`        // Data chunk length.
	EncodedDataLength int64              `json:"encodedDataLength"` // Actual bytes received (might be less than dataLength for compressed encodings).
}

// EventEventSourceMessageReceived fired when EventSource message is
// received.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-eventSourceMessageReceived
type EventEventSourceMessageReceived struct {
	RequestID RequestID          `json:"requestId"` // Request identifier.
	Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
	EventName string             `json:"eventName"` // Message type.
	EventID   string             `json:"eventId"`   // Message identifier.
	Data      string             `json:"data"`      // Message content.
}

// EventLoadingFailed fired when HTTP request has failed to load.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-loadingFailed
type EventLoadingFailed struct {
	RequestID       RequestID          `json:"requestId"`                 // Request identifier.
	Timestamp       *cdp.MonotonicTime `json:"timestamp"`                 // Timestamp.
	Type            ResourceType       `json:"type"`                      // Resource type.
	ErrorText       string             `json:"errorText"`                 // User friendly error message.
	Canceled        bool               `json:"canceled,omitempty"`        // True if loading was canceled.
	BlockedReason   BlockedReason      `json:"blockedReason,omitempty"`   // The reason why loading was blocked, if any.
	CorsErrorStatus *CorsErrorStatus   `json:"corsErrorStatus,omitempty"` // The reason why loading was blocked by CORS, if any.
}

// EventLoadingFinished fired when HTTP request has finished loading.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-loadingFinished
type EventLoadingFinished struct {
	RequestID                RequestID          `json:"requestId"`                          // Request identifier.
	Timestamp                *cdp.MonotonicTime `json:"timestamp"`                          // Timestamp.
	EncodedDataLength        float64            `json:"encodedDataLength"`                  // Total number of bytes received for this request.
	ShouldReportCorbBlocking bool               `json:"shouldReportCorbBlocking,omitempty"` // Set when 1) response was blocked by Cross-Origin Read Blocking and also 2) this needs to be reported to the DevTools console.
}

// EventRequestServedFromCache fired if request ended up loading from cache.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-requestServedFromCache
type EventRequestServedFromCache struct {
	RequestID RequestID `json:"requestId"` // Request identifier.
}

// EventRequestWillBeSent fired when page is about to send HTTP request.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-requestWillBeSent
type EventRequestWillBeSent struct {
	RequestID            RequestID           `json:"requestId"`                  // Request identifier.
	LoaderID             cdp.LoaderID        `json:"loaderId"`                   // Loader identifier. Empty string if the request is fetched from worker.
	DocumentURL          string              `json:"documentURL"`                // URL of the document this request is loaded for.
	Request              *Request            `json:"request"`                    // Request data.
	Timestamp            *cdp.MonotonicTime  `json:"timestamp"`                  // Timestamp.
	WallTime             *cdp.TimeSinceEpoch `json:"wallTime"`                   // Timestamp.
	Initiator            *Initiator          `json:"initiator"`                  // Request initiator.
	RedirectHasExtraInfo bool                `json:"redirectHasExtraInfo"`       // In the case that redirectResponse is populated, this flag indicates whether requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be or were emitted for the request which was just redirected.
	RedirectResponse     *Response           `json:"redirectResponse,omitempty"` // Redirect response data.
	Type                 ResourceType        `json:"type,omitempty"`             // Type of this resource.
	FrameID              cdp.FrameID         `json:"frameId,omitempty"`          // Frame identifier.
	HasUserGesture       bool                `json:"hasUserGesture,omitempty"`   // Whether the request is initiated by a user gesture. Defaults to false.
}

// EventResourceChangedPriority fired when resource loading priority is
// changed.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-resourceChangedPriority
type EventResourceChangedPriority struct {
	RequestID   RequestID          `json:"requestId"`   // Request identifier.
	NewPriority ResourcePriority   `json:"newPriority"` // New priority
	Timestamp   *cdp.MonotonicTime `json:"timestamp"`   // Timestamp.
}

// EventSignedExchangeReceived fired when a signed exchange was received over
// the network.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-signedExchangeReceived
type EventSignedExchangeReceived struct {
	RequestID RequestID           `json:"requestId"` // Request identifier.
	Info      *SignedExchangeInfo `json:"info"`      // Information about the signed exchange response.
}

// EventResponseReceived fired when HTTP response is available.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-responseReceived
type EventResponseReceived struct {
	RequestID    RequestID          `json:"requestId"`         // Request identifier.
	LoaderID     cdp.LoaderID       `json:"loaderId"`          // Loader identifier. Empty string if the request is fetched from worker.
	Timestamp    *cdp.MonotonicTime `json:"timestamp"`         // Timestamp.
	Type         ResourceType       `json:"type"`              // Resource type.
	Response     *Response          `json:"response"`          // Response data.
	HasExtraInfo bool               `json:"hasExtraInfo"`      // Indicates whether requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be or were emitted for this request.
	FrameID      cdp.FrameID        `json:"frameId,omitempty"` // Frame identifier.
}

// EventWebSocketClosed fired when WebSocket is closed.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-webSocketClosed
type EventWebSocketClosed struct {
	RequestID RequestID          `json:"requestId"` // Request identifier.
	Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
}

// EventWebSocketCreated fired upon WebSocket creation.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-webSocketCreated
type EventWebSocketCreated struct {
	RequestID RequestID  `json:"requestId"`           // Request identifier.
	URL       string     `json:"url"`                 // WebSocket request URL.
	Initiator *Initiator `json:"initiator,omitempty"` // Request initiator.
}

// EventWebSocketFrameError fired when WebSocket message error occurs.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-webSocketFrameError
type EventWebSocketFrameError struct {
	RequestID    RequestID          `json:"requestId"`    // Request identifier.
	Timestamp    *cdp.MonotonicTime `json:"timestamp"`    // Timestamp.
	ErrorMessage string             `json:"errorMessage"` // WebSocket error message.
}

// EventWebSocketFrameReceived fired when WebSocket message is received.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-webSocketFrameReceived
type EventWebSocketFrameReceived struct {
	RequestID RequestID          `json:"requestId"` // Request identifier.
	Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
	Response  *WebSocketFrame    `json:"response"`  // WebSocket response data.
}

// EventWebSocketFrameSent fired when WebSocket message is sent.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-webSocketFrameSent
type EventWebSocketFrameSent struct {
	RequestID RequestID          `json:"requestId"` // Request identifier.
	Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
	Response  *WebSocketFrame    `json:"response"`  // WebSocket response data.
}

// EventWebSocketHandshakeResponseReceived fired when WebSocket handshake
// response becomes available.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-webSocketHandshakeResponseReceived
type EventWebSocketHandshakeResponseReceived struct {
	RequestID RequestID          `json:"requestId"` // Request identifier.
	Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
	Response  *WebSocketResponse `json:"response"`  // WebSocket response data.
}

// EventWebSocketWillSendHandshakeRequest fired when WebSocket is about to
// initiate handshake.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-webSocketWillSendHandshakeRequest
type EventWebSocketWillSendHandshakeRequest struct {
	RequestID RequestID           `json:"requestId"` // Request identifier.
	Timestamp *cdp.MonotonicTime  `json:"timestamp"` // Timestamp.
	WallTime  *cdp.TimeSinceEpoch `json:"wallTime"`  // UTC Timestamp.
	Request   *WebSocketRequest   `json:"request"`   // WebSocket request data.
}

// EventWebTransportCreated fired upon WebTransport creation.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-webTransportCreated
type EventWebTransportCreated struct {
	TransportID RequestID          `json:"transportId"`         // WebTransport identifier.
	URL         string             `json:"url"`                 // WebTransport request URL.
	Timestamp   *cdp.MonotonicTime `json:"timestamp"`           // Timestamp.
	Initiator   *Initiator         `json:"initiator,omitempty"` // Request initiator.
}

// EventWebTransportConnectionEstablished fired when WebTransport handshake
// is finished.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-webTransportConnectionEstablished
type EventWebTransportConnectionEstablished struct {
	TransportID RequestID          `json:"transportId"` // WebTransport identifier.
	Timestamp   *cdp.MonotonicTime `json:"timestamp"`   // Timestamp.
}

// EventWebTransportClosed fired when WebTransport is disposed.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-webTransportClosed
type EventWebTransportClosed struct {
	TransportID RequestID          `json:"transportId"` // WebTransport identifier.
	Timestamp   *cdp.MonotonicTime `json:"timestamp"`   // Timestamp.
}

// EventRequestWillBeSentExtraInfo fired when additional information about a
// requestWillBeSent event is available from the network stack. Not every
// requestWillBeSent event will have an additional requestWillBeSentExtraInfo
// fired for it, and there is no guarantee whether requestWillBeSent or
// requestWillBeSentExtraInfo will be fired first for the same request.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-requestWillBeSentExtraInfo
type EventRequestWillBeSentExtraInfo struct {
	RequestID                     RequestID                  `json:"requestId"`                               // Request identifier. Used to match this information to an existing requestWillBeSent event.
	AssociatedCookies             []*BlockedCookieWithReason `json:"associatedCookies"`                       // A list of cookies potentially associated to the requested URL. This includes both cookies sent with the request and the ones not sent; the latter are distinguished by having blockedReason field set.
	Headers                       Headers                    `json:"headers"`                                 // Raw request headers as they will be sent over the wire.
	ConnectTiming                 *ConnectTiming             `json:"connectTiming"`                           // Connection timing information for the request.
	ClientSecurityState           *ClientSecurityState       `json:"clientSecurityState,omitempty"`           // The client security state set for the request.
	SiteHasCookieInOtherPartition bool                       `json:"siteHasCookieInOtherPartition,omitempty"` // Whether the site has partitioned cookies stored in a partition different than the current one.
}

// EventResponseReceivedExtraInfo fired when additional information about a
// responseReceived event is available from the network stack. Not every
// responseReceived event will have an additional responseReceivedExtraInfo for
// it, and responseReceivedExtraInfo may be fired before or after
// responseReceived.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-responseReceivedExtraInfo
type EventResponseReceivedExtraInfo struct {
	RequestID              RequestID                     `json:"requestId"`              // Request identifier. Used to match this information to another responseReceived event.
	BlockedCookies         []*BlockedSetCookieWithReason `json:"blockedCookies"`         // A list of cookies which were not stored from the response along with the corresponding reasons for blocking. The cookies here may not be valid due to syntax errors, which are represented by the invalid cookie line string instead of a proper cookie.
	Headers                Headers                       `json:"headers"`                // Raw response headers as they were received over the wire.
	ResourceIPAddressSpace IPAddressSpace                `json:"resourceIPAddressSpace"` // The IP address space of the resource. The address space can only be determined once the transport established the connection, so we can't send it in requestWillBeSentExtraInfo.
	StatusCode             int64                         `json:"statusCode"`             // The status code of the response. This is useful in cases the request failed and no responseReceived event is triggered, which is the case for, e.g., CORS errors. This is also the correct status code for cached requests, where the status in responseReceived is a 200 and this will be 304.
	HeadersText            string                        `json:"headersText,omitempty"`  // Raw response header text as it was received over the wire. The raw text may not always be available, such as in the case of HTTP/2 or QUIC.
}

// EventTrustTokenOperationDone fired exactly once for each Trust Token
// operation. Depending on the type of the operation and whether the operation
// succeeded or failed, the event is fired before the corresponding request was
// sent or after the response was received.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-trustTokenOperationDone
type EventTrustTokenOperationDone struct {
	Status           TrustTokenOperationDoneStatus `json:"status"` // Detailed success or error status of the operation. 'AlreadyExists' also signifies a successful operation, as the result of the operation already exists und thus, the operation was abort preemptively (e.g. a cache hit).
	Type             TrustTokenOperationType       `json:"type"`
	RequestID        RequestID                     `json:"requestId"`
	TopLevelOrigin   string                        `json:"topLevelOrigin,omitempty"`   // Top level origin. The context in which the operation was attempted.
	IssuerOrigin     string                        `json:"issuerOrigin,omitempty"`     // Origin of the issuer in case of a "Issuance" or "Redemption" operation.
	IssuedTokenCount int64                         `json:"issuedTokenCount,omitempty"` // The number of obtained Trust Tokens on a successful "Issuance" operation.
}

// EventSubresourceWebBundleMetadataReceived fired once when parsing the .wbn
// file has succeeded. The event contains the information about the web bundle
// contents.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-subresourceWebBundleMetadataReceived
type EventSubresourceWebBundleMetadataReceived struct {
	RequestID RequestID `json:"requestId"` // Request identifier. Used to match this information to another event.
	Urls      []string  `json:"urls"`      // A list of URLs of resources in the subresource Web Bundle.
}

// EventSubresourceWebBundleMetadataError fired once when parsing the .wbn
// file has failed.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-subresourceWebBundleMetadataError
type EventSubresourceWebBundleMetadataError struct {
	RequestID    RequestID `json:"requestId"`    // Request identifier. Used to match this information to another event.
	ErrorMessage string    `json:"errorMessage"` // Error message
}

// EventSubresourceWebBundleInnerResponseParsed fired when handling requests
// for resources within a .wbn file. Note: this will only be fired for resources
// that are requested by the webpage.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-subresourceWebBundleInnerResponseParsed
type EventSubresourceWebBundleInnerResponseParsed struct {
	InnerRequestID  RequestID `json:"innerRequestId"`            // Request identifier of the subresource request
	InnerRequestURL string    `json:"innerRequestURL"`           // URL of the subresource resource.
	BundleRequestID RequestID `json:"bundleRequestId,omitempty"` // Bundle request identifier. Used to match this information to another event. This made be absent in case when the instrumentation was enabled only after webbundle was parsed.
}

// EventSubresourceWebBundleInnerResponseError fired when request for
// resources within a .wbn file failed.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-subresourceWebBundleInnerResponseError
type EventSubresourceWebBundleInnerResponseError struct {
	InnerRequestID  RequestID `json:"innerRequestId"`            // Request identifier of the subresource request
	InnerRequestURL string    `json:"innerRequestURL"`           // URL of the subresource resource.
	ErrorMessage    string    `json:"errorMessage"`              // Error message
	BundleRequestID RequestID `json:"bundleRequestId,omitempty"` // Bundle request identifier. Used to match this information to another event. This made be absent in case when the instrumentation was enabled only after webbundle was parsed.
}

// EventReportingAPIReportAdded is sent whenever a new report is added. And
// after 'enableReportingApi' for all existing reports.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-reportingApiReportAdded
type EventReportingAPIReportAdded struct {
	Report *ReportingAPIReport `json:"report"`
}

// EventReportingAPIReportUpdated [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-reportingApiReportUpdated
type EventReportingAPIReportUpdated struct {
	Report *ReportingAPIReport `json:"report"`
}

// EventReportingAPIEndpointsChangedForOrigin [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-reportingApiEndpointsChangedForOrigin
type EventReportingAPIEndpointsChangedForOrigin struct {
	Origin    string                  `json:"origin"` // Origin of the document(s) which configured the endpoints.
	Endpoints []*ReportingAPIEndpoint `json:"endpoints"`
}