Skip to content

⚠️ Chrome Extension API Limitations in Peersky #125

@akhileshthite

Description

@akhileshthite

Overview

Peersky uses electron-chrome-extensions (ECE) as its extension API bridge on top of Electron's built-in extension layer. ECE handles MV2/MV3, browser actions, tabs, windows, context menus, cookies, i18n, and notifications. Several Chrome APIs are still missing and block real-world extensions from working.


Missing APIs

chrome.debugger — Not supported

The chrome.debugger API attaches to Chrome DevTools Protocol (CDP) for deep network inspection.

Broken extension — archiveweb.page (Webrecorder):

{
  "manifest_version": 3,
  "permissions": ["debugger", "tabs", "webRequest", "storage"],
  "background": { "service_worker": "bg.js" }
}

archiveweb.page calls chrome.debugger.attach() to capture full network responses at the CDP level — webRequest alone cannot access response bodies. Without this, the extension UI loads but cannot record any web archives.

Electron exposes CDP natively via webContents.debugger, but there is no bridge from chrome.debugger extension calls to webContents.debugger. Implementing this requires a main-process IPC handler that proxies attach, detach, sendCommand, and fires onEvent/onDetach back to the extension.


chrome.identity — Not supported

Used for OAuth 2.0 flows via chrome.identity.launchWebAuthFlow({ url, interactive: true }). Opens a controlled popup, intercepts the OAuth redirect, and returns the token.

Without it, extensions fall back to window.open() for OAuth — which behaves differently in Electron (no popup lifecycle management, redirect interception fails silently).


chrome.proxy — Not supported

Required by VPN and proxy extensions. Electron exposes session.setProxy() but there is no bridge to chrome.proxy.settings.set(). Extensions may show a "connected" state while traffic is not actually proxied.


chrome.storage.sync — Not supported

Confirmed by Electron docs: only chrome.storage.local works. chrome.storage.sync and chrome.storage.managed are unsupported. Extension settings don't roam across devices.


chrome.webRequest — Handler Conflict

Electron docs note: "Electron's webRequest module takes precedence over chrome.webRequest if there are conflicting handlers." Peersky registers its own webRequest handlers for P2P protocol interception. Related #124

Known issue — Ghostery analytics blocking:

Ghostery's tracker analytics feature relies on chrome.webRequest to intercept and analyze network requests. The extension still blocks trackers via content scripts and declarativeNetRequest, but the analytics dashboard may show incomplete statistics.


window.open() — Behavioral Mismatch

OAuth flows that use window.open() as a fallback fail in Electron due to different popup lifecycle, focus handling, and redirect behavior vs. Chrome.


API Status Summary

API Status
chrome.runtime.* ✅ Working
chrome.tabs.* ✅ Working
chrome.windows.* ✅ Working
chrome.action / chrome.browserAction ✅ Working
chrome.scripting ✅ Working
chrome.storage.local ✅ Working
chrome.contextMenus ⚠️ Partial
chrome.management ⚠️ Partial
chrome.tabs.captureVisibleTab ⚠️ Unreliable
chrome.webRequest ⚠️ Conflicts with Peersky's P2P handlers
chrome.debugger ❌ Not supported
chrome.identity ❌ Not supported
chrome.proxy ❌ Not supported
chrome.storage.sync ❌ Not supported

Roadmap

The plan is to extend ECE with the missing APIs. Agregore's electron-extended-webextensions (EWE) has already specced out chrome.debugger (attach, detach, sendCommand, onEvent) and chrome.webNavigation in its preload; we can use these implementations as a reference or contribute the missing pieces there as well.

Note: Agregore doesn't have extension management UI and no Chrome Web Store integration; only builtin extensions. Peersky has a full extension UI, Chrome Web Store support, and preinstalled extensions - so ECE remains the right foundation according to our approach; EWE is a useful reference for the APIs it has specced.


Finally remove limitation note in Extension.md #134

Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    electronRelated to electron.jsenhancementNew feature or requestextensionsRelated to web extensions or chrome APIs issueshelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions