Closed Bug 1454384 Opened 2 years ago Closed 2 years ago

Crash on geckoview_example startup when no extras set

Categories

(GeckoView :: General, defect)

51 Branch
All
Android
defect
Not set

Tracking

(firefox61 fixed)

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: esawin, Assigned: esawin)

Details

Attachments

(1 file, 1 obsolete file)

E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: org.mozilla.geckoview_example, PID: 22539
                  java.lang.RuntimeException: Unable to start activity ComponentInfo{org.mozilla.geckoview_example/org.mozilla.geckoview_example.GeckoViewActivity}: java.lang.NullPointerException: Attempt to read from field 'android.os.Parcel android.os.BaseBundle.mParcelledData' on a null object reference
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2984)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045)
                      at android.app.ActivityThread.-wrap14(ActivityThread.java)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:154)
                      at android.app.ActivityThread.main(ActivityThread.java:6776)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
                   Caused by: java.lang.NullPointerException: Attempt to read from field 'android.os.Parcel android.os.BaseBundle.mParcelledData' on a null object reference
                      at android.os.BaseBundle.<init>(BaseBundle.java:159)
                      at android.os.Bundle.<init>(Bundle.java:106)
                      at org.mozilla.geckoview.GeckoRuntimeSettings.<init>(GeckoRuntimeSettings.java:149)
                      at org.mozilla.geckoview.GeckoRuntimeSettings$Builder.build(GeckoRuntimeSettings.java:36)
                      at org.mozilla.geckoview_example.GeckoViewActivity.onCreate(GeckoViewActivity.java:68)
                      at android.app.Activity.performCreate(Activity.java:6956)
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045) 
                      at android.app.ActivityThread.-wrap14(ActivityThread.java) 
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642) 
                      at android.os.Handler.dispatchMessage(Handler.java:102) 
                      at android.os.Looper.loop(Looper.java:154) 
                      at android.app.ActivityThread.main(ActivityThread.java:6776) 
                      at java.lang.reflect.Method.invoke(Native Method) 
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518) 
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408) 
I/Process: Sending signal. PID: 22539 SIG: 9
Application terminated.
My overriding null arguments for this settings, we safe the app the null check for the extras. I'm creating new instances to make sure that chained calls to the settings have the expected result (e.g. settings.extras(someExtras).extras(null); should reset the extras setting).
Assignee: nobody → esawin
Attachment #8968195 - Flags: review?(snorp)
s/My/By
s/safe/save
Comment on attachment 8968195 [details] [diff] [review]
0001-Bug-1454384-1.0-Override-null-arguments-for-extras-a.patch

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

::: mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
@@ +51,5 @@
>           *
>           * @param args The Gecko process arguments.
>           */
>          public @NonNull Builder arguments(final @NonNull String[] args) {
> +            if (args == null) {

I think we should throw InvalidArgumentException instead. You've indicated with @NonNull that null is not allowed. We just need to enforce that at runtime.
Attachment #8968195 - Flags: review?(snorp) → review-
Attachment #8968195 - Attachment is obsolete: true
Attachment #8968223 - Flags: review?(snorp)
Attachment #8968223 - Flags: review?(snorp) → review+
Pushed by esawin@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/3eede08e88de
[1.0] Enforce non-null extras and arguments in GeckoRuntimeSettings. r=snorp
https://hg.mozilla.org/mozilla-central/rev/3eede08e88de
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 61
Product: Firefox for Android → GeckoView
Target Milestone: Firefox 61 → mozilla61
You need to log in before you can comment on or make changes to this bug.