Firefox's global proxy settings affect both ordinary and private windows. The proxy.settings API therefore requires the extension to have private-window access, even when the operation was initiated from a regular window.

The extension can check that condition before changing the setting:

const allowed = await browser.extension.isAllowedIncognitoAccess();
if (!allowed) {
  throw new Error('Private-window access is required for global proxy settings');
}
await browser.proxy.settings.set({ value: proxyConfig });

proxyConfig is the existing Firefox-format configuration object. The extension also needs its ordinary proxy API permission.

When the manifest permits private use, the user controls that access in the extension's management details through Run in Private Windows. The check reports that choice; it does not grant the permission automatically.

Without the required access, proxy.settings.set throws. That happens before the extension has demonstrated any connection to the proposed proxy, so replacing its IP or port is unrelated to this failure.

Handle the rejection in the extension's UI and preserve the user's choice. Once permission and configuration application succeed, evaluate the actual destination route separately.

متعلقہ مضامین