wxt-dev / wxt-dev/wxt

Add support for Firefox-specific APIs

Open
#1,652 12 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
10.5k
Forks
564
PR merge metrics
No merged PRs in 30d

Description

Feature Request

Add types for browser-specific APIs and make them separate. For example:

// This API is cross-browser compatible, so it can be accessed via `browser`
await browser.tabs.create({ url: "https://github.com" });

// This is Chrome-specific API, which is not accessible on Firefox
await chrome.sidePanel.open({ windowId: 123 });

// This is Firefox-specific API, which is not accessible on Chrome
await firefox.sidebarAction.open();

Right now, since 0.20.0, browser implements only Chrome API types, which makes Firefox-specific API harder to access.

Ideally, if possible, it would be also a good idea to setup some linting for that, in case an extension tries to access browser-specific API without first checking which browser it is currently running on.

Is your feature request related to a bug?

#1651

What are the alternatives?

Bring back webextension-polyfill. That way we can use browser for cross-compatible/Firefox-specific APIs, and chrome for Chrome-specific ones.

Additional context

Chrome and Firefox have quite a big set of incompatible APIs, and it would be nice to have access to them as well

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by locating the current browser and Chrome API type definitions, then trace how they are exposed; done means Firefox-specific APIs such as firefox.sidebarAction have separate typings, with the proposed browser-specific access checks addressed if included in scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.