Reveal active or passed timeouts, intervals, and eval invocation call stacks. Observe events and properties of media elements
API Monitor Extension
Whether you're developing a Single Page Application (SPA) and want to assess implementation correctness or are curious about how something works, this tool adds additional functionality to the Chrome browser DevTools to reveal timeouts, intervals, idle callbacks, animation frames and `eval` usages while mapping their invocation call stacks to a source code location. If the page has mounted video or audio media element's, their events and property state changes can be observed as they happen.
Wrapped native functions:
- eval
- setTimeout/clearTimeout
- setInterval/clearInterval
- requestAnimationFrame/cancelAnimationFrame
- requestIdleCallback/cancelIdleCallback
- video/audio events&props
Motivation:
- To expedite issues discovery, here are some examples from experience:
* A ~10ms delay interval constantly consuming approximately 10% of CPU from a third-party library, solely to check if the page was resized.
* A bundled dependency library that utilizes the eval function, thereby preventing the removal of unsafe-eval from the Content Security Policy (CSP) header. It can be arguably intentional, but also may reveal a configuration issue when the package was bundled with webpack config's devtool: 'eval' in production mode.
* A substantial number of hidden video elements in the DOM that were consuming resources, unexpectedly limited to 100 medias per domain.
* An unattended interval that was unintentionally left running and contributed to a slowly growing memory.
- To explore the internals of a complex systems.
Source code: https://github.com/zendive/browser-api-monitor
Read more
Wrapped native functions:
- eval
- setTimeout/clearTimeout
- setInterval/clearInterval
- requestAnimationFrame/cancelAnimationFrame
- requestIdleCallback/cancelIdleCallback
- video/audio events&props
Motivation:
- To expedite issues discovery, here are some examples from experience:
* A ~10ms delay interval constantly consuming approximately 10% of CPU from a third-party library, solely to check if the page was resized.
* A bundled dependency library that utilizes the eval function, thereby preventing the removal of unsafe-eval from the Content Security Policy (CSP) header. It can be arguably intentional, but also may reveal a configuration issue when the package was bundled with webpack config's devtool: 'eval' in production mode.
* A substantial number of hidden video elements in the DOM that were consuming resources, unexpectedly limited to 100 medias per domain.
* An unattended interval that was unintentionally left running and contributed to a slowly growing memory.
- To explore the internals of a complex systems.
Source code: https://github.com/zendive/browser-api-monitor
Source Manifest.json
{"update_url": "https://clients2.google.com/service/update2/crx", "version": "1.0.6", "name": "API Monitor", "manifest_version": 3, "description": "Reveal active or passed timeouts, intervals, and eval invocation call stacks. Observe events and properties of media elements", "minimum_chrome_version": "122.0", "homepage_url": "https://github.com/zendive/browser-api-monitor", "author": "[email protected]", "permissions": ["storage"], "host_permissions": ["*://*/*"], "devtools_page": "public/api-monitor-devtools.html", "icons": { "28": "public/img/panel-icon28.png", "64": "public/img/panel-icon64.png", "128": "public/img/panel-icon128.png" }, "content_scripts": [ { "world": "MAIN", "js": ["public/build/api-monitor-cs-main.js"], "matches": [""], "match_origin_as_fallback": true, "all_frames": false, "run_at": "document_start" }, { "js": ["public/build/api-monitor-cs-isolated.js"], "matches": [""], "match_origin_as_fallback": true, "all_frames": false, "run_at": "document_start" } ]}
Read more