NullPointerException: RestrictedProfiles.isGuestProfile(RestrictedProfiles.java:54)

RESOLVED FIXED in Firefox 42

Status

()

Firefox for Android
Profile Handling
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: sebastian, Assigned: sebastian)

Tracking

42 Branch
Firefox 43
All
Android
Points:
---

Firefox Tracking Flags

(firefox42 fixed, firefox43 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
This crash happens pretty reliable after browsing the settings and sync status activity for some time. I assume this is outfall from removing the static initWithProfile() method.

> 08-07 16:37:46.219    5138-5138/org.mozilla.fennec_sebastian E/AndroidRuntime﹕ FATAL EXCEPTION: main
>     Process: org.mozilla.fennec_sebastian, PID: 5138
>    java.lang.NullPointerException: Attempt to invoke interface method 'org.mozilla.gecko.GeckoProfile org.mozilla.gecko.GeckoAppShell$GeckoInterface.getProfile()' on a null object reference
>             at org.mozilla.gecko.RestrictedProfiles.isGuestProfile(RestrictedProfiles.java:54)
>             at org.mozilla.gecko.RestrictedProfiles.createConfiguration(RestrictedProfiles.java:44)
>             at org.mozilla.gecko.RestrictedProfiles.getConfiguration(RestrictedProfiles.java:32)
>             at org.mozilla.gecko.RestrictedProfiles.isAllowed(RestrictedProfiles.java:101)
>             at org.mozilla.gecko.preferences.GeckoPreferences.setupPreferences(GeckoPreferences.java:814)
>             at org.mozilla.gecko.preferences.GeckoPreferences.setupPreferences(GeckoPreferences.java:655)
>             at org.mozilla.gecko.preferences.GeckoPreferenceFragment.onCreate(GeckoPreferenceFragment.java:81)
>             at android.app.Fragment.performCreate(Fragment.java:2185)
>             at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:942)
>             at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1148)
>             at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1130)
>             at android.app.FragmentManagerImpl.dispatchCreate(FragmentManager.java:1948)
>             at android.app.FragmentController.dispatchCreate(FragmentController.java:141)
>             at android.app.Activity.onCreate(Activity.java:917)
>             at android.preference.PreferenceActivity.onCreate(PreferenceActivity.java:536)
>             at org.mozilla.gecko.preferences.GeckoPreferences.onCreate(GeckoPreferences.java:354)
>             at android.app.Activity.performCreate(Activity.java:6162)
>             at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
>             at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2370)
>             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2477)
>             at android.app.ActivityThread.-wrap11(ActivityThread.java)
>             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1345)
>             at android.os.Handler.dispatchMessage(Handler.java:102)
>             at android.os.Looper.loop(Looper.java:148)
>             at android.app.ActivityThread.main(ActivityThread.java:5415)
>             at java.lang.reflect.Method.invoke(Native Method)
>             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:725)
>             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:615)
(Assignee)

Comment 1

3 years ago
This is reproducible by enabling the developer option "Don't keep activities". After that pause and resume the settings activity.

It seems like GeckoInterface is not set on GeckoAppShell when GeckoPreferences resumes and queries RestrictedProfiles.
Status: NEW → ASSIGNED
(Assignee)

Comment 2

3 years ago
Created attachment 8646372 [details] [diff] [review]
1192346-gecko-profile.patch

This patch is partially restoring the previous behavior:
https://hg.mozilla.org/integration/fx-team/diff/8fd046b77ea3/mobile/android/base/preferences/GeckoPreferences.java

Background: We are in the settings activity. If we now switch to a different app then Android can decide to kill our process. Later when we go back to the application Android creates a new process and restores the state. Now we are in the settings activity again but Gecko never ran in this process. GeckoApp has not been started and therefore no GeckoInterface instance has been set on GeckoAppShell.

This patch now checks whether a GeckoInterface instance is available and if not then falls back to call GeckoProfile.get(context) like previously.
Attachment #8646372 - Flags: review?(mhaigh)
Comment on attachment 8646372 [details] [diff] [review]
1192346-gecko-profile.patch

LGTM
Attachment #8646372 - Flags: review?(mhaigh) → review+
(Assignee)

Comment 4

3 years ago
url:        https://hg.mozilla.org/integration/fx-team/rev/10cab33e893c8627c02ecfe3dfdae94f5fea84f1
changeset:  10cab33e893c8627c02ecfe3dfdae94f5fea84f1
user:       Sebastian Kaspari <s.kaspari@gmail.com>
date:       Tue Aug 11 16:12:31 2015 +0200
description:
Bug 1192346 - RestrictedProfiles: If no GeckoInterface instance is available, try to get GeckoProfile from context. r=mhaigh
(Assignee)

Comment 5

3 years ago
Comment on attachment 8646372 [details] [diff] [review]
1192346-gecko-profile.patch

Approval Request Comment
[Feature/regressing bug #]: Regression introduced in bug 1187260
[User impact if declined]: App crashing in settings if app is resumed and Android has cleaned the previous process.
[Describe test coverage new/current, TreeHerder]: Not covered by a UI test. Tested locally. Needs to reproduce system behavior (process re-creation)
[Risks and why]: Low Risk - Partial restoring previous behavior.
[String/UUID change made/needed]: -
Attachment #8646372 - Flags: approval-mozilla-aurora?
https://hg.mozilla.org/mozilla-central/rev/10cab33e893c
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
status-firefox43: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 43
Comment on attachment 8646372 [details] [diff] [review]
1192346-gecko-profile.patch

Fix a crash, taking it.
Attachment #8646372 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.