Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] missing implementation of onPermissionRequest event will cause crash when requested by the webpage #2404

Closed
1 of 2 tasks
windinternet opened this issue Nov 7, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@windinternet
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

打开特定网站:
https://www.douyin.com/
https://live.douyin.com/
在页面后,刚开始是正常工作的,但几秒后程序就没有预兆的直接闪退了
Open a specific website:

https://www.douyin.com/

https://live.douyin.com/

At the back of the page, it initially worked normally, but after a few seconds, the program crashed without warning

Expected Behavior

It should be able to work normally

Steps with code example to reproduce

import 'dart:collection';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(

        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});


  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  InAppWebViewController? webViewController;
  InAppWebViewSettings settings = InAppWebViewSettings(
      isInspectable: kDebugMode,
      mediaPlaybackRequiresUserGesture: false,
      allowsInlineMediaPlayback: true,
      iframeAllow: "camera; microphone",
      iframeAllowFullscreen: true);

  @override
  void initState() {
    super.initState();
  }

  TextEditingController urlController = TextEditingController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          backgroundColor: Theme.of(context).colorScheme.inversePrimary,
          title:  const Text("InAppWebView Demo"),
        ),
        body: InAppWebView(
          onWebViewCreated: (controller) {
            webViewController = controller;
          },
          initialUrlRequest: URLRequest(url: WebUri('https://live.douyin.com')),
          initialSettings: settings,
        ));
  }
}

Stacktrace/Logs

Debug service listening on ws://127.0.0.1:49292/H0-J9eYBliE=/ws
Syncing files to device Windows...
[WindowsInAppWebViewWidget] (windows) WindowsInAppWebViewWidget ID 2707738835856 calling "onWebViewCreated" using []
[WindowsInAppWebViewController] (windows) WebView ID 2707738835856 calling "onLoadStart" using {url: https://live.douyin.com/}
[WindowsInAppWebViewController] (windows) WebView ID 2707738835856 calling "onProgressChanged" using {progress: 0}
[WindowsInAppWebViewController] (windows) WebView ID 2707738835856 calling "onLoadStart" using {url: https://live.douyin.com/}
[WindowsInAppWebViewController] (windows) WebView ID 2707738835856 calling "onProgressChanged" using {progress: 0}
[WindowsInAppWebViewController] (windows) WebView ID 2707738835856 calling "onProgressChanged" using {progress: 33}
[WindowsInAppWebViewController] (windows) WebView ID 2707738835856 calling "onUpdateVisitedHistory" using {isReload: false, url: https://live.douyin.com/}
[WindowsInAppWebViewController] (windows) WebView ID 2707738835856 calling "onConsoleMessage" using {message: "TypeError: Failed to construct 'URL': Invalid URL\n at new o (https://lf-security.bytegoofy.com/obj/security-secsdk/runtime.js:5:25233)\n at https://lf-security.bytegoofy.com/obj/security-secsdk/runtime.js:5:27151\n at https://lf-security.bytegoofy.com/obj/security-secsdk/runtime.js:5:62\n at https://lf-security.bytegoofy.com/obj/security-secsdk/runtime.js:5:66", messageLevel: 1}
[WindowsInAppWebViewController] (windows) WebView ID 2707738835856 calling "onUpdateVisitedHistory" using {isReload: false, url: https://live.douyin.com/}
[WindowsInAppWebViewController] (windows) WebView ID 2707738835856 calling "onPermissionRequest" using {origin: https://live.douyin.com/, resources: [5]}
[WindowsInAppWebViewController] (windows) WebView ID 2707738835856 calling "onTitleChanged" using {title: 抖音直播电脑版_抖音直播网页版入口_抖音直播}
[WindowsInAppWebViewController] (windows) WebView ID 2707738835856 calling "onUpdateVisitedHistory" using {isReload: false, url: https://live.douyin.com/}
[WindowsInAppWebViewController] (windows) WebView ID 2707738835856 calling "onProgressChanged" using {progress: 66}
[WindowsInAppWebViewController] (windows) WebView ID 2707738835856 calling "onProgressChanged" using {progress: 100}
[WindowsInAppWebViewController] (windows) WebView ID 2707738835856 calling "onLoadStop" using {url: https://live.douyin.com/}
Lost connection to device.

Flutter version

3.24.1

Operating System, Device-specific and/or Tool

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.24.1, on Microsoft Windows [版本 10.0.22631.4317], locale zh-CN)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
X cmdline-tools component is missing
Run path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details.
X Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/to/windows-android-setup for more details.
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.2)
[√] Android Studio (version 2022.3)
[√] IntelliJ IDEA Ultimate Edition (version 2023.2)
[√] VS Code (version 1.93.0)
[√] Connected device (3 available)
[√] Network resources

Version Windows 11 Professional Workstation Edition

Version number 23H2

Installation date: September 13, 2023

Operating system version 22631.4317

Experience Windows Feature Experience Pack 1000.2270.1041.0

Plugin version

6.1.5

Additional information

No response

Self grab

  • I'm ready to work on this issue!
@windinternet windinternet added the bug Something isn't working label Nov 7, 2024
@pichillilorenzo
Copy link
Owner

pichillilorenzo commented Nov 8, 2024

It is caused by missing implementation of onPermissionRequest event on Flutter side. Implementing it, you should workaround the current crash.
it should be fixed on next version 6.2.0-beta.2.

@pichillilorenzo pichillilorenzo changed the title Opening a specific website (douyin. com) on the Windows platform will cause it to crash within a few seconds after the page is opened [Windows] missing implementation of onPermissionRequest event will cause crash when requested by the webpage Nov 8, 2024
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 26, 2024
@pichillilorenzo
Copy link
Owner

Released new version 6.2.0-beta.2 with the fix.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants