Skip to main content

A seleniumbase-rs plugin that loads packed Chrome extensions (.crx files).

Chromium only Launch only
At a glance
  • Name: crx
  • Formats: CRX3 and CRX2
  • Needs: a Chromium browser that the plugin set starts itself
  • Unpacks to: a temporary folder (prefix sbrs-crx-), deleted when the browser closes
  • Size guard: unpacked archives above 512 MiB are refused

Chrome only loads unpacked extension folders from the command line. This plugin takes .crx files (CRX3, the current format, and the older CRX2), strips the signed header, unpacks the zip into a temporary folder and adds the folder to the browser’s start-up settings. The folders are deleted when the browser closes.

Terminal
Warning

The signature in the header is not verified: load only files you trust, as you would install them by hand.

Use it#

Give the set to LaunchOptionsBuilder::plugins, as shown in the Browser Plugins guide.

How it works#

Before the launch

For each file, before_launch reads it, makes a temporary folder (prefix sbrs-crx-), unpacks the zip archive inside the CRX file into it and pushes the folder onto the launch settings’ extensions. Unpacked archives above 512 MiB are refused, as a guard against zip bombs.

Loading

The pure CDP engine loads the folders as extensions over the protocol, as described in the Browser Plugins guide.

On close

on_close drops the folders, which deletes them.

The plugin is named crx. It requires a Chromium browser that the plugin set starts itself (Requirements::CHROMIUM_ONLY | Requirements::LAUNCH_ONLY), so it cannot be used with a browser attached by connect_with_plugins.

Errors#

An unreadable file or an archive that cannot be unpacked stops the launch with an error that names the file. CrxError says why a file could not be unpacked:

CrxError::NotCrx#

The file does not start like a CRX file (Cr24), has an unknown version, or its header is cut short.

CrxError::Archive#

The archive inside could not be read or written out.

The public function archive(&[u8]) returns the zip archive inside a CRX file (CRX3 or CRX2), without its header, or CrxError::NotCrx when the bytes are not a CRX file.