Closed Bug 1072263 Opened 7 years ago Closed 7 years ago

When using --profile, Gecko expects a nameless profile

Categories

(Firefox for Android Graveyard :: Profile Handling, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mfinkle, Unassigned)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch less-profile v0.1 (obsolete) — Splinter Review
When handling the --profile arg, GeckoApp currently throws a runtime exception if we don't get a profileName. Since --profile sets a custom path for a profile, Gecko does not use or expect a profileName. GeckoApp shouldn't either.

There are parts of the Java code that must have a profileName and they can use GeckoProfile.DEFAULT_PROFILE to get by.

This patch just falls back to GeckoProfile.DEFAULT_PROFILE right away if a different profileName is not given.

Try: https://tbpl.mozilla.org/?tree=Try&rev=cccce83833c0

The testGeckoProfile run has expected output:
https://tbpl.mozilla.org/php/getParsedLog.php?id=48745422&tree=Try&full=1
Attachment #8494464 - Flags: review?(bnicholson)
The Try build showed an intermittent NoMozillaDirectory exception. It's racy. I looked at the code that throws the exception. It does the follwoing:
1. does the mozilla folder exist?
2. if not #2 then mkdirs to create it

The problem is mkdirs can fail if the folder exists, which could happen in some race.

This patch flips the order:
1. attempt to mkdirs the mozilla folder (fails if it exists)
2. does the folder exist?

Here's a Try run using the newest patch:
https://tbpl.mozilla.org/?tree=Try&rev=b6c3eef53540
Attachment #8494464 - Attachment is obsolete: true
Attachment #8494464 - Flags: review?(bnicholson)
Attachment #8494594 - Flags: review?(bnicholson)
Comment on attachment 8494594 [details] [diff] [review]
less-profile v0.2

Review of attachment 8494594 [details] [diff] [review]:
-----------------------------------------------------------------

(In reply to Mark Finkle (:mfinkle) from comment #0)
> There are parts of the Java code that must have a profileName and they can
> use GeckoProfile.DEFAULT_PROFILE to get by.

If we reuse the name "default" for custom profiles, we can end up getting the wrong profile from the profile cache if something outside the activity tries to access the profile first (see https://bugzilla.mozilla.org/show_bug.cgi?id=881378#c1). It might be worth revisiting bug 881378 to fix that problem.

I think our tests are the only place we pass custom profile paths right now. As long as those are passing, I suppose this change is OK.
Attachment #8494594 - Flags: review?(bnicholson) → review+
https://hg.mozilla.org/mozilla-central/rev/50bca5ff5d3e
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.