Profile can only be used once when launching B2G desktop client with mozrunner

RESOLVED FIXED in mozilla38

Status

defect
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: davehunt, Assigned: ted)

Tracking

({pi-marionette-runner})

unspecified
mozilla38
x86
macOS
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [affects=b2gdesktop])

Attachments

(1 attachment, 2 obsolete attachments)

When launching the B2G desktop client with mozrunner, the profile can only be used once. Subsequent launches with the same profile fail with 'No permission to use the keyboard API for app://system.gaiamobile.org'

Full console output:

$ mozrunner -b /Applications/B2G.app/Contents/MacOS/b2g-bin -p /Applications/B2G.app/Contents/MacOS/gaia/profile
Starting: /Applications/B2G.app/Contents/MacOS/b2g-bin -profile /Applications/B2G.app/Contents/MacOS/gaia/profile
1365533220669	Marionette	INFO	MarionetteComponent loaded
1365533220670	Marionette	INFO	marionette enabled
1365533220719	Marionette	INFO	marionette initializing at final-ui-startup
1365533220757	Marionette	INFO	marionette-actors.js loaded
1365533220758	Marionette	INFO	marionette listener opened
###################################### forms.js loaded
############################### browserElementPanning.js loaded
######################## BrowserElementChildPreload.js loaded
[AccessFu] INFO attach
No permission to use the keyboard API for app://system.gaiamobile.org

For Marionette tests this will be remedied by bug 857599 which clones the profile, however the issue will still exist if launched directly.
It appears that copying the permissions.sqlite from the clean profile resolves this issue. This must therefore become corrupt when launching the B2G desktop client via mozrunner.
Also, I cannot replicate this when launching directly instead of using mozrunner:

$ /Applications/B2G.app/Contents/MacOS/b2g-bin --profile /Applications/B2G.app/Contents/MacOS/gaia/profile

Works every time.
No longer blocking bug 857622 as the Marionette test runner will now clone the profile by default.
No longer blocks: 857622
Whiteboard: [runner]
Whiteboard: [runner] → [runner][affects=b2gdesktop]
this still an issue?
Flags: needinfo?(dave.hunt)
Yes, I'm still able to replicate this with the latest mozrunner and b2g desktop build, however the errors are different:

JavaScript error: app://system.gaiamobile.org/shared/js/dump.js, line 24: TypeError: settings is null
JavaScript error: app://system.gaiamobile.org/js/applications.js, line 85: TypeError: apps.mgmt is undefined
JavaScript error: app://system.gaiamobile.org/js/init_logo_handler.js, line 98: ReferenceError: Service is not defined
JavaScript error: app://system.gaiamobile.org/shared/js/date_time_helper.js, line 33: TypeError: window.navigator.mozSettings is null
JavaScript error: app://system.gaiamobile.org/js/wake_lock_manager.js, line 47: TypeError: navigator.mozPower is undefined
JavaScript error: app://system.gaiamobile.org/shared/js/settings_listener.js, line 28: TypeError: settings is null
JavaScript error: app://system.gaiamobile.org/shared/js/settings_listener.js, line 28: TypeError: settings is null
JavaScript error: app://system.gaiamobile.org/js/input_window.js, line 48: ReferenceError: AppTransitionController is not defined
LogShake: starting captureLogs listener
JavaScript error: app://system.gaiamobile.org/js/findmydevice_launcher.js, line 32: TypeError: navigator.mozSettings is null
JavaScript error: app://system.gaiamobile.org/js/newsletter_manager.js, line 103: TypeError: navigator.addIdleObserver is not a function
JavaScript error: app://system.gaiamobile.org/js/applications.js, line 54: TypeError: navigator.mozApps.mgmt is undefined
JavaScript error: app://system.gaiamobile.org/js/cell_broadcast_system.js, line 42: TypeError: settings is null
JavaScript error: app://system.gaiamobile.org/shared/js/settings_listener.js, line 28: TypeError: settings is null
JavaScript error: app://system.gaiamobile.org/shared/js/settings_listener.js, line 28: TypeError: settings is null
JavaScript error: app://system.gaiamobile.org/shared/js/version_helper.js, line 52: TypeError: navigator.mozSettings is null
Flags: needinfo?(dave.hunt)
Whiteboard: [runner][affects=b2gdesktop] → [affects=b2gdesktop]
I'm hitting this issue in the context of Luciddream testing, where the Luciddream harness is built atop the Marionette python harness (https://github.com/luser/luciddream/issues/4). By default if you pass `--binary=/path/to/b2g/b2g` it uses the built-in profile and the second run doesn't work. If you instead pass `--binary=/path/to/b2g/b2g-bin --profile=/path/to/b2g/gaia/profile` it clones the profile and uses that and you can run it over and over again.

Feels like we could make the latter behavior the default.
This works for me locally and makes life a lot easier for using B2G desktop in the Marionette test runner.
Attachment #8540242 - Flags: review?(ahalberstadt)
Assignee: nobody → ted
Status: NEW → ASSIGNED
If you used this with a local b2g build (without specifying GAIADIR) b2g-bin doesn't exist, I updated the patch to check that the -bin file exists before using it.
Attachment #8540307 - Flags: review?(ahalberstadt)
Attachment #8540242 - Attachment is obsolete: true
Attachment #8540242 - Flags: review?(ahalberstadt)
Oops, that test change was unintentional.
Attachment #8540844 - Flags: review?(ahalberstadt)
Attachment #8540307 - Attachment is obsolete: true
Attachment #8540307 - Flags: review?(ahalberstadt)
Comment on attachment 8540844 [details] [diff] [review]
B2GDesktopInstance should clone the gaia profile by default

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

Lgtm, with some nits.

::: testing/marionette/client/marionette/geckoinstance.py
@@ +135,5 @@
>              self.prefs = None
>          self.start()
>  
>  class B2GDesktopInstance(GeckoInstance):
> +    def __init__(self, host, port, bin, **kwargs):

nit: please use 'binary' as bin is a built-in keyword.

@@ +145,5 @@
> +                                             'gaia',
> +                                             'profile')
> +        if '-bin' not in os.path.basename(bin):
> +            if bin.endswith('.exe'):
> +                newbin = bin[:-4] + '-bin.exe'

nit: s/4/len('.exe')
Attachment #8540844 - Flags: review?(ahalberstadt) → review+
(In reply to Andrew Halberstadt [:ahal] from comment #11)
> >  class B2GDesktopInstance(GeckoInstance):
> > +    def __init__(self, host, port, bin, **kwargs):
> 
> nit: please use 'binary' as bin is a built-in keyword.

I copied this from GeckoInstance's __init__, but I'll fix it in both places.
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #12)
> (In reply to Andrew Halberstadt [:ahal] from comment #11)
> > >  class B2GDesktopInstance(GeckoInstance):
> > > +    def __init__(self, host, port, bin, **kwargs):
> > 
> > nit: please use 'binary' as bin is a built-in keyword.
> 
> I copied this from GeckoInstance's __init__, but I'll fix it in both places.

...actually the callers pass this by keyword so I'd have to chase that around fixing callers and I'm not really in the mood.
https://hg.mozilla.org/mozilla-central/rev/99cbc6cca7df
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in before you can comment on or make changes to this bug.