← All Learning Paths

Browser Extension Developer

A path for browser extension developers: web components, content scripts, background messaging, CSP, caching, and DOM event handling.

roleintermediate11 nodes12.92h total

Path overview

浏览器扩展运行在宿主页面与后台脚本之间,需要同时处理 DOM 注入、跨上下文通信、内容安全策略与资源缓存。本路径从 Web Components 与内容脚本的 DOM 基础入手,逐步覆盖数据抓取与缓存、CSP/CORS 约束、实时消息通道以及浏览器内存泄漏排查。

This path equips browser extension developers with the platform fundamentals they actually use: web components and content scripts, data fetching and caching, CSP and CORS boundaries, real-time messaging, and memory-leak debugging.

  1. Run the browser extension snippet "Custom Elements API", capture stdout, and show which line demonstrates the documented behavior: "Defines a custom HTML element with lifecycle callbacks, observed attributes, and Shadow DOM".

    Completion criteria: Change one constant in "Custom Elements API", rerun, and attach both stdout captures plus a one-line diff explaining what moved.

    Next step: Slots for Web Component Composition

    ⏱ 0.75h

  2. Adapt "Slots for Web Component Composition" to a second input and compare the new output with the behavior described in "Uses slot elements with named and default slots to create flexible web component templates".

    Prerequisites: Custom Elements API

    Completion criteria: Paste the command, the exit code, and the output line matching "Uses slot elements with named and default slots to create flexible web component templates"; then show a second run with a changed parameter.

    Next step: Template Element for Reusable HTML

    ⏱ 0.75h

  3. Execute "Template Element for Reusable HTML", change one constant, and describe how the output diverges from "Uses the template element to define reusable HTML fragments that can be cloned and inserted".

    Prerequisites: Slots for Web Component Composition

    Completion criteria: Save two runs of "Template Element for Reusable HTML" side by side — the original input and one changed value — and annotate the line where the output diverges.

    Next step: Data Attributes for Custom Data

    ⏱ 0.75h

  4. Run the browser extension snippet "Data Attributes for Custom Data", capture stdout, and show which line demonstrates the documented behavior: "Uses data attributes to store custom data in HTML elements, accessed via JavaScript dataset".

    Prerequisites: Template Element for Reusable HTML

    Completion criteria: Attach the terminal transcript for "Data Attributes for Custom Data": command, exit code, and the printed result you used to confirm "Uses data attributes to store custom data in HTML elements, accessed via JavaScript dataset".

    Next step: Vanilla JavaScript Data Fetching

    ⏱ 0.75h

  5. Adapt "Vanilla JavaScript Data Fetching" to a second input and compare the new output with the behavior described in "Fetch and render remote data with vanilla JavaScript using async/await, AbortController for".

    Prerequisites: Data Attributes for Custom Data

    Completion criteria: Change one constant in "Vanilla JavaScript Data Fetching", rerun, and attach both stdout captures plus a one-line diff explaining what moved.

    Next step: JavaScript Fetch with Caching

    ⏱ 0.75h

  6. Execute "JavaScript Fetch with Caching", change one constant, and describe how the output diverges from "Implement a cached fetch wrapper in vanilla JavaScript using the Cache API with".

    Prerequisites: Vanilla JavaScript Data Fetching

    Completion criteria: Paste the command, the exit code, and the output line matching "Implement a cached fetch wrapper in vanilla JavaScript using the Cache API with"; then show a second run with a changed parameter.

    Next step: Building Real-time Features with WebSockets

    ⏱ 0.75h

  7. Reconstruct the reasoning behind "Building Real-time Features with WebSockets" by tracing "The Connection Lifecycle" to the failure it prevents in browser extension systems.

    Completion criteria: Record a short walkthrough of "Building Real-time Features with WebSockets" with timestamps at "The Connection Lifecycle" and "Heartbeats and Detecting Dead Connections", plus the commit that applies it.

    Next step: DOM Event Propagation Visualizer

    ⏱ 1h

  8. Run two different inputs through "DOM Event Propagation Visualizer" and show where the outputs diverge.

    Completion criteria: Paste two input/output pairs from "DOM Event Propagation Visualizer" and annotate the one where "Visualize DOM event capturing, targeting, and bubbling phases in real time." changes the result.

    Next step: Typed Web Streams Transform Pipeline

    ⏱ 0.25h

  9. Execute "Typed Web Streams Transform Pipeline", change one constant, and describe how the output diverges from "Split byte chunks into decoded text lines with a TransformStream, enforce a line-size".

    Prerequisites: DOM Event Propagation Visualizer

    Completion criteria: Change one constant in "Typed Web Streams Transform Pipeline", rerun, and attach both stdout captures plus a one-line diff explaining what moved.

    Next step: Validate Browser Extension Message Routing

    ⏱ 0.75h

  10. In the "Browser Extension Developer" path, implement "Validate Browser Extension Message Routing" so JSON object: { routes: { [sender]: string[] }, messages: [{ from, to, yields {routed:[m1],rejected:[{id:m2,reason:route-not-allowed}]}, including the second sample's edge case.

    Prerequisites: Typed Web Streams Transform Pipeline

    Completion criteria: Attach the solution file for "Browser Extension Developer", two passing sample runs, and one failing run whose error matches the contract.

    Next step: Capstone: Browser Extension Developer

    ⏱ 0.42h

  11. Ship "SSRF guard" from "Build a URL Metadata Scraper Service", then prove it with the project's test suite and an acceptance note.

    Prerequisites: Typed Web Streams Transform Pipeline, Validate Browser Extension Message Routing

    Completion criteria: Deliver "SSRF guard" and paste the test output where the acceptance test passes; include the test name and command.

    Next step: Run the capstone's tests, publish the repository, and demo it to a reviewer.

    ⏱ 4h