Inspect Extension Content Scripts & Service Workers
Find content scripts and Manifest V3 workers in Chrome extension packages. Review match patterns and source while separating static clues from runtime behavior.
To inspect Chrome extension content scripts and background service workers, use Extension X-Ray to browse the packaged source tree. Manifest V3 replaces background pages with ephemeral service workers, declared under background.service_worker in manifest.json. Extension X-Ray displays all injected content scripts, match patterns, and service worker scripts in clear syntax-highlighted code without executing untrusted scripts.

1. How Chrome Extensions Execute Code: Content Scripts vs Background Service Workers
Browser extensions operate across two distinct JavaScript runtime execution contexts: Content Scripts and Background Service Workers. Understanding the boundary between these two contexts is vital for security analysis.
Content Scripts execute directly inside the context of web pages you visit. While they run in an isolated JavaScript world that prevents page scripts from reading extension variables, content scripts have direct read and write access to the page DOM. An untrusted or poorly written content script can read input fields, capture keystrokes, or exfiltrate sensitive document contents.
Background Service Workers serve as the central coordination hub. Under Manifest V3, persistent background pages have been replaced by event-driven service workers that spin up in response to specific browser events and terminate when idle.
The Isolated World Advantage
Chrome isolates content script variables from webpage scripts, but both share the identical DOM tree. Inspecting content script code reveals whether an extension is injecting elements or observing user interaction.
2. The Manifest V3 Shift: Inspecting Ephemeral Background Service Workers
In Manifest V2, background pages ran continuously in a hidden DOM window. In Manifest V3, extensions must declare a single background.service_worker script in manifest.json. Service workers do not possess a window object or DOM access, forcing extensions to rely on Chrome extension APIs for cross-origin networking and storage.
When reviewing service worker scripts in Extension X-Ray, examine listeners registered with chrome.runtime.onMessage, chrome.alarms.onAlarm, and chrome.webNavigation to identify what background tasks the extension performs when you are not actively interacting with it.
3. Step-by-Step: Inspecting Extension Code Safely with Extension X-Ray
Extension X-Ray unpacks the extension package in isolated memory without granting it permission to execute:
- Step 1: Open any extension on the Chrome Web Store in your browser.
- Step 2: Click the Extension X-Ray button to load the CRX package into the inspection viewer.
- Step 3: Open the manifest.json file from the file tree and look for the content_scripts array. Note the matches patterns showing which websites the scripts inject into.
- Step 4: Click into the specific content script files (.js or .ts) to review the client-side DOM logic.
- Step 5: Navigate to the background service worker file declared in manifest.json to inspect event listeners and message routing.
- Step 6: Review the Endpoints tab to see all external domain URLs hardcoded inside the service worker codebase.
4. Security Auditing: Spotting Data Scraping and Form Interception
When auditing content scripts, look for common indicators of aggressive data collection: event listeners on input or change events across input[type="password"] fields, automatic serialization of document.cookie, or MutationObservers scanning for sensitive form tokens.
Legitimate extensions restrict their content scripts to targeted domains (e.g., https://github.com/*). If a simple utility requests matches: ["
5. Exporting Extension Packages for IDE Static Analysis
For in-depth security audits, Extension X-Ray includes an Export Source ZIP feature. Clicking this button bundles the complete unpacked extension file structure into a clean zip archive, ready for exploration in Visual Studio Code, WebStorm, or automated vulnerability scanners.
Product scope and further reading
Editorial methodology: Written and maintained by Elnavix Labs from inspected Chrome extension package behavior, media container specifications, and official platform documentation. Visual figures are AI-generated conceptual diagrams; always check the official product listing for current release scope.
Inspect Any Chrome Extension in 1-Click with X-Ray
View content scripts, examine Manifest V3 service workers, and inspect extension security before installing from the Chrome Web Store.
Add Extension X-Ray to Chrome (Free) →Official Chrome Web Store developer utility by Elnavix Labs. Static code and permission inspector.Frequently Asked Questions
Can an extension content script read my passwords while I type?
If an extension declares host permissions for the active website and injects a content script without restrictions, it has DOM access to form fields unless specifically blocked by the browser.
Why did Google replace background pages with service workers in Manifest V3?
Service workers terminate when idle, reducing system RAM usage and battery drain. They also prohibit remotely hosted code execution, requiring all code to be packaged inside the reviewed CRX bundle.
Does Extension X-Ray run background service workers while inspecting them?
No. Extension X-Ray performs static code inspection only. Code files are parsed as text and syntax-highlighted in memory without running service worker threads.
How do I know which websites an extension injects scripts into?
Open manifest.json in Extension X-Ray and look at the content_scripts matches field. It lists the exact URL patterns where scripts are injected.
Can I inspect minified or obfuscated extension scripts?
Yes. Extension X-Ray includes automated JavaScript formatting and beautification, making bundled or minified code readable for security analysis.