Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

FilePicker should only process PromptRequest.File #8967

Closed
Amejia481 opened this issue Nov 12, 2020 · 0 comments
Closed

FilePicker should only process PromptRequest.File #8967

Amejia481 opened this issue Nov 12, 2020 · 0 comments
Assignees
Labels
💥 crash <prompts> Component: feature-prompts
Milestone

Comments

@Amejia481
Copy link
Contributor

Amejia481 commented Nov 12, 2020

As we can see in this stack trace provided in mozilla-mobile/fenix#16537, FilePicker is trying to process a PromptRequest that doesn't belong to it, not sure how we entered in that state, but it looks like a race condition were a PromptRequest.File was requested but before it was proceeded an PromptRequest$Alert replaced it. We have to prevent processing invalid request in FilePicker

java.lang.ClassCastException: mozilla.components.concept.engine.prompt.PromptRequest$Alert cannot be cast to mozilla.components.concept.engine.prompt.PromptRequest$File
    at mozilla.components.feature.prompts.file.FilePicker$onActivityResult$1.invoke(FilePicker.kt:3)
    at androidx.core.app.AppOpsManagerCompat.consumePromptFrom(AppOpsManagerCompat.java:5)
    at androidx.core.app.AppOpsManagerCompat.consumePromptFrom$default(AppOpsManagerCompat.java:1)
    at mozilla.components.feature.prompts.file.FilePicker.onActivityResult(FilePicker.kt:1)
    at mozilla.components.feature.prompts.PromptFeature.onActivityResult(PromptFeature.kt:1)
    at org.mozilla.fenix.browser.BaseBrowserFragment$onActivityResult$1.invoke(BaseBrowserFragment.kt:3)
    at mozilla.components.support.base.feature.ViewBoundFeatureWrapper.withFeature(ViewBoundFeatureWrapper.kt:1)
    at org.mozilla.fenix.browser.BaseBrowserFragment.onActivityResult(BaseBrowserFragment.kt:1)
    at androidx.fragment.app.FragmentActivity.onActivityResult(FragmentActivity.java:7)
    at android.app.Activity.dispatchActivityResult(Activity.java:7454)
    at android.app.ActivityThread.deliverResults(ActivityThread.java:4384)
    at android.app.ActivityThread.handleSendResult(ActivityThread.java:4433)
    at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1836)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6702)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)

java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=203721, result=-1, data=null} to activity {org.mozilla.fenix/org.mozilla.fenix.App}: java.lang.ClassCastException: mozilla.components.concept.engine.prompt.PromptRequest$Alert cannot be cast to mozilla.components.concept.engine.prompt.PromptRequest$File
    at android.app.ActivityThread.deliverResults(ActivityThread.java:4391)
    at android.app.ActivityThread.handleSendResult(ActivityThread.java:4433)
    at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1836)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6702)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)

┆Issue is synchronized with this Jira Task

@Amejia481 Amejia481 added <prompts> Component: feature-prompts 💥 crash labels Nov 12, 2020
@Amejia481 Amejia481 self-assigned this Nov 12, 2020
@Amejia481 Amejia481 added this to the 67.0.0 milestone Nov 12, 2020
Amejia481 added a commit to Amejia481/android-components that referenced this issue Nov 12, 2020
Amejia481 added a commit to Amejia481/android-components that referenced this issue Nov 12, 2020
Amejia481 added a commit to Amejia481/android-components that referenced this issue Nov 16, 2020
@mergify mergify bot closed this as completed in cacee76 Nov 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💥 crash <prompts> Component: feature-prompts
Projects
None yet
Development

No branches or pull requests

1 participant