devtools

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package devtools provides bounded, read-only diagnostics for one browser page.

Index

Constants

View Source
const (
	DefaultMaxConsoleRecords = 1000
	DefaultMaxMessageBytes   = 4 * 1024
)
View Source
const (
	MaxDOMNodes       = 2000
	MaxDOMDepth       = 128
	MaxDOMAttributes  = 64
	MaxInspectorBytes = 4 * 1024
)
View Source
const (
	DefaultMaxNetworkRecords        = 500
	DefaultMaxSessionNetworkRecords = 4000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	Name  string
	Value string
}

Attribute is one sorted, bounded public DOM attribute.

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 {
	Nodes        []DOMNode
	Selected     dom.NodeID
	SelectedNode *DOMNode
	Styles       []StyleProperty
	Layout       *LayoutBox
	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.

type LayoutBox

type LayoutBox struct {
	X, Y, Width, Height float32
}

LayoutBox is the selected node's document-coordinate bounding box.

type NetworkRecord

type NetworkRecord struct {
	Sequence      uint64
	Method        string
	URL           string
	Kind          string
	Engine        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 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

type StyleProperty struct {
	Name  string
	Value string
}

StyleProperty is one human-readable computed style value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL