Search code examples
javascriptfirefox-os

How to debug javascript file on Firefox OS device


I want to edit a script file of Firefox OS device. But I do not know how ? When I use the console There's no option for editing . SO my question is how can I debug and edit the script file ?


Solution

  • For live debugging, you can run use the about:app-manager page inside the Firefox browser. You can install the ADB (Android Debug Brdige) to connect the FirefoxOS device with the Browser:

    // install ADB
    
    // Linux
    apt-get install android-tools-adb
    
    // OSX
    brew install android-platform-tools
    

    Then you can connect to your device using ADB commands:

    // connect to your device / change IP
    adb connect 192.168.1.5
    
    // connect as root
    adb root
    
    // get a shell to your device, Ctrl-D will quit
    adb shell
    
    // enable port forwarding to use app-manager in your Desktop Firefox browser
    adb forward tcp:6000 localfilesystem:/data/local/debugger-socket // or ADB Helper
    
    // get the log output
    adb logcat
    

    When connected you, should be able connect the app-manager with your device inside your Desktop Firefox browser. Then you can run the App you want to live debug. You get an inspector, console and debugger (Firefox dev tools) just like you would get for every other website.

    see all installed apps

    dev tools

    When you need to persist the changes, you need to save the desired files locally and use adb pull/push to trasmit the files from and back to the devicce:

    adb pull /system/b2g/webapps/browser.gaiamobile.org/application.zip
    adb push application.zip /system/b2g/webapps/browser.gaiamobile.org/application.zip