A Firefox browser extension that allows users to open images in new tabs with query parameters stripped from the URL. The extension adds a context menu item when right-clicking on images.
To configure the extension's settings, go to the Firefox Add-ons page (about:addons), find "Clean Image Opener" in the list, and click the "Options" button.
You can configure the following settings:
- Switch to the new tab immediately: When checked, the new tab will become the active tab as soon as it's opened.
manifest.json: Firefox extension manifest (version 2) defining permissions and background scriptsbackground.js: Main extension logic handling context menu creation and clicksutils.js:stripQueryParameters()that handles URL cleaningtest/**: Test suite using Node.js built-in test runner
# Run all tests
npm test
# Run tests in watch mode during development
npm run test:watch
# Run tests with coverage reporting
npm run test:coverage# Build extension for distribution (creates ZIP file)
npm run build
# Build and create XPI file with version number
npm run package
# Watch for changes and rebuild automatically
npm run build:watchThe extension uses Mozilla's official web-ext tool for packaging:
-
npm run build- Createsweb-ext-artifacts/clean_image_opener-[version].zip- Automatically excludes development files (tests, README, package.json)
- Validates manifest.json and extension structure
- Uses proper ZIP compression compatible with Firefox
-
npm run package- Complete packaging workflow:- Runs the build process
- Renames output to
.xpiformat with version number - Final file:
clean-image-opener-1.2.0.xpi
The generated .xpi file is ready for:
- Upload to Mozilla Add-ons (AMO)
- Manual installation in Firefox for testing
- Distribution as unsigned extension for development
The stripQueryParameters() function in utils.js handles complex URL parsing scenarios including:
- Standard HTTP/HTTPS URLs with proper port handling
- Special URL protocols (data:, blob:, file:)
- URLs with authentication credentials
- Malformed URLs with fallback string splitting
- IPv6 addresses and internationalized domains
The extension uses Firefox's browser API for context menus and tab management, with error handling for tab creation failures.