Igalia / wolvic

A fast and secure browser for standalone virtual-reality and augmented-reality headsets.
https://wolvic.org
Mozilla Public License 2.0
813 stars 105 forks source link

[Chromium] Implement DateTime Picker #1256

Closed mshin-wolvic closed 8 months ago

mshin-wolvic commented 8 months ago

I tested it and I could get easily it to crash. Seems easy to fix though

13:31:52.198 27412-27412 System.err            W  java.lang.NullPointerException: Attempt to invoke interface method 'com.igalia.wolvic.browser.api.WResult com.igalia.wolvic.browser.api.WSession$PromptDelegate.onDateTimePrompt(com.igalia.wolvic.browser.api.WSession, com.igalia.wolvic.browser.api.WSession$PromptDelegate$DateTimePrompt)' on a null object reference
13:31:52.198 27412-27412                       W      at com.igalia.wolvic.browser.api.impl.PromptDelegateImpl$DateTimeChooserBridge.showDialog(PromptDelegateImpl.java:597)
13:31:52.198 27412-27412                       W      at org.chromium.content.browser.input.DateTimeChooserAndroid.showDialog(DateTimeChooserAndroid.java:70)
13:31:52.198 27412-27412                       W      at org.chromium.content.browser.input.DateTimeChooserAndroid.createDateTimeChooser(DateTimeChooserAndroid.java:93)
13:31:52.198 27412-27412                       W      at android.os.MessageQueue.nativePollOnce(Native Method)
13:31:52.198 27412-27412                       W      at android.os.MessageQueue.next(MessageQueue.java:335)
13:31:52.198 27412-27412                       W      at android.os.Looper.loopOnce(Looper.java:167)
13:31:52.198 27412-27412                       W      at android.os.Looper.loop(Looper.java:304)
13:31:52.198 27412-27412                       W      at android.app.ActivityThread.main(ActivityThread.java:7918)
13:31:52.198 27412-27412                       W      at java.lang.reflect.Method.invoke(Native Method)
13:31:52.198 27412-27412                       W      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
13:31:52.198 27412-27412                       W      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1010)

Thanks for checking. It could be easy to fix this but I'd like to understand why the delegate is the null object. sorry but I couldn't reproduce it. Maybe I'm testing within some pattern only. Could you let me know how to reproduce it?

svillar commented 8 months ago

I tested it and I could get easily it to crash. Seems easy to fix though

13:31:52.198 27412-27412 System.err            W  java.lang.NullPointerException: Attempt to invoke interface method 'com.igalia.wolvic.browser.api.WResult com.igalia.wolvic.browser.api.WSession$PromptDelegate.onDateTimePrompt(com.igalia.wolvic.browser.api.WSession, com.igalia.wolvic.browser.api.WSession$PromptDelegate$DateTimePrompt)' on a null object reference
13:31:52.198 27412-27412                       W    at com.igalia.wolvic.browser.api.impl.PromptDelegateImpl$DateTimeChooserBridge.showDialog(PromptDelegateImpl.java:597)
13:31:52.198 27412-27412                       W    at org.chromium.content.browser.input.DateTimeChooserAndroid.showDialog(DateTimeChooserAndroid.java:70)
13:31:52.198 27412-27412                       W    at org.chromium.content.browser.input.DateTimeChooserAndroid.createDateTimeChooser(DateTimeChooserAndroid.java:93)
13:31:52.198 27412-27412                       W    at android.os.MessageQueue.nativePollOnce(Native Method)
13:31:52.198 27412-27412                       W    at android.os.MessageQueue.next(MessageQueue.java:335)
13:31:52.198 27412-27412                       W    at android.os.Looper.loopOnce(Looper.java:167)
13:31:52.198 27412-27412                       W    at android.os.Looper.loop(Looper.java:304)
13:31:52.198 27412-27412                       W    at android.app.ActivityThread.main(ActivityThread.java:7918)
13:31:52.198 27412-27412                       W    at java.lang.reflect.Method.invoke(Native Method)
13:31:52.198 27412-27412                       W    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
13:31:52.198 27412-27412                       W    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1010)

Thanks for checking. It could be easy to fix this but I'd like to understand why the delegate is the null object. sorry but I couldn't reproduce it. Maybe I'm testing within some pattern only. Could you let me know how to reproduce it?

I think it was just going back but not really sure. In any case we should add null checks to the delegates because the session might have freed them by the time chromium calls these methods

mshin-wolvic commented 8 months ago

I think it was just going back but not really sure. In any case we should add null checks to the delegates because the session might have freed them by the time chromium calls these methods.

Thanks for sharing. I've added the NullPointerException to prevent the access of null delegate. I will patch the safe code for other implementations at this file in a separate patch.