Verified Commit 3efa706a authored by Arturo Mejia's avatar Arturo Mejia Committed by Pier Angelo Vendrame
Browse files

Bug 1908344 - Improve prompts showing a=dmeehan - BP, tor-browser#43005

parent 4b727108
Loading
Loading
Loading
Loading
+49 −37
Original line number Diff line number Diff line
@@ -544,11 +544,23 @@ class PromptFeature private constructor(
     *
     * @param session The session which requested the dialog.
     */
    @Suppress("NestedBlockDepth")
    @VisibleForTesting(otherwise = PRIVATE)
    internal fun onPromptRequested(session: SessionState) {
        // Some requests are handle with intents
        session.content.promptRequests.lastOrNull()?.let { promptRequest ->
            if (session.content.permissionRequestsList.isNotEmpty()) {
                onCancel(session.id, promptRequest.uid)
            } else {
                processPromptRequest(promptRequest, session)
            }
        }
    }

    @Suppress("NestedBlockDepth")
    private fun processPromptRequest(
        promptRequest: PromptRequest,
        session: SessionState,
    ) {
        store.state.findTabOrCustomTabOrSelectedTab(customTabId)?.let {
            promptRequest.executeIfWindowedPrompt { exitFullscreenUsecase(it.id) }
        }
@@ -571,6 +583,7 @@ class PromptFeature private constructor(
                if (!isLoginAutofillEnabled()) {
                    return
                }

                if (promptRequest.generatedPassword != null && isSuggestStrongPasswordEnabled) {
                    val currentUrl =
                        store.state.findTabOrCustomTabOrSelectedTab(customTabId)?.content?.url
@@ -597,7 +610,6 @@ class PromptFeature private constructor(
            else -> handleDialogsRequest(promptRequest, session)
        }
    }
    }

    /**
     * Invoked when a dialog is dismissed. This consumes the [PromptFeature]