Open Bug 1751278 Opened 3 years ago Updated 8 months ago

Using the "--profile" argument in "moz:firefoxOptions['args']" generates two profile entries in the geckoview config file

Categories

(Testing :: geckodriver, defect, P3)

defect

Tracking

(firefox-esr91 unaffected, firefox96 wontfix, firefox97 wontfix, firefox98 wontfix, firefox99 wontfix, firefox100 affected)

Tracking Status
firefox-esr91 --- unaffected
firefox96 --- wontfix
firefox97 --- wontfix
firefox98 --- wontfix
firefox99 --- wontfix
firefox100 --- affected

People

(Reporter: whimboo, Unassigned)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(2 files)

Specifying a Firefox profile via moz:firefoxOptions["args"] causes the geckoview config file on the Android device to contain two entries for--profile` like:

1642709641495	geckodriver::android	DEBUG	Content of generated GeckoView config file:
## GeckoView configuration YAML
##
## Auto-generated by geckodriver.
## See https://mozilla.github.io/geckoview/consumer/docs/automation.
---
env:
  MOZ_CRASHREPORTER: "1"
  MOZ_CRASHREPORTER_NO_REPORT: "1"
  MOZ_CRASHREPORTER_SHUTDOWN: "1"
args:
  - "--marionette"
  - "--remote-debugging-port"
  - "--profile"
  - /sdcard/Android/data/org.mozilla.geckoview.test_runner/files/test_root/org.mozilla.geckoview.test_runner-geckodriver-profile
  - "--profile"
  - /Users/henrik/code/gecko/_test-profile/

Note that the first entry is what we want. But the second entry is the source profile from the host.

This is a regression in geckodriver 0.30.0.

This is a regression from bug 1721447 since we use the application arguments from moz:firefoxOptions to start Firefox on Android.

To fix this we will have to ignore the --profile argument and the immediate successor.

Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Regressed by: 1721447
Summary: Using the "--profile" argument generates two profile entries in the geckoview config file → Using the "--profile" argument in "moz:firefoxOptions['args']" generates two profile entries in the geckoview config file

Set release status flags based on info from the regressing bug 1721447

Has Regression Range: --- → yes

It's not a blocking issue and the GeckoView application is only considering the first profile as passed in. So it's not a regression we have to immediately work on. If time permits we could still try to get it into the 0.31.0 release.

Assignee: hskupin → nobody
Status: ASSIGNED → NEW

We should be safe to let this slip to the next 0.32.0 release.

Blocks: 1750691
No longer blocks: 1723202

There was no time for the 0.32.0 release. Lets keep it on the radar for 0.33.0.

Blocks: 1794560
No longer blocks: 1750691
No longer blocks: 1794560
Blocks: 1814050
Blocks: 1824713
No longer blocks: 1814050
No longer blocks: 1824713

:whimboo I'm looking at tackling this bug. I have the android emulator up and running with firefox but when I try to run geckodriver ./mach geckodriver I get the following error:

 0:00.59 E ERROR: Binary expected at /home/james/git-projects/mozilla-firefox/mozilla-unified/obj-x86_64-unknown-linux-android/dist/bin/fennec does not exist.
 0:00.59 It looks like your program isn't built. You can run |./mach build| to build it.

I suspect that i'm missing an option to build fennec, as that was the case with geckodriver initially, but I'm not sure what to add to my mozconfig

# Build GeckoView/Firefox for Android:
ac_add_options --enable-project=mobile/android
ac_add_options --enable-geckodriver
# Targeting the following architecture.
# For regular phones, no --target is needed.
# For x86 emulators (and x86 devices, which are uncommon):
# ac_add_options --target=i686
# For newer phones or Apple silicon
# ac_add_options --target=aarch64
# For x86_64 emulators (and x86_64 devices, which are even less common):
# ac_add_options --target=x86_64

Do you know what I need to do in order to reproduce the output that you showed originally?

Flags: needinfo?(hskupin)

The mozconfig that I have for GeckoView is the following:

mk_add_options MOZ_OBJDIR=/Users/henrik/code/gecko-obj/mobile
mk_add_options AUTOCLOBBER=1

ac_add_options --enable-application=mobile/android
ac_add_options --target=aarch64-linux-android
ac_add_options --enable-artifact-builds
ac_add_options --disable-debug

# workaround for bug 1748626 (crash for missing packages)
ac_add_options --enable-crashreporter

# Write build artifacts to:

Note that artifact builds are enough here as well given that we do not change any core (C++/rust) code of Gecko. I would suggest you to install the mozconfigwrapper package to easily switch between build environments. Further use a different MOZ_OBJDIR per mozconfig so that your other build doesn't get overridden.

mach geckodriver is not needed. Just go into testing/geckodriver and run cargo build as usual. That will place a debug binary of geckodriver into target/debug/geckodriver which ./mach wpt can pick up by specifying the path via --webdriver-binary. Let me know if that helped to build GeckoView.

Flags: needinfo?(hskupin)

Hi James, I want to check back if the above mentioned mozconfig was helpful and you got your own build for Android running. Please let me know when you have the time to check. Thanks.

Assignee: nobody → jameshendry05
Status: NEW → ASSIGNED
Flags: needinfo?(jameshendry05)

Apologies for the slow reply I did get it working but then got stuck. Hopefully with your help I can continue
Thanks to your help I was able to build android and run:
./mach wpt --webdriver-binary=target/debug/geckodriver --webdriver-arg=-v
Which results in logging the generated geckoview config file:

5:08.68 pid:55883 1722068237261	geckodriver::android	DEBUG	Content of generated GeckoView config file:
 5:08.68 pid:55883 ## GeckoView configuration YAML
 5:08.68 pid:55883 ##
 5:08.68 pid:55883 ## Auto-generated by geckodriver.
 5:08.68 pid:55883 ## See https ... "--profile"
 5:08.68 pid:55883   - /tmp/tmppehrx0pl.mozrunner
 5:08.68 pid:55883   - "--remote-debugging-port"
 5:08.68 pid:55883   - "9222"
 5:08.68 pid:55883   - "--remote-allow-hosts"
 5:08.68 pid:55883   - localhost
 5:08.68 pid:55883 1722068237261	geckodriver::android	DEBUG	Pushing GeckoView configuration file to /data/local/tmp/org.mozilla.geckoview.test_runner-geckoview-config.yaml

But i'm not sure which web-platform tests I should be running to see the extra --profile argument (or how to introduce the extra --profile argument)

Flags: needinfo?(jameshendry05)

You cannot actually just run a web-platform test to reproduce this issue. Instead you have to run a command manually like via curl. Here the steps:

  1. Start the emulator
  2. Start geckodriver
  3. Run curl -H 'Content-Type: application/json' -d '{"capabilities": {"alwaysMatch": {"moz:firefoxOptions": {"args": ["--profile", "some_path"], "androidPackage": "org.mozilla.firefox", "androidActivity": ".App", "androidIntentArguments": ["-a", "android.intent.action.VIEW", "-d", "about:blank"]}}' http://localhost:4444/session

With those steps you should see the 2nd --profile line(s) in the YAML configuration.

No longer blocks: 1871543
Attached file ADB logcat output
I am now able to reproduce the issue and see the generated config file with two `--profile` entries using the following: Data to send with curl (Make sure the directory exists): ``` {"capabilities": {"alwaysMatch": {"moz:firefoxOptions": {"args": ["--profile", "/home/james/Downloads/test_profile/"], "androidPackage": "org.mozilla.geckoview_example", "androidActivity": ".GeckoViewActivity", "androidIntentArguments": ["-a", "android.intent.action.VIEW", "-d", "about:blank"]}}}} ``` However, when the profile argument seems to be partly ignored: ``` 1723648597474 geckodriver::android DEBUG Content of generated GeckoView config file: ## GeckoView configuration YAML ## ## Auto-generated by geckodriver. ## See https://mozilla.github.io/geckoview/consumer/docs/automation. --- env: MOZ_CRASHREPORTER: "1" MOZ_CRASHREPORTER_NO_REPORT: "1" MOZ_CRASHREPORTER_SHUTDOWN: "1" args: - "--marionette" - "--profile" - /home/james/Downloads/test_profile 1723648597474 geckodriver::android DEBUG Pushing GeckoView configuration file to /data/local/tmp/org.mozilla.geckoview_example-geckoview-config.yaml 1723648597475 mozdevice TRACE execute_host_command: >> "host:transport:emulator-5554" 1723648597475 mozdevice TRACE execute_host_command: << [] 1723648597475 mozdevice TRACE execute_host_command: >> "shell:ls /data/local/tmp" 1723648597483 mozdevice TRACE execute_host_command: << "org.mozilla.geckoview_example-geckoview-config.yaml\n" 1723648597526 mozdevice TRACE execute_host_command: >> "host:transport:emulator-5554" 1723648597526 mozdevice TRACE execute_host_command: << [] 1723648597526 mozdevice TRACE execute_host_command: >> "shell:am set-debug-app --persistent org.mozilla.geckoview_example" 1723648597700 mozdevice TRACE execute_host_command: << "" 1723648597700 geckodriver::android DEBUG Launching org.mozilla.geckoview_example/.GeckoViewActivity 1723648597703 mozdevice TRACE execute_host_command: >> "host:transport:emulator-5554" 1723648597703 mozdevice TRACE execute_host_command: << [] 1723648597703 mozdevice TRACE execute_host_command: >> "shell:am start -W -n org.mozilla.geckoview_example/.GeckoViewActivity -a android.intent.action.VIEW -d about:blank --es args \"--marionette --profile /sdcard/Android/data/org.mozilla.geckoview_example/files/test_root/org.mozilla.geckoview_example-geckodriver-profile\"" 1723648598102 mozdevice TRACE execute_host_command: << "Starting: Intent { act=android.intent.action.VIEW dat=about:blank cmp=org.mozilla.geckoview_example/.GeckoViewActivity (has extras) }\nStatus: ok\nActivity: org.mozilla.geckoview_example/.GeckoViewActivity\nThisTime: 216\nTotalTime: 216\nWaitTime: 219\nComplete\n" 1723648598102 geckodriver::marionette DEBUG Waiting 60s to connect to browser on 127.0.0.1 1723648598103 geckodriver::marionette TRACE Retrying in 100ms 1723648598204 geckodriver::marionette TRACE Retrying in 100ms --- GeckoView app crashes due to missing profile, geckodriver hangs --- ``` Using the wrong profile argument comes from the launch method (android.rs): ``` pub fn launch(&self) -> Result<()> { // TODO: Remove the usage of intent arguments once Fennec is no longer // supported. Packages which are using GeckoView always read the arguments // via the YAML configuration file. let mut intent_arguments = self .options .intent_arguments .clone() .unwrap_or_else(|| Vec::with_capacity(3)); intent_arguments.push("--es".to_owned()); intent_arguments.push("args".to_owned()); intent_arguments.push(format!("--marionette --profile {}", self.profile.display())); ``` I believe this mismatch is causing geckoview to crash: `adb logcat` ```

I am now able to reproduce the issue and see the generated config file with two --profile entries using the following:

Data to send with curl (Make sure the directory exists):

{"capabilities": {"alwaysMatch": {"moz:firefoxOptions": {"args": ["--profile", "/home/james/Downloads/test_profile/"], "androidPackage": "org.mozilla.geckoview_example", "androidActivity": ".GeckoViewActivity", "androidIntentArguments": ["-a", "android.intent.action.VIEW", "-d", "about:blank"]}}}}

Output before changes:

## GeckoView configuration YAML
##
## Auto-generated by geckodriver.
## See https://mozilla.github.io/geckoview/consumer/docs/automation.
---
env:
  MOZ_CRASHREPORTER: "1"
  MOZ_CRASHREPORTER_NO_REPORT: "1"
  MOZ_CRASHREPORTER_SHUTDOWN: "1"
args:
  - "--marionette"
  - "--profile"
  - /sdcard/Android/data/org.mozilla.geckoview_example/files/test_root/org.mozilla.geckoview_example-geckodriver-profile
  - "--profile"
  - /home/james/Downloads/test_profile

After changes:
I've made it so it ignores the --profile and logs a warning:

1723650818220	geckodriver::android	WARN	Ignoring --profile argument
1723650818220	geckodriver::android	DEBUG	Content of generated GeckoView config file:
## GeckoView configuration YAML
##
## Auto-generated by geckodriver.
## See https://mozilla.github.io/geckoview/consumer/docs/automation.
---
env:
  MOZ_CRASHREPORTER: "1"
  MOZ_CRASHREPORTER_NO_REPORT: "1"
  MOZ_CRASHREPORTER_SHUTDOWN: "1"
args:
  - "--marionette"
  - "--profile"
  - /sdcard/Android/data/org.mozilla.geckoview_example/files/test_root/org.mozilla.geckoview_example-geckodriver-profile
No longer blocks: 1910592
Blocks: 1938333

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: jameshendry05 → nobody
Status: ASSIGNED → NEW
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: