-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/packages
#6274Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listfound in release: 3.19Found to occur in 3.19Found to occur in 3.19found in release: 3.20Found to occur in 3.20Found to occur in 3.20has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: webviewThe WebView pluginThe WebView pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team
Description
Steps to reproduce
- Run the code sample on iOS
- Click the button in the webview
Expected results
"Success" should appear in the webview. If you comment out the 3 lines
..setOnConsoleMessage((JavaScriptConsoleMessage message) {
print("[${message.level.name}] ${message.message}");
})it works too.
Actual results
A JavaScript error occurs
Code sample
Code sample
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
void main() => runApp(const MaterialApp(home: WebViewExample()));
class WebViewExample extends StatefulWidget {
const WebViewExample({super.key});
@override
State<WebViewExample> createState() => _WebViewExampleState();
}
class _WebViewExampleState extends State<WebViewExample> {
late final WebViewController controller;
@override
void initState() {
super.initState();
controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setBackgroundColor(const Color(0x00ff0000))
..setOnConsoleMessage((JavaScriptConsoleMessage message) {
print("[${message.level.name}] ${message.message}");
})
..loadHtmlString("""
<!DOCTYPE html><html>
<head>
<title>Example</title>
</head>
<body>
<script>
function logRecursiveObject() {
let obj = {
name: "Alice",
age: 30,
};
obj.self = obj;
console.log(obj);
document.getElementById('success-message').hidden = false;
}
</script>
<button onclick="logRecursiveObject()">Log recursive object</button>
<p id="success-message" hidden>Success</p>
</body>
</html>
""");
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Flutter Simple Example')),
body: WebViewWidget(controller: controller),
);
}
}Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[ +34 ms] executing: xcrun simctl launch 27B86823-70B1-4C60-A9CD-434E62948888 com.example.wvtest --enable-dart-profiling --enable-checked-mode --verify-entry-points
[ +803 ms] com.example.wvtest: 4441
[ ] Waiting for VM Service port to be available...
[+2500 ms] [ERROR:flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm(42)] Using the Impeller rendering backend.
[ +531 ms] VM Service URL on device: http://127.0.0.1:50086/g9-_p2Mo7Cg=/
[ +13 ms] Caching compiled dill
[+1495 ms] Connecting to service protocol: http://127.0.0.1:50086/g9-_p2Mo7Cg=/
[ +325 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at http://127.0.0.1:50086/g9-_p2Mo7Cg=/.
[ +272 ms] DDS is listening at http://127.0.0.1:50089/ZLumjYkzud0=/.
[ +749 ms] Successfully connected to service protocol: http://127.0.0.1:50086/g9-_p2Mo7Cg=/
[ +117 ms] DevFS: Creating new filesystem on the device (null)
[ +28 ms] DevFS: Created new filesystem on the device
(file:///Users/administrator/Library/Developer/CoreSimulator/Devices/27B86823-70B1-4C60-A9CD-434E62948888/data/Containers/Data/Application/0E1BC133-C660-4410-A078-7873
98462828/tmp/wvtestF3NAdk/wvtest/)
[ +5 ms] Updating assets
[ +489 ms] Manifest contained wildcard assets. Inserting missing file into build graph to force rerun. for more information see #56466.
[ +7 ms] Syncing files to device iPhone 8 Plus...
[ +12 ms] Compiling dart to kernel with 0 updated files
[ ] Processing bundle.
[ +94 ms] <- recompile package:wvtest/main.dart 6b670a7e-abf3-4007-9f1f-8f81cad5bb86
[ +21 ms] <- 6b670a7e-abf3-4007-9f1f-8f81cad5bb86
[ +9 ms] Bundle processing done.
[+1665 ms] Updating files.
[ ] DevFS: Sync finished
[ +1 ms] Syncing files to device iPhone 8 Plus... (completed in 1,803ms)
[ ] Synced 0.0MB.
[ +1 ms] <- accept
[ +2 ms] Connected to _flutterView/0x7fabd0828c20.
[ +2 ms] Flutter run key commands.
[ +1 ms] r Hot reload. 🔥🔥🔥
[ ] R Hot restart.
[ ] h List all available interactive commands.
[ ] d Detach (terminate "flutter run" but leave application running).
[ ] c Clear the screen
[ ] q Quit (terminate the application on the device).
[ ] A Dart VM Service on iPhone 8 Plus is available at: http://127.0.0.1:50089/ZLumjYkzud0=/
[ +1 ms] The Flutter DevTools debugger and profiler on iPhone 8 Plus is available at: http://127.0.0.1:9100?uri=http://127.0.0.1:50089/ZLumjYkzud0=/
[+7624 ms] flutter: [error] S, c, r, i, p, t, , e, r, r, o, r, ., , a, t, , :, 0, :, 0
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.19.0, on macOS 12.6.3 21G419 darwin-x64, locale en-US)
• Flutter version 3.19.0 on channel stable at /Users/administrator/Documents/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision bae5e49bc2 (3 weeks ago), 2024-02-13 17:46:18 -0800
• Engine revision 04817c99c9
• Dart version 3.3.0
• DevTools version 2.31.1
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/administrator/Library/Android/sdk
• Platform android-34, build-tools 31.0.0
• ANDROID_HOME = /Users/administrator/Library/Android/sdk
• ANDROID_SDK_ROOT = /Users/administrator/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
! CocoaPods 1.12.1 out of date (1.13.0 is recommended).
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To upgrade see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods for instructions.
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2022.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
[✓] Connected device (2 available)
• iPhone 8 Plus (mobile) • 27B86823-70B1-4C60-A9CD-434E62948888 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-2 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 12.6.3 21G419 darwin-x64
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 2 categories.
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listfound in release: 3.19Found to occur in 3.19Found to occur in 3.19found in release: 3.20Found to occur in 3.20Found to occur in 3.20has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: webviewThe WebView pluginThe WebView pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team