Local profile settings in mozb2g don't currently work

RESOLVED FIXED

Status

Testing
Mozbase
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: wlach, Assigned: wlach)

Tracking

Trunk
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

So right now we have a method to modify the profile in mozb2g (/data/local/user.js), aiming to do two things:

1. Make it so that suspend doesn't kick in
2. Force the debugger to listen on a non-local (external) ip.

According to :jgriffin, the first profile setting doesn't actually work. Instead, we should send a message over marionette, using the method in the gaia test: https://github.com/mozilla-b2g/gaia/blob/master/tests/python/gaiatest/gaia_test.py#L16

For the second, we want the current behaviour at least for now on Eideticker, because of bug 800138.

Ideally, I would like to get away from modifying the default b2g profile file at all. After a few failed runs of eideticker (when we don't have the chance to restore this profile to a pristine state), this file quickly gets cluttered with the same profile settings appearing over and over. Is there no way we could generate some kind of profile in the testing directory which overrides the one in /data/local/user.js, like we do for Firefox and Fennec testing?

Failing that, we should at least fix (1) and temporarily not do (2) until we fix bug 800138.
> Is there no way we could generate some kind of profile in the testing directory 
> which overrides the one in /data/local/user.js, like we do for Firefox and Fennec 
> testing?

There is already such a profile, at /data/b2g/mozilla/*.default.  You could modify that instead of /data/local/user.js, but Gaia depends on the existing profile so you couldn't completely replace it without affecting Gaia.

An approach we've used in mochitest is to make a backup of /data/local/user.js before modifying (like user.js.bak) and restore it at the end of the run.   At the beginning of a run, if user.js.bak exists (because the last run terminated abnormally), restore it before continuing.

This prevents the problem of accumulating unwanted changes in the file.

An alternative would be to copy the existing profile at /data/b2g/mozilla..., modify it, and then use it (by updating /data/b2g/mozilla/profiles.ini to point to it), and at the end of the run, restore profiles.ini to the original profile.

None of this is very elegant.  No doubt we could use a B2G specific sublcass of mozprofile to handle this type of thing.
Created attachment 680249 [details] [diff] [review]
Patch to fix b2g preferences

This has the following changes:

1. Remove all default preferences for the rationale outlined above (adding a comment about adding back in the debugging server option at some point in the future)
2. Adds an "unlock" method for permanently unlocking the homescreen to the b2g mixin.

This seems to work well enough for Eideticker's purposes.
Attachment #680249 - Flags: review?(jgriffin)
Comment on attachment 680249 [details] [diff] [review]
Patch to fix b2g preferences

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

::: mozb2g/mozb2g/b2gmixin.py
@@ +100,5 @@
>          :param prefs: String of user_prefs to add to the profile. Defaults to a standard b2g testing profile.
>          """
> +        # currently we have no custom prefs to set (when bug 800138 is fixed,
> +        # we will probably want to enable marionette on an external ip by
> +        # default

missing ) at end of comment
Attachment #680249 - Flags: review?(jgriffin) → review+
Pushed: https://github.com/mozilla/mozbase/commit/98b0de896404f6dc69c92aa082c77f73fafa3828

I filed bug 812614 to deal with the unclean profile issue in the future.
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.