Documentation
¶
Overview ¶
Package devtools provides bounded, read-only diagnostics for one browser page.
Index ¶
- Constants
- type Attribute
- type CompatibilityDiagnostic
- type ConsoleLevel
- type ConsoleRecord
- type DOMNode
- type InspectorSnapshot
- type LayoutBox
- type LayoutFragment
- type NetworkRecord
- type PageStore
- func (store *PageStore) AddConsole(level ConsoleLevel, source, message string)
- func (store *PageStore) AddConsoleForEngine(level ConsoleLevel, engine, source, message string)
- func (store *PageStore) ClearConsole()
- func (store *PageStore) ClearNetwork()
- func (store *PageStore) Close()
- func (store *PageStore) Console() []ConsoleRecord
- func (store *PageStore) Network() []NetworkRecord
- func (store *PageStore) ObserveNetwork(observation network.Observation)
- type RuntimeContext
- type RuntimeSandbox
- type RuntimeScript
- type SessionStore
- type StyleProperty
Constants ¶
const ( DefaultMaxConsoleRecords = 1000 DefaultMaxMessageBytes = 4 * 1024 )
const ( MaxDOMNodes = 2000 MaxDOMDepth = 128 MaxDOMAttributes = 64 MaxInspectorBytes = 4 * 1024 MaxLayoutFragments = 256 )
const ( DefaultMaxNetworkRecords = 2000 DefaultMaxSessionNetworkRecords = 4000 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompatibilityDiagnostic ¶ added in v0.15.0
type CompatibilityDiagnostic struct {
Category string
Subject string
State string
Reason string
Initiator string
Schedule string
Count int
}
CompatibilityDiagnostic is one body-free explanation for a framework-visible resource, style, fallback, or runtime outcome.
type ConsoleLevel ¶
type ConsoleLevel string
ConsoleLevel identifies the severity of a console record.
const ( ConsoleLog ConsoleLevel = "log" ConsoleInfo ConsoleLevel = "info" ConsoleWarn ConsoleLevel = "warn" ConsoleError ConsoleLevel = "error" )
type ConsoleRecord ¶
type ConsoleRecord struct {
Sequence uint64
Level ConsoleLevel
Engine string
Source string
Message string
}
ConsoleRecord is an immutable snapshot of one page console message.
type DOMNode ¶
type DOMNode struct {
ID dom.NodeID
ParentID dom.NodeID
Depth int
Kind string
Name string
Text string
Attributes []Attribute
}
DOMNode is a flattened, read-only DOM tree row.
type InspectorSnapshot ¶
type InspectorSnapshot struct {
Revision uint64
Nodes []DOMNode
Selected dom.NodeID
SelectedNode *DOMNode
Styles []StyleProperty
Layout *LayoutBox
Fragments []LayoutFragment
Truncated bool
}
InspectorSnapshot is a bounded point-in-time view of the active document.
func SnapshotInspector ¶
func SnapshotInspector(document *dom.Document, styles stylemodel.Map, tree *layoutmodel.Tree, selected dom.NodeID) InspectorSnapshot
SnapshotInspector creates a bounded snapshot without retaining browser-owned objects.
func SnapshotInspectorAtRevision ¶ added in v0.14.0
func SnapshotInspectorAtRevision(document *dom.Document, styles stylemodel.Map, tree *layoutmodel.Tree, selected dom.NodeID, revision uint64) InspectorSnapshot
SnapshotInspectorAtRevision creates a bounded snapshot for one render revision. A layout tree from another revision is intentionally ignored.
type LayoutBox ¶
type LayoutBox struct {
X, Y, Width, Height float32
}
LayoutBox is the selected node's document-coordinate bounding box.
type LayoutFragment ¶ added in v0.19.0
LayoutFragment is one paint-ordered visual fragment owned by the selected DOM node. A node can own more than one fragment after inline or column fragmentation even though Layout remains its aggregate bounding box.
type NetworkRecord ¶
type NetworkRecord struct {
Sequence uint64
Method string
URL string
FinalURL string
Kind string
Engine string
Initiator string
Schedule string
StartedAt time.Time
Duration time.Duration
StatusCode int
Redirected bool
CacheStatus string
ResponseBytes int
ErrorCategory string
}
NetworkRecord is immutable request metadata. It never contains bodies or headers.
type PageStore ¶
type PageStore struct {
// contains filtered or unexported fields
}
PageStore owns the diagnostics retained for a single loaded page.
func NewPageStore ¶
func NewPageStore() *PageStore
NewPageStore creates a store with production safety limits.
func NewPageStoreForSession ¶
func NewPageStoreForSession(session *SessionStore) *PageStore
NewPageStoreForSession creates page diagnostics under a shared session budget.
func (*PageStore) AddConsole ¶
func (store *PageStore) AddConsole(level ConsoleLevel, source, message string)
AddConsole appends a bounded console record. Calls after Close are ignored.
func (*PageStore) AddConsoleForEngine ¶ added in v0.13.0
func (store *PageStore) AddConsoleForEngine(level ConsoleLevel, engine, source, message string)
AddConsoleForEngine appends a bounded console record with its Page Runtime Engine.
func (*PageStore) ClearConsole ¶
func (store *PageStore) ClearConsole()
ClearConsole removes retained records without resetting sequence numbers.
func (*PageStore) ClearNetwork ¶
func (store *PageStore) ClearNetwork()
ClearNetwork removes retained request rows without resetting sequence numbers.
func (*PageStore) Close ¶
func (store *PageStore) Close()
Close discards records and prevents callbacks owned by a retired page from writing.
func (*PageStore) Console ¶
func (store *PageStore) Console() []ConsoleRecord
Console returns a copy of all retained records in emission order.
func (*PageStore) Network ¶
func (store *PageStore) Network() []NetworkRecord
Network returns retained request metadata in start-completion order.
func (*PageStore) ObserveNetwork ¶
func (store *PageStore) ObserveNetwork(observation network.Observation)
ObserveNetwork stores one body-free, credential-redacted observation.
type RuntimeContext ¶ added in v0.14.0
type RuntimeContext struct {
Kind string
ID uint64
ParentID uint64
BrowsingGeneration uint64
URL string
Engine string
State string
Scripts []RuntimeScript
ErrorCategories []string
Diagnostics []CompatibilityDiagnostic
Sandbox RuntimeSandbox
}
RuntimeContext is a secret-free diagnostic row for one execution context. URLs are credential- and query-redacted before this value is constructed.
type RuntimeSandbox ¶ added in v0.14.0
type RuntimeSandbox struct {
Ready bool
ProcessBoundary bool
BrokeredHostIO bool
Generation uint64
ConstraintCount int
Failure bool
}
RuntimeSandbox is the bounded capability state reported by one worker.
type RuntimeScript ¶ added in v0.14.0
RuntimeScript is secret-free metadata for one selected page script.
type SessionStore ¶
type SessionStore struct {
// contains filtered or unexported fields
}
SessionStore bounds diagnostics across all pages and tabs in one session.
func NewSessionStore ¶
func NewSessionStore() *SessionStore
NewSessionStore creates a production-bounded session diagnostics budget.
type StyleProperty ¶
StyleProperty is one human-readable computed style value.