Show Firefox OS devtools on Firefox Developer Edition 'desktop' - firefox

I've an iMac with OS X Yosemite v.10.10.3. I use Firefox Developer Edition 40.0a2. I've a ZTE Open C (FR version) with Firefox OS; Boot2Gecko 2.1.0.0-prerelease (B2G OS).
What I'd like to do is the following: I've a basic webpage (mostyl HTML, CSS and JS) opened in my browser on my Firefox OS phone. I'd like to get the devtools (Cmd+Shift+i) and be able to edit that webpage with my Firefox Developer Edition browser on my iMac.
I've already tried these things:
Use webIDE.
Follow this potential solution.
Connecting a Firefox OS device.
WebIDE Troubleshooting.
Comment déboguer facilement du web y compris sur tablettes et téléphones—french article.
With webIDE, I can build a new app for Firefox OS (with or without a base theme) and I can use the devtools to inspect the DOM and stuff like that. I just want to achieve the exact same thing but directly on my desktop computer.
Do you have any clue?
Feel free to ask me if you need more piece of informations. ;)
Current status
When I launch the Firefox OS browser app, I can inspect (via the devtools) the homepage (DOM stuff, etc.). But when I load another webpage (Google for example), I can't inspect the DOM. Any idea about that?
I often get this message: http://puu.sh/ir2Ju/32563e51bc.png when I switch to several apps I want to debug.

If I understand correctly, you're trying to connect the Firefox Developer Edition WebIDE on your desktop to a tab that is open on your Firefox OS phone. Something like this?
If that's right, once you connect to your phone in the WebIDE, you should see a list of open browser tabs at the bottom of the "Open App" menu, which is in the top left of the WebIDE panel.

When you connect your phone, you have to accept remote debugging.
Then on the left of the window, you should see a dropdown menu with the apps that you can debug. By default, you can only debug unprivileged applications.
Click on the app, the you want to debug and in the middle of the screen click on the "wrench". It is the button to activate debugging.
Now the complicated part. In order to debug privileged apps such as the web Browser. You have to root your phone and change some preferences. To check that you have a rooted phone. Click on the runtime menu and then runtime info.
If your adb is in root mode, then you can press the button to request higher privileges. You can also do that by hand.
There for more info:
https://developer.mozilla.org/fr/docs/Tools/WebIDE/Running_and_debugging_apps#Unrestricted_app_debugging_%28including_certified_apps.2C_main_process.2C_etc.%29
https://developer.mozilla.org/en-US/Firefox_OS/Using_the_App_Manager#Using_the_B2G_desktop_client
Using a real device
On your computer, enter the following command in Terminal/console to enter your device's filesystem via the shell:
adb shell
Your prompt should change to root#android. Next, stop B2G running using the following command:
stop b2g
Navigate to the following directory:
cd /data/b2g/mozilla/*.default/
Here, update the prefs.js file with the following line:
echo 'user_pref("devtools.debugger.forbid-certified-apps", false);' >> prefs.js
After you've finished editing and saving the file, start B2G again using the following command:
start b2g
Exit the android filesystem using the exit command; this will return you to your normal terminal prompt.
Next, reconnect to the App Manager and you should see certified apps appear for debugging.
When this is done, you should see the application "Browser" in the list of available apps for debugging. At the same time, you should see all other application of your phone available as debugging.

Related

Unity Crash on MacOS when the join method is invoked (Agora.io)

I downloaded the agora.io video sdk asset from the asset store, imported it to a new project. On the demo "SceneHome" scene, I entered the api id. Clicked play, and as soon as I click the "join" button Unity crashes. As far as I can tell the crash happens on the
app.join(field.text);
line in the TestHome.cs script (line #86).
I tested it in 2019.3.2f1 and 2020.1.0b5. The result was the same.
The OS is Catalina 10.15.4.
The demo works on Windows.
I followed this tutorial: https://medium.com/#jake_agora.io/mac-run-video-chat-within-your-unity-application-e001091db62f but used x86_64 dlls instead of x86
Does anyone know what this is about? Or where should I begin to look?
Another tutorial, this one from Agora:
https://www.agora.io/en/blog/run-video-chat-within-your-unity-application-mac
It can be caused by missing the Camera and Microphone usage in the Unity Editor project setting. Please let us know if that's the case. (I saw you are also on the Slack channel, let's continue the conversation there.).
For the people who didn't know, Agora Developer Community - Unity Chat channel is here :)
As herve nau pointed out the problem was that the Unity did not had the permission to use camera or microphone. And the solution should work. Alternatively, here is another way to add the permission as described by launzone:
1) Disable SIP: Go into recovery mode (hold CMD+R when you
restart your Mac) Don't be afraid, we are not doing anything crazy.
2) After that open Terminal (it should be accessible from one of the
Menus at the Top) Type in "csrutil disable" and hit enter. Then reboot
your Mac normally.
3) Open Terminal and type in: "sqlite3 ~/Library/Application\
Support/com.apple.TCC/TCC.db" and hit enter
4) For microphone access, type in: "INSERT INTO access
VALUES('kTCCServiceMicrophone','com.unity3d.unityhub',0,1,1,NULL,NULL,NULL,'UNUSED',NULL,0,1541440109);"
and hit enter
For camera, type in: "INSERT INTO access
VALUES('kTCCServiceCamera','com.unity3d.unityhub',0,1,1,NULL,NULL,NULL,'UNUSED',NULL,0,1541440109);"
and hit enter
6) check in your SystemPreferences/Security&Privacy > unity hub should
now show up in both mic and cam
7) reboot in recovery mode again (CMD+R), open terminal again, type
in: "csrutil enable" and hit enter, to enable SIP again
8) reboot normally and enjoy!
Here is the full thread. I hope it helps someone :)
check if not related to the webcam registration issue on macOs with the Unity Hub running. Fix for the camera, not sure if related to your problem: Remove the Unity Hub app, then open the project directly from Unity App. May also be useful to relocate the Unity app in another folder to force the webcam usage security registration.
Made the test here, Unity 2019.3.11.f1, using the demo app, with Hub active -> crash on press of Join Button, did the Hub removal described above, rerun the same demo and no more crash at this level. Running on Catalina 10.15.2.

Starting Chrome on macOS from the Finder with extra command line parameters

I want to stuff remote debugging and other esoteric dev-only only parameters to the Chrome application when it starts but I want it to be always there, including when I click on the app icon.
E.g.:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
How do I pass these command line parameters to the app directly?
I ended up creating an automator application with as shell task. Customized the icon and replaced Chrome.app with the new app in the dock.
I am still looking for a way to change the settings in Chrome so it can connect with remote debugger "on-demand" for specific tasks (not everything as it is set now) but that doesn't seem to be possible at this time. The VSCode folks have apparently solicited the Chrome team to provide this functionality. Stay tuned...

Appium Desktop for Windows: How to call device's browser. Error "...com.android.browser not found"

TL;DR:
When I have an emulator open, and I try to call the browser using Appium, I get an error saying that the browser isn't callable, even though there is a browser in the device. Not sure what it's called, so I can call it in Desired Capabilities.
Long story long:
I'm new to Appium so trying to get a basic emulator session going. I'm new to Java too, but I'm not using Java here and the Appium site video didn't require Java to get a basic session going, so this isn't a "your code is rubbish" Java issue. (Video link I watched: https://youtu.be/IOSUBda2-g4, though this didnt' call a browser on the device so wasn't a helpful guide for newbies like me).
On Win10, I installed Appium Desktop for Windows (current version 1.2.0 beta).
I have Android Studio installed (v2.3.3), and an image for a Pixel device.
I open Android Studio > Tools > Android > AVD Manager > Pixel API 25 (which is set up using Android 7.1.1 and API 25) and I start the emulator.
The emulator opens, and the first thing I see is "Photos has stopped Close app" and an X. Somewhat worrying but hey, I installed the image from AVD Manager so I got what I got.
If I then go to Appium Desktop (host 0.0.0.0, port 4723) and start the server (v1.6.5), I get the console.
I click Start New Session, and the settings screen comes up.
I am on the Automatic Server tab.
I go to Saved capabilities tab.
I have these settings saved:
{
"platformName": "Android",
"deviceName": "Android Emulator",
"browserName": "Browser",
"avd": "Pixel_API_25",
"platformVersion": "7.1.1",
"": ""
}
NOTE: The last empty entry is because the delete button on Appium for the Desired Capabilities has no effect in this version of Appium Desktop.
I click "Start session" in Appium Desktop.
Since the emulator is already started, I get error "An unknown server-side error occurred while processing the command. Original error: Could not find package com.android.browser on the device"
There is a very simple browser on the Pixel phone, but I can't invoke it because I don't know what it is called. There is no Chrome or Firefox installed by default. If I go on the device I can run a Google search in this basic browser, but I don't know what it is called to try to invoke it from Appium.
I'm trying to use the guidance in https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md but I'm lost, and trying stuff with no success.
QUESTION: What is the browser called so I can invoke it?
Why am I trying to do this?
I actually wanted to invoke a basic Calculator.apk that I have locally, but that didn't work either (it never started when I specified "app": "C:\android\Calculator.apk"), so I thought I should start with a basic browser session rather than APKs.
I tried the same as above with API 26 but that didn't work either.
I haven't solved the APK invoke issue, but that's likely another issue.
Any assistance with the DCs much appreciated.
Mike

How to test privileged packaged apps on Firefox for Desktop?

It is possible to distribute a packaged app via Firefox Marketplace for installation on Firefox for Desktop. Apps for Firefox OS devices I can test comfortably via about:app-manager either on a USB connected device, or with the simulator.
How can I test a packaged app on Firefox for Desktop?
Update
I found that I can debug an app that I have installed from Marketplace by starting it with the -debug option and an optional port number:
C:\Users\Felix\AppData\Roaming\thetacontrol-56cab87ea3eecf190668cfb505f92c56>"Theta Control.exe" -debug 6000
The next step is to connect to the port from Firefox developer tools:
Still I don't know how to debug an app that is not (yet) on Marketplace.
Didn't found the way to debug privileged app either, so I've created bug on bugzilla, vote, please to solve this issue faster: https://bugzilla.mozilla.org/show_bug.cgi?id=1038533
You can refer to debugging guideline of web apps for Friefox desktop.
To access the console (and other remote developer tools), start the
app from a command line with the -debug flag and optionally
specifying a port (default: 6000). For example, on a Mac the Mykzilla
test app is started with:
/Applications/Mykzilla.app/Contents/MacOS/webapprt -debug 6000
Then, in Firefox, on the Developer Tools menu click Connect… and
connect to the “localhost” host at the port you specified. After
clicking Connect in Firefox, go back to your app and confirm the
connection. Then return to Firefox and select a “tab” (i.e. an open
window in your app) or “Main Process” to debug the Web Runtime’s
chrome code.
Then a copy of Firefox’s Remote Developer Tools should open in a new
window, and it should be connected to the “tab” you selected.

Why I can't get tabs list to debug page from FirefoxOS browser on desktop?

I have ZTE Open with Firefox OS.
I have macosx laptop. (And also parallels with windows vista, 7, 8 etc. if it may help…)
I enable remote debuging and console in phone settings and remote debuging in Firefox Nightly on desktop.
Download adt-bundle-mac-x86_64-20130917 from http://developer.android.com/sdk/index.html
and run:
./adb devices
List of devices attached
roamer2 device
So device is connected
Then I run
./adb forward tcp:6000 localfilesystem:/data/local/debugger-socket
Because this article https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging
Then I open Firefox and
Tools -> Web Developer -> Connect…
And nothing… Just timeout. Then I try
./adb forward tcp:6000 tcp:6000
Get this on my ZTE Open:
Click "Ok" and get this on my desktop:
No tabs!
What I am doing wrong?!
Help me please.
Remote debugging requires Firefox OS 1.2 or greater, which I do not think has been released for the ZTE Open.
More information regarding remote debugging with App Manager (simulator):
https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Using_the_App_Manager#Firefox_1.2.2B_required
And here's some info on the ZTE Open:
https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Developer_phone_guide/ZTE_OPEN
The instructions from #christi3k work for remote debugging an app within Firefox OS on my ZTE Open C.
When I want to debug a classic webpage, it's not working at all within Firefox OS context.
It will only work in an Android context according to https://bugzilla.mozilla.org/show_bug.cgi?id=1009518 but maybe I miss something.

Resources