Closed Bug 927253 Opened 6 years ago Closed 6 years ago

[geckoview] NullPointerException in GeckoNetworkManager

Categories

(Core Graveyard :: Embedding: GRE Core, defect)

x86_64
Linux
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
mozilla27

People

(Reporter: mfinkle, Assigned: mfinkle)

References

Details

Attachments

(1 file)

We need to init the GeckoNetworkManager in GeckoView, like we do HardwareUtils and Clipboard.

W/System.err( 3047): java.lang.NullPointerException
W/System.err( 3047): 	at org.mozilla.gecko.GeckoNetworkManager.getNetworkType(GeckoNetworkManager.java:204)
W/System.err( 3047): 	at org.mozilla.gecko.GeckoNetworkManager.updateNetworkType(GeckoNetworkManager.java:163)
W/System.err( 3047): 	at org.mozilla.gecko.GeckoNetworkManager.enableNotifications(GeckoNetworkManager.java:187)
W/System.err( 3047): 	at org.mozilla.gecko.GeckoAppShell.enableNetworkNotifications(GeckoAppShell.java:2326)
W/System.err( 3047): 	at org.mozilla.gecko.mozglue.GeckoLoader.nativeRun(Native Method)
W/System.err( 3047): 	at org.mozilla.gecko.mozglue.GeckoLoader.nativeRun(Native Method)
W/System.err( 3047): 	at org.mozilla.gecko.GeckoAppShell.runGecko(GeckoAppShell.java:337)
W/System.err( 3047): 	at org.mozilla.gecko.GeckoThread.run(GeckoThread.java:174)
Simply calls GeckoNetworkManager.init(), which is not exactly designed to be called more than once, but doesn't seem the worse for wear. Nothing in there that would break if called more than once.

Technically, we won't call it more than once yet anyway, since we don't support more than one GeckoView yet.
Assignee: nobody → mark.finkle
Attachment #817626 - Flags: review?(blassey.bugs)
Attachment #817626 - Flags: review?(blassey.bugs) → review+
BTW (not sure whether relevant here), but I'd like to remove all privileges apart from INTERNET (and maybe even that), esp. the WLAN/network-watching privileges. Would be nice, if you kept that in mind, to write the code so that it doesn't fail without these privs, just doesn't have realtime updates on connectivity.
Summary: [geckoview] NPE in GeckoNetworkManager → [geckoview] NullPointerException in GeckoNetworkManager
https://hg.mozilla.org/mozilla-central/rev/780abea72b55
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
Sorry for the irrelevant comment 3. I filed bug 927831 about it.
Did I just see this again?  This is from mfinkle's https://github.com/mfinkle/geckobrowser against custom built geckoview_library archives, but it sure looks similar.

E GeckoConsole(11523)         Could not read chrome manifest 'file:///data/data/com.starkravingfinkle.geckobrowser/chrome.manifest'.
W ResourceType(11523)         Too many attribute references, stopped at: 0x01010099
E Profiler(11523)             BPUnw: [3 total] thread_register_for_profiling(me=0x7bb1ce90, stacktop=0x821ffdef)
E Profiler(11523)             BPUnw: [4 total] thread_register_for_profiling(me=0x7bd15d98, stacktop=0x822ffdef)
E GeckoConsole(11523)         zerdatime 1394040581616 - browser chrome startup finished.
D GeckoEventDispatcher(11523) dispatchEvent: no listeners registered for event 'LightweightTheme:Disable'
D GeckoEventDispatcher(11523) dispatchEvent: no listeners registered for event 'CharEncoding:State'
E GeckoAppShell(11523)        >>> REPORTING UNCAUGHT EXCEPTION FROM THREAD 2951 ("Gecko")
E GeckoAppShell(11523)        java.lang.NullPointerException
E GeckoAppShell(11523)        	at org.mozilla.gecko.GeckoNetworkManager.getNetworkType(GeckoNetworkManager.java:221)
E GeckoAppShell(11523)        	at org.mozilla.gecko.GeckoNetworkManager.updateNetworkType(GeckoNetworkManager.java:180)
E GeckoAppShell(11523)        	at org.mozilla.gecko.GeckoNetworkManager.enableNotifications(GeckoNetworkManager.java:204)
E GeckoAppShell(11523)        	at org.mozilla.gecko.GeckoAppShell.enableNetworkNotifications(GeckoAppShell.java:2458)
E GeckoAppShell(11523)        	at org.mozilla.gecko.mozglue.GeckoLoader.nativeRun(Native Method)
E GeckoAppShell(11523)        	at org.mozilla.gecko.mozglue.GeckoLoader.nativeRun(Native Method)
E GeckoAppShell(11523)        	at org.mozilla.gecko.GeckoAppShell.runGecko(GeckoAppShell.java:347)
E GeckoAppShell(11523)        	at org.mozilla.gecko.GeckoThread.run(GeckoThread.java:178)
E GeckoAppShell(11523)        Main thread stack:
E GeckoAppShell(11523)        android.os.MessageQueue.nativePollOnce(Native Method)
E GeckoAppShell(11523)        android.os.MessageQueue.next(MessageQueue.java:132)
E GeckoAppShell(11523)        android.os.Looper.loop(Looper.java:124)
E GeckoAppShell(11523)        android.app.ActivityThread.main(ActivityThread.java:5419)
E GeckoAppShell(11523)        java.lang.reflect.Method.invokeNative(Native Method)
E GeckoAppShell(11523)        java.lang.reflect.Method.invoke(Method.java:525)
E GeckoAppShell(11523)        com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
E GeckoAppShell(11523)        com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
E GeckoAppShell(11523)        dalvik.system.NativeStart.main(Native Method)
E Gecko(11523)                mozalloc_abort: Redirecting call to abort() to mozalloc_abort
...
I've just built it and I got the same problem.
I followed this instruction https://github.com/mfinkle/geckobrowser
I used these libraries  http://ftp.mozilla.org/pub/mozilla.org/mobile/nightly/latest-mozilla-central-android/  (18-Mar-2014 11:16)
Have you figured out the solution?
(In reply to Nick Alexander :nalexander from comment #6)
> Did I just see this again?  This is from mfinkle's
> https://github.com/mfinkle/geckobrowser against custom built
> geckoview_library archives, but it sure looks similar.
> 
> E GeckoConsole(11523)         Could not read chrome manifest
> 'file:///data/data/com.starkravingfinkle.geckobrowser/chrome.manifest'.
> W ResourceType(11523)         Too many attribute references, stopped at:
> 0x01010099
> E Profiler(11523)             BPUnw: [3 total]
> thread_register_for_profiling(me=0x7bb1ce90, stacktop=0x821ffdef)
> E Profiler(11523)             BPUnw: [4 total]
> thread_register_for_profiling(me=0x7bd15d98, stacktop=0x822ffdef)
> E GeckoConsole(11523)         zerdatime 1394040581616 - browser chrome
> startup finished.
> D GeckoEventDispatcher(11523) dispatchEvent: no listeners registered for
> event 'LightweightTheme:Disable'
> D GeckoEventDispatcher(11523) dispatchEvent: no listeners registered for
> event 'CharEncoding:State'
> E GeckoAppShell(11523)        >>> REPORTING UNCAUGHT EXCEPTION FROM THREAD
> 2951 ("Gecko")
> E GeckoAppShell(11523)        java.lang.NullPointerException
> E GeckoAppShell(11523)        	at
> org.mozilla.gecko.GeckoNetworkManager.getNetworkType(GeckoNetworkManager.
> java:221)
> E GeckoAppShell(11523)        	at
> org.mozilla.gecko.GeckoNetworkManager.updateNetworkType(GeckoNetworkManager.
> java:180)
> E GeckoAppShell(11523)        	at
> org.mozilla.gecko.GeckoNetworkManager.
> enableNotifications(GeckoNetworkManager.java:204)
> E GeckoAppShell(11523)        	at
> org.mozilla.gecko.GeckoAppShell.enableNetworkNotifications(GeckoAppShell.
> java:2458)
> E GeckoAppShell(11523)        	at
> org.mozilla.gecko.mozglue.GeckoLoader.nativeRun(Native Method)
> E GeckoAppShell(11523)        	at
> org.mozilla.gecko.mozglue.GeckoLoader.nativeRun(Native Method)
> E GeckoAppShell(11523)        	at
> org.mozilla.gecko.GeckoAppShell.runGecko(GeckoAppShell.java:347)
> E GeckoAppShell(11523)        	at
> org.mozilla.gecko.GeckoThread.run(GeckoThread.java:178)
> E GeckoAppShell(11523)        Main thread stack:
> E GeckoAppShell(11523)        android.os.MessageQueue.nativePollOnce(Native
> Method)
> E GeckoAppShell(11523)       
> android.os.MessageQueue.next(MessageQueue.java:132)
> E GeckoAppShell(11523)        android.os.Looper.loop(Looper.java:124)
> E GeckoAppShell(11523)       
> android.app.ActivityThread.main(ActivityThread.java:5419)
> E GeckoAppShell(11523)        java.lang.reflect.Method.invokeNative(Native
> Method)
> E GeckoAppShell(11523)       
> java.lang.reflect.Method.invoke(Method.java:525)
> E GeckoAppShell(11523)       
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:
> 1187)
> E GeckoAppShell(11523)       
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
> E GeckoAppShell(11523)        dalvik.system.NativeStart.main(Native Method)
> E Gecko(11523)                mozalloc_abort: Redirecting call to abort() to
> mozalloc_abort
> ...
I am still getting the getNetworkType nullPointerException when using the March 17 2014 libraries from http://ftp.mozilla.org/pub/mozilla.org/mobile/nightly/latest-mozilla-central-android/ . Are those up-to-date with these fixes?
Indeed this change isn't included in the current source:
https://hg.mozilla.org/mozilla-central/file/5da02ad31b93/mobile/android/base/GeckoView.java#l74

Is there a reason for that?
(In reply to Ties from comment #10)
> Indeed this change isn't included in the current source:
> https://hg.mozilla.org/mozilla-central/file/5da02ad31b93/mobile/android/base/
> GeckoView.java#l74
> 
> Is there a reason for that?

Presumably it was removed by a later patch.  You might follow Bug 979623, which I think is similar.
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.