Skip to content

[web] freeze when a download happens on chrome web #149417

@a-h-mzd

Description

@a-h-mzd

Steps to reproduce

  1. run the sample app on Chrome.
  2. click on the download button.
  3. right after the download starts you can see that the app is frozen.

Expected results

The app continues to work normally.

Actual results

The app freezes when a download happens.

Code sample

Code sample
// ignore_for_file: avoid_web_libraries_in_flutter

import 'dart:html' as html;

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  Future<void> download(final String url) async {
    final anchorElement = html.AnchorElement(href: url);
    anchorElement.click();
    return Future(anchorElement.remove);
  }

  @override
  Widget build(BuildContext context) {
    const url = 'https://unsplash.com/photos/BZ-ZY3YLkfo/download?force=true';
    return MaterialApp(
      title: 'Issue Demo',
      theme: ThemeData.light(),
      home: Scaffold(
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              ElevatedButton(
                onPressed: () => download(url),
                child: const Text('Download'),
              ),
              const SizedBox(height: 16),
              const CircularProgressIndicator(),
            ],
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

Logs

Logs

Flutter Doctor output

Doctor output
Flutter 3.23.0-13.0.pre.51 • channel master • ssh://[email protected]/flutter/flutter.git
Framework • revision 80f2dd4431 (26 minutes ago) • 2024-05-31 10:38:22 -0400
Engine • revision f3d6fe51fb
Tools • Dart 3.5.0 (build 3.5.0-203.0.dev) • DevTools 2.36.0-dev.10

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 3.23.0-13.0.pre.51, on macOS 14.5 23F79 darwin-arm64, locale en-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.3)
[✓] VS Code (version 1.89.1)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!
Flutter 3.22.1 • channel stable • ssh://[email protected]/flutter/flutter.git
Framework • revision a14f74ff3a (9 days ago) • 2024-05-22 11:08:21 -0500
Engine • revision 55eae6864b
Tools • Dart 3.4.1 • DevTools 2.34.3

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.22.1, on macOS 14.5 23F79 darwin-arm64, locale en-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.3)
[✓] VS Code (version 1.89.1)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listfound in release: 3.22Found to occur in 3.22found in release: 3.23Found to occur in 3.23frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions