Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
chrome-pool
Advanced tools
Headless chrome tabs manage pool, concept come from database connection pool for reuse chrome tab improve performance.
npm i chrome-pool
const ChromePool = require('chrome-pool');
const chromePoll = await ChromePool.new(options);
await chromePoll.destroyPoll();
await ChromePool.new()
will make a new ChromePool and start a new chrome. A ChromePool means a chrome.
static method new() support options:
maxTab
: {number} max tab to render pages, default is no limit.
port
: {number} chrome debug port, default is random a free port.
chromeRunnerOptions
: {object} options from chrome-runner and will pass to chrome-runner when launch chrome
protocols
: {array} require chrome devtool protocol to be enable before use. e.g ['Network','Log']
.
await chromePoll.destroyPoll()
can release all resource used by this pool, kill chrome.
// require a free tab from pool to use
const { tabId,protocol } = await chromeTabsPoll.require();
// tabId
const { Page,Target,Network,...} = protocol;
await chromeTabsPoll.require()
will return a object with prop:
tabId
: chrome tab id.
protocol
: chrome remote control protocol.
const { Page,Target,Network,...} = protocol;
protocol detail use see chrome-devtools-protocol doc. all protocol required be enable before use has been enable by chrome-pool.
await chromeTabsPoll.release(tabId);
release
will release all resource used by this tab include removeAllListeners, so you don't need to removeListener by yourself.
By default release
will navigate tab to about:blank
to reduce chrome resource use, you can close this feature by call chromeTabsPoll.release(tabId,false)
In dev time, you may want to know what chrome are doing rather than let chrome run in headless.
You can set env SHOW_CHROME=true
when run your nodejs app to disable headless to debug chrome.
see test for more use case.
FAQs
headless chrome tabs manage pool
The npm package chrome-pool receives a total of 1 weekly downloads. As such, chrome-pool popularity was classified as not popular.
We found that chrome-pool demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.