Closed
Bug 1219803
Opened 9 years ago
Closed 9 years ago
Support 'mach run' on Firefox for Android
Categories
(Testing :: General, defect)
Testing
General
Tracking
(firefox45 fixed)
RESOLVED
FIXED
mozilla45
Tracking | Status | |
---|---|---|
firefox45 | --- | fixed |
People
(Reporter: gbrown, Assigned: gbrown)
References
Details
Attachments
(1 file)
11.01 KB,
patch
|
jmaher
:
review+
|
Details | Diff | Splinter Review |
The 'mach run' command runs Firefox on desktop platforms but it does not recognize or attempt to support a Firefox for Android build:
$ ./mach run
It looks like your program isn't built. You can run |mach build| to build it.
Binary expected at /home/gbrown/objdirs/droid/dist/bin/fennec does not exist.
Firefox for Android is normally run manually on device (click the app), but desktop developers may expect 'mach run' to work for Android, and 'mach run' may be more convenient in some scenarios (eg 'mach run <url>').
![]() |
Assignee | |
Comment 1•9 years ago
|
||
The diff for _find_sdk_exe() looks complicated, but I have only changed the scope and deleted a block that was accidentally duplicated: There should be no functional changes to _find_sdk_exe().
Any parameters passed to 'mach run' are passed on to Firefox for Android. The most useful parameter to pass is perhaps a url, which needs to be identified and processed differently from other arguments.
gbrown@mozpad:~/src$ ./mach run
No Android devices connected. Start an emulator? (Y/n)
Starting emulator running Android 4.3...
It looks like Firefox is not installed on this device.
Install Firefox? (Y/n)
Installing Firefox. This may take a while...
0:56.37 /usr/bin/make -C . -j8 -s -w install
0:56.46 make: Entering directory `/home/gbrown/objdirs/droid'
1:10.31 3026 KB/s (42638865 bytes in 13.760s)
1:11.05 pkg: /data/local/tmp/fennec-44.0a1.en-US.android-arm.apk
1:26.54 Success
1:26.92 make: Leaving directory `/home/gbrown/objdirs/droid'
Starting: Intent { act=android.activity.MAIN cmp=org.mozilla.fennec_gbrown/.App }
gbrown@mozpad:~/src$ adb shell am force-stop org.mozilla.fennec_gbrown
gbrown@mozpad:~/src$ ./mach run
Starting: Intent { act=android.activity.MAIN cmp=org.mozilla.fennec_gbrown/.App }
gbrown@mozpad:~/src$ adb shell am force-stop org.mozilla.fennec_gbrown
gbrown@mozpad:~/src$ ./mach run http://www.yahoo.com
Starting: Intent { act=android.activity.MAIN dat=http://www.yahoo.com cmp=org.mozilla.fennec_gbrown/.App }
Attachment #8680723 -
Flags: review?(jmaher)
Comment 2•9 years ago
|
||
Comment on attachment 8680723 [details] [diff] [review]
support 'mach run' on Android
Review of attachment 8680723 [details] [diff] [review]:
-----------------------------------------------------------------
a couple of questions, please ask for r+ when these are answered.
::: python/mozbuild/mozbuild/mach_commands.py
@@ +1140,5 @@
> pass_thru=True, append_env=extra_env)
>
> + def _run_android(self, params):
> + from mozrunner.devices.android_device import verify_android_device, run_firefox_for_android
> + verify_android_device(self, install=True)
if this fails, we still continue on?
::: testing/mozbase/mozrunner/mozrunner/devices/android_device.py
@@ +206,5 @@
> + for p in params:
> + if urlparse.urlparse(p).scheme != "":
> + cmd.extend(['-d', p])
> + params.remove(p)
> + break
is there a chance that params here can have incorrect data? Do we fail reasonable if the wrong params are given?
Attachment #8680723 -
Flags: review?(jmaher)
![]() |
Assignee | |
Comment 3•9 years ago
|
||
(In reply to Joel Maher (:jmaher) from comment #2)
> ::: python/mozbuild/mozbuild/mach_commands.py
> @@ +1140,5 @@
> > pass_thru=True, append_env=extra_env)
> >
> > + def _run_android(self, params):
> > + from mozrunner.devices.android_device import verify_android_device, run_firefox_for_android
> > + verify_android_device(self, install=True)
>
> if this fails, we still continue on?
Yes. That's the strategy used for all of the mach-for-android features: If an anticipated problem is detected, offer to fix it, but don't force any action. The user might decline starting an emulator, but plug in a physical device; or decline installation but install via adb.
mach could check again for everything that is required and fail with a message, but those checks may not be completely accurate, and don't necessarily add value over the current behavior:
gbrown@mozpad:~/src$ ./mach run
No Android devices connected. Start an emulator? (Y/n) n
WARNING: unable to launch Firefox for Android
gbrown@mozpad:~/src$ ./mach run
No Android devices connected. Start an emulator? (Y/n) y
Starting emulator running Android 4.3...
It looks like Firefox is not installed on this device.
Install Firefox? (Y/n) n
Starting: Intent { act=android.activity.MAIN cmp=org.mozilla.fennec_gbrown/.App }
Error type 3
Error: Activity class {org.mozilla.fennec_gbrown/org.mozilla.fennec_gbrown.App} does not exist.
> ::: testing/mozbase/mozrunner/mozrunner/devices/android_device.py
> @@ +206,5 @@
> > + for p in params:
> > + if urlparse.urlparse(p).scheme != "":
> > + cmd.extend(['-d', p])
> > + params.remove(p)
> > + break
>
> is there a chance that params here can have incorrect data? Do we fail
> reasonable if the wrong params are given?
The 'params' here are command-line arguments for Firefox. On desktop, they are not validated, and I think that's a good strategy: It may be difficult (annoying?) to keep lists of known parameters in sync between mach and Firefox over time. More importantly, add-ons may support additional command line arguments -- we never know what is "correct".
On Android, only a few parameters (like --guest, --profile) are processed by Android-specific code. Other parameters are passed on to Gecko, but generally have no effect.
Perhaps the most useful parameter is a url, not associated with any switch; on Android, if we can translate that to "-d <url>", Firefox for Android will open that page. I'm trying to do that here with urlparse, requiring a scheme.
'mach run http://www.yahoo.com' starts Firefox and loads www.yahoo.com.
'mach run http://no.no' starts Firefox and tries to load http://www.no.no; Firefox displays an error page with 'Server not found / Firefox can't find the server at www.no.no...'.
'mach run no://no.no' starts Firefox and tries to load no://no.no; Firefox displays an error page with 'The address wasn't understood / You might need to install other software to open this address.
'mach run whatever' starts Firefox on its home page ('whatever' is silently ignored).
![]() |
Assignee | |
Updated•9 years ago
|
Attachment #8680723 -
Flags: review?(jmaher)
Comment 4•9 years ago
|
||
Comment on attachment 8680723 [details] [diff] [review]
support 'mach run' on Android
thanks for the explanation
Attachment #8680723 -
Flags: review?(jmaher) → review+
Comment 6•9 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox45:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
Comment 7•9 years ago
|
||
bugherder uplift |
status-b2g-v2.5:
--- → fixed
Comment 8•9 years ago
|
||
removing the b2g 2.5 flag since this commit has been reverted due to an incorrect merge, sorry for the confusion
status-b2g-v2.5:
fixed → ---
You need to log in
before you can comment on or make changes to this bug.
Description
•