Skip to content

Conversation

@weitingsun
Copy link
Contributor

@weitingsun weitingsun commented Nov 27, 2025

Description

Remove "do you want to download file.bin" alert on iOS
PR for react-native-webview-mm: MetaMask/react-native-webview-mm#74

Changelog

CHANGELOG entry: Fixed a bug where we prompt do you want to download file.bin alert

Related issues

Fixes: #20359

Manual testing steps

Feature: remove do you want to download file.bin alert 

  Scenario: user not seeing the alert
    Given user navigates to browser tab

    When user navigates to sites like https://adtech.org/metamask-iframe-example/
    Then user should not see an alert that says "do you want to download file.bin"

Screenshots/Recordings

Before

Screenshot 2025-11-27 at 12 31 40 PM

After

Not showing the alert
iOS after

Can still download files
downloads

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Suppresses the iOS "download File.bin" alert for data URLs and consolidates Android WebView permission handling into a single dialog with safer granting/cleanup.

  • iOS (RNCWebViewImpl):
    • Suppress downloads for application/octet-stream data URLs by inferring extension early and ignoring .bin, preventing the "Do you want to download File.bin" alert.
    • Minor refactor: compute fileExtension before decoding and reuse it.
  • Android (RNCWebChromeClient):
    • Rework permission flow: reset state, aggregate multiple permissions into a single user prompt, map OS permissions to WebView resources, and grant immediately when possible.
    • Add robust state cleanup and try/catch around grant to avoid IllegalStateException; handle negative responses and pending system permission requests correctly.

Written by Cursor Bugbot for commit 59d75e8. This will update automatically on new commits. Configure here.

@weitingsun weitingsun requested a review from a team as a code owner November 27, 2025 20:33
@github-actions
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@weitingsun weitingsun changed the title fix: remove do you want to download file.bin alert on iOS fix: remove do you want to download file.bin alert on iOS cp-7.61.0 Nov 28, 2025
Copy link
Contributor

@MarioAslau MarioAslau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-project-automation github-project-automation bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Nov 28, 2025
@github-actions
Copy link
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeCore, SmokeRamps, SmokePerps, SmokeCard, SmokeWalletUX
  • Risk Level: medium
  • AI Confidence: 80%
click to see 🤖 AI reasoning details

The changes update the @metamask/react-native-webview patch file with two main modifications:

  1. Android (Java): Refactored permission request handling to show a single dialog for multiple permissions instead of sequential dialogs, improved state management, and added error handling for IllegalStateException to prevent crashes.

  2. iOS (Objective-C): Added filtering to suppress automatic download prompts for generic binary files (File.bin) from data URLs, which are typically iframe-driven noise rather than user-initiated downloads.

WebView Usage Analysis:
WebView is used across multiple features:

  • Browser tab functionality (general web browsing)
  • Ramps/Buy-Sell (checkout flows via WebviewModal)
  • Snaps execution environment (SnapsExecutionWebView)
  • Card/KYC flows (KYCWebview)
  • Perps trading charts (TradingViewChart)
  • Simple webviews for external links
  • Modal content display

Risk Assessment:

  • Medium risk: These are bug fixes and UX improvements in a foundational component
  • The permission handling changes could affect features that request camera/microphone permissions (like snaps)
  • The download suppression improves UX but changes behavior around file handling
  • Changes are defensive (error handling, filtering unwanted behavior) rather than introducing new features
  • No changes to core wallet logic, controllers, or Engine

Selected Test Tags:

  • SmokeCore: WebView is a core framework component affecting app stability and navigation
  • SmokeRamps: Ramp flows use WebView extensively for checkout and payment flows
  • SmokePerps: Perps feature uses WebView for TradingViewChart rendering
  • SmokeCard: Card/KYC flows depend on WebView for onboarding processes
  • SmokeWalletUX: WebView affects overall UX with modals, simple webviews, and external links

Not Selected:

  • SmokeAccounts, SmokeIdentity: Not directly using WebView for core functionality
  • SmokeSwaps, SmokeStake: Don't appear to use WebView based on codebase search
  • SmokeConfirmationsRedesigned: Confirmations use WebView minimally (ShowBlockExplorer only)
  • Network-related tags: WebView changes don't affect network layer
  • Other feature-specific tags: No evidence of WebView usage in those areas

View GitHub Actions results

@sonarqubecloud
Copy link

@weitingsun weitingsun added this pull request to the merge queue Nov 28, 2025
Merged via the queue into main with commit 6352721 Nov 28, 2025
89 checks passed
@weitingsun weitingsun deleted the wsun/remove-download-file-bin-on-ios-alert branch November 28, 2025 21:42
@github-actions github-actions bot locked and limited conversation to collaborators Nov 28, 2025
@metamaskbot metamaskbot added the release-7.62.0 Issue or pull request that will be included in release 7.62.0 label Nov 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.62.0 Issue or pull request that will be included in release 7.62.0 size-S team-mobile-platform Mobile Platform team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[Bug]: 'Do you want to download file.bin?' shown every time when 'View on Ertherscan' is clicked

4 participants