Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arkenfox firefox android wiki issues #1147

Closed
username-is-not opened this issue Mar 19, 2021 · 15 comments
Closed

arkenfox firefox android wiki issues #1147

username-is-not opened this issue Mar 19, 2021 · 15 comments

Comments

@username-is-not
Copy link

username-is-not commented Mar 19, 2021

Hi, everyone!

Two problems with the Wiki, for Android user.js injection (non-root)

  1. The Wiki information for Android WebIDE user.js injection (very) outdated, there's no more Scratchpad in Firefox for example (now part of Web Console) and, more importantly:
  2. Running the script now throws an error: pref:whatever.preference val:true e:ReferenceError: Services is not defined debugger eval code:13:13

Tried with old/new desktop Firefox, also with all sorts of mobile Firefox (like Fennec, or Nightly - where about:config IS enabled). Apparently none can do it, although it used to be fine? Not 100% sure if it's local (I've gone insane), or whether it's real.

Best regards from Belgrade! :)

EDIT:

This, https://github.com/arkenfox/user.js/wiki/1.6-Firefox-Android

From this topic, originally, #318

@Thorin-Oakenpants
Copy link
Contributor

not supported

@username-is-not
Copy link
Author

username-is-not commented Mar 21, 2021

not supported

I know that it's "not supported", but how is it possible that nobody (!?) else is injecting to a non-root Android? What do I do, try and contact @TerkiKerel who had written the script four years ago... It was functioning fine, until recently.

I've tried to debug, don't know JavaScript, but I can see that in Mozilla's source code:

Services.prefs.whatever_is_in_the_script

^^ remains unchanged. All of the calls are still identical, so that's not the error. Just, unable to figure it out through logic.

Anyway, not writing to spam - still hoping that someone would be using this and be willing to help. :)

P.S. Regardless of the script, the Wiki information for arkenfox Android remains wrong: the procedure has changed (because there is no more "Scratchpad", as it's written in the Wiki). I would be more than happy to update, but the script -apparently- no longer works.

@earthlng
Copy link
Contributor

Hi,

I don't have an android to test but if you post some screenshots of the about:debugging page when you've connected it to your phone as well as the console when you try to run the script, I can maybe see what the problem is.

The script needs to be run in the context (ie the web console) of a privileged about: page which loads Services.
Since about:config is now hidden in Release and it apparently also doesn't seem to work anymore even when it's accessible, you can try another about: page, like fe:

about:profiles
about:networking
about:support
about:telemetry
about:memory
about:processes
about:performance
about:policies

these are a just a few that I found that load the services object but IDK if any of them also exist in FF for Android.

but the script -apparently- no longer works.

I don't think the script is the problem, it just needs to be run in the right context.

@icpantsparti
Copy link
Contributor

but the script -apparently- no longer works.

Further to earthlng ^, just tested here with Nightly and remotely setting one dummy preference...

Click here to expand (not for arkenfox user.js)

Android Nightly Firefox:

  • connect device (Wi-Fi network or USB)

  • open tab for 'about:config' (or 'about:support')

Desktop Nightly Firefox on PC:

  • open tab for 'about:debugging'
    (follow remote device connection info shown there)

  • Android device will be listed on left hand side
    click Connect button next to the device

  • click on device name
    the Tabs open on Android will then be listed on the right hand side

  • click Inspect button (next to tab name)
    a tab opens where you can use a Console

  • first test, entered:
    typeof(Services);
    that should return "object"
    start troubleshooting if you get the error "Services is not defined"
    ? if Release not working perhaps try Nightly (or Fennec F-Droid [Fenix])

  • pasted the script, then
    user_pref("_test", "testing");
    // which does: Services.prefs.setStringPref("_test", "testing");

  • check preference is set (it should show at top of about:config on device)
    Services.prefs.getStringPref("_test");

  • clear the dummy pref (or reset it on device about:config)
    Services.prefs.clearUserPref("_test");

I also tried other functions to list prefs/set/reset with success.


how is it possible that nobody (!?) else is injecting to a non-root Android?

I guess because of the warning, I'm only setting a few about:config preferences manually, for example from discussions on privacytools.io repo so far (thanks to a wise Lama 👖 😄):

  • use Firefox Nightly on Android
  • enable: RFP (resist fingerprinting) and FPI (first party isolation)
  • optionally disable: WebGL and WebRTC (peerconnection)

Some projects are setting all sorts of preferences (eg mull-fenix), but I treat those with caution. Hopefully in time we will know more about what can be tweaked on Android Firefox. Another good thing about Nightly (and Fennec F-Droid) is we can try custom Add-on collections.

Good luck experimenting.

@username-is-not
Copy link
Author

username-is-not commented Mar 22, 2021

Since about:config is now hidden in Release

TYVM for the reply and attention to this issue. I have used the script successfully in the past many times, in F-Droid Fennec, I just don't know if the newer versions of mobile Firefox could be the problem; or why the script no longer works?

I've tried to use all sorts of desktop Firefox to test (portable, older and newer versions - and newest and Beta and so on), on Android using: F-Droid Fennec, Firefox Beta and Firefox Nightly.

The result is always the same, screenshot:

https://ibb.co/prDNpVz

var user_pref = function(pref, val){
try{
if(typeof val == "string"){
Services.prefs.setStringPref(pref, val);
}…
pref:general.aboutConfig.enable val:true e:ReferenceError: Services is not defined debugger eval code:13:13
pref:beacon.enabled val:false e:ReferenceError: Services is not defined debugger eval code:13:13
undefined

@username-is-not
Copy link
Author

username-is-not commented Mar 22, 2021

Also, here it is with just one user_pref

https://i.postimg.cc/cCkX6VQX/debugging2.png

Please, if someone could review what is going on; no-root injection is very useful. :)

@icpantsparti
Copy link
Contributor

The result is always the same, screenshot:

You need to click on the Inspect button for the remote tab first (under the list of Tabs), that opens a new tab with a console, use the code there and it will work. :)

@username-is-not
Copy link
Author

You need to click on the Inspect button for the remote tab first (under the list of Tabs), that opens a new tab with a console, use the code there and it will work. :)

Thank you again, guys, really. This was NEVER needed in the past, even with the new Web Console (after the removal of Scratchpad). I have no idea how come that I haven't done this - again, thanks so much for your time (please don't kill me. :))

Screenshot: https://ibb.co/QpCQpTr

The outcome is that the script runs and preference is updated, as expected.

@earthlng
Copy link
Contributor

Nice! I'm glad you figured it out.

A nice side-effect of our little script should be that about:config is made accessible again even in Release - is that still the case?

@earthlng
Copy link
Contributor

oh and now that you know all the steps, would you mind helping us update the outdated infos in the wiki?

@username-is-not
Copy link
Author

username-is-not commented Mar 22, 2021

Yes, I suppose that now I'll have to, hehe. Gotta see whether about:config can be enabled on Release and also what's the condition for "Inspect" to work... Looks like initiating debugging from an older version of Firefox no longer works - and that's been the whole deal (I swear I had no problems a few versions back, some time ago - and also never had to go to the Inspect screen, running the Web Console directly from about:debugging used to be sufficient). :D

EDIT: ^^ Where "Inspect" starts about:devtools-toolbox connected to the remote about:config tab; well, to its ID, via firefox-debugger-socket-usb (need to figure out how to present it, for the Wiki).

@Thorin-Oakenpants
Copy link
Contributor

Thorin-Oakenpants commented Mar 22, 2021

When I said "not supported" I meant not supported by this repo. The user.js explicitly says it is for desktop only.

From memory, the android wiki page already existed when we added the "desktop only" bits to the readme and user.js etc. So we just left it there.

But then GeckoView came along, and it is wildly divergent in code and can easily get bricked. So after the rollout was done, I used the opportunity to clarify our stance

And that stance is

  • I am not going to encourage users to apply scripts to GeckoView
  • I'm going to discourage it as a default standpoint (warnings, collapse the info)
  • If you want about:config, Nightly is just fine: it's what I use. And all you really need are a few pref flips (edit: to get 95% of what you need), which you can do manually
  • I left the old instructions there as it seemed like a lot of useful info that no-one else really had

I am not interested in supporting it, and definitely not maintaining it (and almost everything ends up on my plate - no thanks)


I do understand that advanced users, after the warnings, may still want to get in there. So feel free to update the wiki so the instructions still work, but don't touch my warnings .. and leave the instructions collapsed

As for the scratchpad, that was replaced by the multi-line editor mode (Ctrl+B) since FF72 - so when FF78 Fenix landed it caught up

@earthlng will have to do the edits, no-one else has write permissions

@username-is-not
Copy link
Author

about:config is made accessible again even in Release

There seems to be no way for about:devtools-toolbox to ID about:config with Release and it's not displayed in about:debugging (menu|Tools|Web Developer|Remote Debugging), so I -personally- have no idea how that could work.

And here's the edit of 1.6-Firefox-Android.md, with some comments added, including <!-- EOF -->, hope it's good!
@https://www.dropbox.com/s/sw8f9c438sl7lb2/1.6-Firefox-Android-final.zip?dl=0

^^ I've not touched the line in the script, no idea why it would be there:

user_pref("general.aboutConfig.enable", true); // unblock about:config in newer versions (FF71+?)

Side note: I might've clicked "Save" in Atom, by accident a couple of times, no idea what that might've triggered, sry. xD

Oh, yeah! "Clone this wiki locally" (https://github.com/arkenfox/user.js.wiki.git) couldn't be done in GitHub Desktop: "We couldn't find that repository. Check that you are logged in, the network is accessible, and the URL or repository alias are spelled correctly" (cloning the main user.js -and my repo- works just fine; don't think it's local?).

And Atom gave me: "Query errors reported, Could not resolve to a Repository with the name 'arkenfox/user.js.wiki'" (still managed to clone it, somehow; or, at least grab the files - or, something? :))

@earthlng
Copy link
Contributor

thanks mate, much appreciated!

Just 1 question: since about:config is blocked in Release, shouldn't the instructions be to run the script in the context of fe about:support? I assume that page exists in Android too, right?

I've not touched the line in the script, no idea why it would be there:

that should re-enable about:config in Release and from what I can tell it should still work:

https://searchfox.org/mozilla-central/source/docshell/base/nsAboutRedirector.cpp#16

There seems to be no way for about:devtools-toolbox to ID about:config with Release

did you run the script 1st? The idea is that you "inject" the script via fe about:support and by setting that pref it should theoretically unblock about:config. Maybe it also requires to restart the Firefox on the phone, IDK.

ps: I have no idea why the wiki can't be cloned, sorry.

@earthlng
Copy link
Contributor

crickets :)

oh well, I'll just change the instructions to inject in about:support instead of about:config.

Would still be nice if someone could test if the pref to unblock about:config in Release works or not but until then I'll leave it in because there's no harm if it doesn't work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants