Closed Bug 1549395 Opened 3 years ago Closed 2 years ago

Webextension proxy API has no effect on Firefox for Android

Categories

(WebExtensions :: Android, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: eyedeekay, Assigned: mixedpuppy)

References

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.108 Safari/537.36

Steps to reproduce:

Created a webextension using the proxy.onRequest event to automatically route requests to a proxy. Run it on Android by transferring the .xpi file and installing it or by using web-ext run --target=firefox-android etc.

Actual results:

Created a plugin which uses proxy.onRequest to route requests to the i2p network. On desktop Firefox, for both Windows and Linux, I was able to confirm that the proxy.onRequest approach did work. But when I tried the same approach on Android, it did not work anymore. web-ext lint showed no errors nor did debugging the mobile Firefox in the WebIDE, and since it works on desktops I can only conclude. This occurs on every version of Firefox for Android that I have tried.

Expected results:

proxy.onRequest should have behaved as it did on desktops, that is, to route the requests to the proxy specified by the webextension.

Assignee: nobody → mixedpuppy
Priority: -- → P2
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

From what I see, our tests run on android, and it's the same network code that handles proxy services for both desktop and mobile. Maybe there is something I'm missing that Luca would see.

Flags: needinfo?(lgreco)

(In reply to Shane Caraveo (:mixedpuppy) from comment #1)

From what I see, our tests run on android, and it's the same network code that handles proxy services for both desktop and mobile. Maybe there is something I'm missing that Luca would see.

From a quick look to the code related to proxy from the mobile/android part of the tree it seems to me that the proxy API should work on Fennec as well, and as Shane mentioned most of our tests for the proxy API are xpcshell tests that are definitely running on Android.

I used a small test extension to try it on one of my android device and I verified that the API method proxy.onRequest is being called as expected for the requests originated from a Fennec tab, and so I tried to return some proxy information that were pointing Fennec to a tcp port on my dev laptop, I had netcat listening on that tcp port and it received data for the requests related to the proxy set by the extension.
As soon as I killed netcat Fennec rendered the "The proxy server is refusing connections" error page.

@eyedeekay would you mind to attach a (possibly reduced) test extension that can reproduce the issue on Fennec for you?

Flags: needinfo?(lgreco) → needinfo?(eyedeekay)
Component: Add-on Manager → Android
Product: Firefox for Android → WebExtensions

Note bug 507641 as there are some items that are handled by the frontend. Firefox for Android will be shipping ESR builds off the 68 branch for the rest of 2019 and possibly into 2020.

I apologize for the delay in my response, it's been a busy couple weeks for me. The plugin in question where I am having the issue is at https://github.com/eyedeekay/i2psetproxy.js but I will attempt to write a reduced test version as soon as possible. Unfortunately I had the desktop version working before I decided to try Android so the Android part didn't exist until after. Every other part of the extension behaves as expected. It's also entirely possible that I've missed something or broken some rule that I have overlooked, but it does observably work on a desktop browser when forced to use the proxy.onRequest API.

Kevin Brosnan I'm not entirely sure what that would mean here, my intention was to use proxy.onRequest because it was available on Android where I understood the other proxy API's were not? Does that also mean I can't do, for instance

function handleProxyRequest(requestInfo) {
    return {type: "http", host: Host, port: Port, proxyDns: true}
}
browser.proxy.onRequest.addListener(handleProxyRequest, {urls: ["<all_urls>"]});

on Android, to contrive a simple example?

Flags: needinfo?(eyedeekay)

I apologize if I wasted anyone's time, the API actually works exactly as expected, it was totally my fault. Thanks for your help.

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.