forked from chromedp/chromedp
/
types.go
238 lines (202 loc) · 7.46 KB
/
types.go
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
package debugger
import (
"errors"
"github.com/knq/chromedp/cdp/runtime"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// AUTOGENERATED. DO NOT EDIT.
// BreakpointID breakpoint identifier.
type BreakpointID string
// String returns the BreakpointID as string value.
func (t BreakpointID) String() string {
return string(t)
}
// CallFrameID call frame identifier.
type CallFrameID string
// String returns the CallFrameID as string value.
func (t CallFrameID) String() string {
return string(t)
}
// Location location in the source code.
type Location struct {
ScriptID runtime.ScriptID `json:"scriptId,omitempty"` // Script identifier as reported in the Debugger.scriptParsed.
LineNumber int64 `json:"lineNumber,omitempty"` // Line number in the script (0-based).
ColumnNumber int64 `json:"columnNumber,omitempty"` // Column number in the script (0-based).
}
// ScriptPosition location in the source code.
type ScriptPosition struct {
LineNumber int64 `json:"lineNumber,omitempty"`
ColumnNumber int64 `json:"columnNumber,omitempty"`
}
// CallFrame javaScript call frame. Array of call frames form the call stack.
type CallFrame struct {
CallFrameID CallFrameID `json:"callFrameId,omitempty"` // Call frame identifier. This identifier is only valid while the virtual machine is paused.
FunctionName string `json:"functionName,omitempty"` // Name of the JavaScript function called on this call frame.
FunctionLocation *Location `json:"functionLocation,omitempty"` // Location in the source code.
Location *Location `json:"location,omitempty"` // Location in the source code.
ScopeChain []*Scope `json:"scopeChain,omitempty"` // Scope chain for this call frame.
This *runtime.RemoteObject `json:"this,omitempty"` // this object for this call frame.
ReturnValue *runtime.RemoteObject `json:"returnValue,omitempty"` // The value being returned, if the function is at return point.
}
// Scope scope description.
type Scope struct {
Type ScopeType `json:"type,omitempty"` // Scope type.
Object *runtime.RemoteObject `json:"object,omitempty"` // Object representing the scope. For global and with scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties.
Name string `json:"name,omitempty"`
StartLocation *Location `json:"startLocation,omitempty"` // Location in the source code where scope starts
EndLocation *Location `json:"endLocation,omitempty"` // Location in the source code where scope ends
}
// SearchMatch search match for resource.
type SearchMatch struct {
LineNumber float64 `json:"lineNumber,omitempty"` // Line number in resource content.
LineContent string `json:"lineContent,omitempty"` // Line with match content.
}
// ScopeType scope type.
type ScopeType string
// String returns the ScopeType as string value.
func (t ScopeType) String() string {
return string(t)
}
// ScopeType values.
const (
ScopeTypeGlobal ScopeType = "global"
ScopeTypeLocal ScopeType = "local"
ScopeTypeWith ScopeType = "with"
ScopeTypeClosure ScopeType = "closure"
ScopeTypeCatch ScopeType = "catch"
ScopeTypeBlock ScopeType = "block"
ScopeTypeScript ScopeType = "script"
ScopeTypeEval ScopeType = "eval"
ScopeTypeModule ScopeType = "module"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ScopeType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ScopeType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ScopeType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ScopeType(in.String()) {
case ScopeTypeGlobal:
*t = ScopeTypeGlobal
case ScopeTypeLocal:
*t = ScopeTypeLocal
case ScopeTypeWith:
*t = ScopeTypeWith
case ScopeTypeClosure:
*t = ScopeTypeClosure
case ScopeTypeCatch:
*t = ScopeTypeCatch
case ScopeTypeBlock:
*t = ScopeTypeBlock
case ScopeTypeScript:
*t = ScopeTypeScript
case ScopeTypeEval:
*t = ScopeTypeEval
case ScopeTypeModule:
*t = ScopeTypeModule
default:
in.AddError(errors.New("unknown ScopeType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ScopeType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// PausedReason pause reason.
type PausedReason string
// String returns the PausedReason as string value.
func (t PausedReason) String() string {
return string(t)
}
// PausedReason values.
const (
PausedReasonXHR PausedReason = "XHR"
PausedReasonDOM PausedReason = "DOM"
PausedReasonEventListener PausedReason = "EventListener"
PausedReasonException PausedReason = "exception"
PausedReasonAssert PausedReason = "assert"
PausedReasonDebugCommand PausedReason = "debugCommand"
PausedReasonPromiseRejection PausedReason = "promiseRejection"
PausedReasonOOM PausedReason = "OOM"
PausedReasonOther PausedReason = "other"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t PausedReason) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t PausedReason) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *PausedReason) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch PausedReason(in.String()) {
case PausedReasonXHR:
*t = PausedReasonXHR
case PausedReasonDOM:
*t = PausedReasonDOM
case PausedReasonEventListener:
*t = PausedReasonEventListener
case PausedReasonException:
*t = PausedReasonException
case PausedReasonAssert:
*t = PausedReasonAssert
case PausedReasonDebugCommand:
*t = PausedReasonDebugCommand
case PausedReasonPromiseRejection:
*t = PausedReasonPromiseRejection
case PausedReasonOOM:
*t = PausedReasonOOM
case PausedReasonOther:
*t = PausedReasonOther
default:
in.AddError(errors.New("unknown PausedReason value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *PausedReason) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// ExceptionsState pause on exceptions mode.
type ExceptionsState string
// String returns the ExceptionsState as string value.
func (t ExceptionsState) String() string {
return string(t)
}
// ExceptionsState values.
const (
ExceptionsStateNone ExceptionsState = "none"
ExceptionsStateUncaught ExceptionsState = "uncaught"
ExceptionsStateAll ExceptionsState = "all"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ExceptionsState) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ExceptionsState) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ExceptionsState) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ExceptionsState(in.String()) {
case ExceptionsStateNone:
*t = ExceptionsStateNone
case ExceptionsStateUncaught:
*t = ExceptionsStateUncaught
case ExceptionsStateAll:
*t = ExceptionsStateAll
default:
in.AddError(errors.New("unknown ExceptionsState value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ExceptionsState) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}