Catalog
fauziyasin-s2m4qw/devtools-source-maps

fauziyasin-s2m4qw

devtools-source-maps

Guidelines for utilizing source maps and structured stack traces in DevTools. Covers DebuggerWorkspaceBinding, StackTrace, SymbolizedError, and related UI widgets.

v1.0LATEST
NewUpdated Oct 20, 2026

Utilizing Source Maps & Structured Stack Traces in DevTools

This skill guides you on how to correctly map runtime coordinates to original source locations and render structured stack traces or symbolized errors in the DevTools frontend.


1. Primary Rules

  1. Never parse raw error stacks manually: Do not split on newlines or use homebrew regex to parse stack traces. Use DebuggerWorkspaceBinding helpers to structurally parse and translate stack traces.
  2. Dispose of subscriptions: Models like SymbolizedError subscribe to live locations. Always call .dispose() when the consumer (e.g., a widget or list) is destroyed to avoid memory leaks.
  3. Prefer pre-built widgets: Instead of manually formatting or rendering call frames, use StackTracePreviewContent for raw stacks, and SymbolizedErrorWidget for complete errors.

2. Core Abstractions

A. StackTrace Model (front_end/models/stack_trace/)

A structured representation of a call stack (synchronous + asynchronous segments).

  • StackTrace / ParsedErrorStackTrace / DebuggableStackTrace: Dispatches a StackTrace.Events.UPDATED event when the original sources are fully resolved or update.
  • Frame: Represents a single frame, which contains uiSourceCode, url, line/column info, untranslated rawName, translated name, and inline information.

B. SymbolizedError Model (front_end/models/bindings/SymbolizedError.ts)

A union type representing a fully symbolized error.

  • SymbolizedErrorObject: Contains error message, stackTrace (as a ParsedErrorStackTrace), and an optional cause (another SymbolizedError). Also holds compile/eval syntaxErrorLocation.
  • UnparsableError: Fallback when parsing fails.

3. Core APIs on DebuggerWorkspaceBinding

Location Translation

Translates raw coordinates into UI-friendly original source coordinates:

const uiLocation = await Bindings.DebuggerWorkspaceBinding.instance()
    .rawLocationToUILocation(rawLocation);

StackTrace & Error Generation

  • From Protocol Stack Trace (Runtime Domain):
    const stack = await Bindings.DebuggerWorkspaceBinding.instance()
        .createStackTraceFromProtocolRuntime(protocolStackTrace, target);
    
  • From Debugger Pause details:
    const stack = await Bindings.DebuggerWorkspaceBinding.instance()
        .createStackTraceFromDebuggerPaused(pausedDetails, target);
    
  • From a Raw Error Stack string:
    const stack = await Bindings.DebuggerWorkspaceBinding.instance()
        .createStackTraceFromErrorStackLikeString(target, stackString, exceptionDetails);
    
  • From a Remote Error Object:
    const symbolizedError = await Bindings.DebuggerWorkspaceBinding.instance()
        .createSymbolizedError(remoteObject, exceptionDetails);
    

4. UI Widget Reference

StackTracePreviewContent

Renders a structured StackTrace inside Shadow DOM. Handles expandable UI and collapsing ignore-listed files.

import * as Components from '../../ui/legacy/components/utils/utils.js';
import * as Workspace from '../../models/workspace/workspace.js';

const preview = new Components.JSPresentationUtils.StackTracePreviewContent();
preview.stackTrace = stackTrace;
preview.options = {
  expandable: true,
  showColumnNumber: true,
  ignoreListManager: Workspace.IgnoreListManager.IgnoreListManager.instance(),
};
this.contentElement.appendChild(preview.element);

SymbolizedErrorWidget

Displays a complete SymbolizedError including recursive causal chains ("Caused by: ...") and syntax error locations.

import * as Panels from '../../panels/panels.js';
import * as Workspace from '../../models/workspace/workspace.js';

const errorWidget = new Panels.Console.SymbolizedErrorWidget();
errorWidget.error = symbolizedError;
errorWidget.ignoreListManager = Workspace.IgnoreListManager.IgnoreListManager
    .instance();
this.contentElement.appendChild(errorWidget.element);

5. Verification Checklist

  1. Check for Memory Leaks: Verify symbolizedError.dispose() is called on consumer widget cleanup.
  2. Ignore-listing Support: Ensure widgets have ignoreListManager set.
  3. WASM/Inline Support: Check that inline and WebAssembly frames map correctly via original source maps.

Overall Score

87/100

Grade

A

Excellent

Grades are signals, not a certification. Always review a skill yourself before use.

Safety

94

Quality

86

Clarity

88

Completeness

78

Summary

This skill provides DevTools frontend developers with structured guidance on correctly using source maps and stack trace abstractions. It covers the DebuggerWorkspaceBinding API, StackTrace and SymbolizedError models, and pre-built UI widgets for rendering call frames and errors. The skill emphasizes using built-in helpers instead of manual parsing, proper subscription disposal to prevent memory leaks, and integration with ignore-listing and WASM source mapping.

Static Analysis Findings

1 finding

Patterns detected by deterministic static analysis before AI scoring. Hover over any finding code for detailed information and remediation guidance.

Command Injection
SEC-011Dynamic Shell Eval

Shell eval/exec of dynamic content

SKILL.mdeval `

Detected Capabilities

code referenceapi documentationmemory management guidanceui component usage

Trigger Keywords

Phrases that agents use to match this skill to user intent.

stack trace renderingsymbolized errorsdevtools source mapserror widgetmemory leak preventionignore list filtering

Risk Signals

INFO

SEC-011: 'eval' keyword detected in static analysis pre-scan

SKILL.md

Use Cases

  • Render stack traces in DevTools console panels with proper source map resolution
  • Display symbolized errors with causal chains and syntax error locations
  • Translate raw protocol-level coordinates to original source locations
  • Prevent memory leaks when consuming StackTrace and SymbolizedError models
  • Render call frames while respecting ignore-list filtering rules

Quality Notes

  • Skill provides clear abstractions (StackTrace, SymbolizedError, DebuggerWorkspaceBinding) with practical purpose and constraints
  • Memory leak prevention is explicitly prioritized via subscription disposal guidance
  • Code examples are accurate, self-contained, and demonstrate proper API usage patterns
  • Core rules prevent common pitfalls (manual regex parsing, unmanaged subscriptions, missing ignore-listing)
  • Verification checklist gives developers concrete testing criteria
  • Skill is scoped to DevTools frontend architecture — no system-wide operations or external dependencies
  • No external network access, file writes, or privilege escalation patterns detected
  • API documentation is comprehensive but could benefit from error handling patterns (e.g., what happens if source maps fail to load)
Model: claude-haiku-4-5-20251001Analyzed: Oct 20, 2026

Reviews

Add this skill to your library to leave a review.

No reviews yet

Be the first to share your experience.

Use fauziyasin-s2m4qw/devtools-source-maps in your dev environment

Command Palette

Search for a command to run...