From f8e51ad621490f352e24c85e33f7bcba5ab2e51b Mon Sep 17 00:00:00 2001 From: FlafyDev Date: Sat, 14 May 2022 17:21:31 +0300 Subject: [PATCH 01/16] fix: unreliable encoding --- .../lib/webview_flutter_web.dart | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart index 637c24926275..68ed43d9d7a8 100644 --- a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart +++ b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart @@ -3,6 +3,7 @@ // found in the LICENSE file. import 'dart:async'; +import 'dart:convert'; import 'dart:html'; import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; @@ -183,7 +184,11 @@ class WebWebViewPlatformController implements WebViewPlatformController { String? baseUrl, }) async { // ignore: unsafe_html - _element.src = 'data:text/html,${Uri.encodeFull(html)}'; + _element.src = Uri.dataFromString( + html, + mimeType: 'text/html', + encoding: Encoding.getByName('utf-8'), + ).toString(); } @override @@ -199,8 +204,11 @@ class WebWebViewPlatformController implements WebViewPlatformController { final String contentType = httpReq.getResponseHeader('content-type') ?? 'text/html'; // ignore: unsafe_html - _element.src = - 'data:$contentType,${Uri.encodeFull(httpReq.responseText ?? '')}'; + _element.src = Uri.dataFromString( + httpReq.responseText ?? '', + mimeType: contentType, + encoding: Encoding.getByName('utf-8'), + ).toString(); } @override From e9dfa1fd28ba56a0cf79426059e5c7bc9e7e1bb7 Mon Sep 17 00:00:00 2001 From: FlafyDev Date: Sat, 14 May 2022 18:47:18 +0300 Subject: [PATCH 02/16] chore: update version and changelog --- .../webview_flutter_web/CHANGELOG.md | 16 ++++++++++------ .../webview_flutter_web/pubspec.yaml | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_web/CHANGELOG.md b/packages/webview_flutter/webview_flutter_web/CHANGELOG.md index 8ab70f9a78d3..54a4d5904d28 100644 --- a/packages/webview_flutter/webview_flutter_web/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_web/CHANGELOG.md @@ -1,18 +1,22 @@ +## 0.1.0+4 + +- Fixes unreliable encoding of HTML to the iframe element. + ## 0.1.0+3 -* Minor fixes for new analysis options. +- Minor fixes for new analysis options. ## 0.1.0+2 -* Removes unnecessary imports. -* Fixes unit tests to run on latest `master` version of Flutter. -* Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors +- Removes unnecessary imports. +- Fixes unit tests to run on latest `master` version of Flutter. +- Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors lint warnings. ## 0.1.0+1 -* Adds an explanation of registering the implementation in the README. +- Adds an explanation of registering the implementation in the README. ## 0.1.0 -* First web implementation for webview_flutter +- First web implementation for webview_flutter diff --git a/packages/webview_flutter/webview_flutter_web/pubspec.yaml b/packages/webview_flutter/webview_flutter_web/pubspec.yaml index a834c9b77d51..6eff38e96644 100644 --- a/packages/webview_flutter/webview_flutter_web/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_web/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter_web description: A Flutter plugin that provides a WebView widget on web. repository: https://github.com/flutter/plugins/tree/main/packages/webview_flutter/webview_flutter_web issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 0.1.0+3 +version: 0.1.0+4 environment: sdk: ">=2.14.0 <3.0.0" From e0b13de8f2c02f5afd940eb5138ccd603617118f Mon Sep 17 00:00:00 2001 From: FlafyDev Date: Sat, 14 May 2022 18:48:29 +0300 Subject: [PATCH 03/16] revert changelog formatting --- .../webview_flutter_web/CHANGELOG.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_web/CHANGELOG.md b/packages/webview_flutter/webview_flutter_web/CHANGELOG.md index 54a4d5904d28..2f40537ebafd 100644 --- a/packages/webview_flutter/webview_flutter_web/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_web/CHANGELOG.md @@ -1,22 +1,22 @@ ## 0.1.0+4 -- Fixes unreliable encoding of HTML to the iframe element. +* Fixes unreliable encoding of HTML to the iframe element. ## 0.1.0+3 -- Minor fixes for new analysis options. +* Minor fixes for new analysis options. ## 0.1.0+2 -- Removes unnecessary imports. -- Fixes unit tests to run on latest `master` version of Flutter. -- Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors +* Removes unnecessary imports. +* Fixes unit tests to run on latest `master` version of Flutter. +* Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors lint warnings. ## 0.1.0+1 -- Adds an explanation of registering the implementation in the README. +* Adds an explanation of registering the implementation in the README. ## 0.1.0 -- First web implementation for webview_flutter +* First web implementation for webview_flutter From f2dbc37b0d2413dbf56e4de4b29d72a3f36f9431 Mon Sep 17 00:00:00 2001 From: FlafyDev Date: Sun, 15 May 2022 18:41:27 +0300 Subject: [PATCH 04/16] Add run Javascript --- .../lib/webview_flutter_web.dart | 49 ++++++++++++++----- .../webview_flutter_web/pubspec.yaml | 1 + 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart index 68ed43d9d7a8..e9ef48b3bac5 100644 --- a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart +++ b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart @@ -5,10 +5,13 @@ import 'dart:async'; import 'dart:convert'; import 'dart:html'; +import 'dart:js' as js; import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_web_plugins/flutter_web_plugins.dart'; +import 'package:html/dom.dart' as dom; +import 'package:html/parser.dart'; import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart'; import 'shims/dart_ui.dart' as ui; @@ -44,13 +47,19 @@ class WebWebViewPlatform implements WebViewPlatform { } final IFrameElement element = document.getElementById('webview-$viewId')! as IFrameElement; + + final WebWebViewPlatformController controller = + WebWebViewPlatformController(element, viewId); + + js.context['webview${viewId}_getWindow'] = (js.JsObject window) { + controller.window = window; + }; + if (creationParams.initialUrl != null) { // ignore: unsafe_html element.src = creationParams.initialUrl; } - onWebViewPlatformCreated(WebWebViewPlatformController( - element, - )); + onWebViewPlatformCreated(controller); }, ); } @@ -65,8 +74,11 @@ class WebWebViewPlatform implements WebViewPlatform { /// Implementation of [WebViewPlatformController] for web. class WebWebViewPlatformController implements WebViewPlatformController { /// Constructs a [WebWebViewPlatformController]. - WebWebViewPlatformController(this._element); + WebWebViewPlatformController(this._element, [this._viewId = 1]); + /// The IFrame's Window object. + late js.JsObject window; + final int _viewId; final IFrameElement _element; HttpRequestFactory _httpRequestFactory = HttpRequestFactory(); @@ -150,12 +162,15 @@ class WebWebViewPlatformController implements WebViewPlatformController { @override Future runJavascript(String javascript) { - throw UnimplementedError(); + return Future.value( + window.callMethod('eval', [javascript])); } @override Future runJavascriptReturningResult(String javascript) { - throw UnimplementedError(); + return Future.value( + window.callMethod('eval', [javascript])) + .then((dynamic value) => value.toString()); } @override @@ -184,11 +199,7 @@ class WebWebViewPlatformController implements WebViewPlatformController { String? baseUrl, }) async { // ignore: unsafe_html - _element.src = Uri.dataFromString( - html, - mimeType: 'text/html', - encoding: Encoding.getByName('utf-8'), - ).toString(); + _element.srcdoc = preprocessHtml(html); } @override @@ -215,6 +226,22 @@ class WebWebViewPlatformController implements WebViewPlatformController { Future loadFlutterAsset(String key) { throw UnimplementedError(); } + + String preprocessHtml(String html) { + final dom.Document document = parse(html); + + final dom.Element scriptElement = document.createElement('script'); + scriptElement.text = 'parent.webview${_viewId}_getWindow(window)'; + + document.head?.insertBefore(scriptElement, document.head!.firstChild); + + String outputHtml = document.outerHtml; + if (!outputHtml.trim().startsWith('')) { + outputHtml = '$outputHtml'; + } + + return outputHtml; + } } /// Factory class for creating [HttpRequest] instances. diff --git a/packages/webview_flutter/webview_flutter_web/pubspec.yaml b/packages/webview_flutter/webview_flutter_web/pubspec.yaml index 6eff38e96644..41338c360a6e 100644 --- a/packages/webview_flutter/webview_flutter_web/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_web/pubspec.yaml @@ -21,6 +21,7 @@ dependencies: sdk: flutter flutter_web_plugins: sdk: flutter + html: ^0.15.0 webview_flutter_platform_interface: ^1.8.0 dev_dependencies: From 1a7c427f6630115f3eb75925f675e4cbc09563ae Mon Sep 17 00:00:00 2001 From: FlafyDev Date: Sun, 15 May 2022 19:56:39 +0300 Subject: [PATCH 05/16] Add limited Javascript channels support --- .../lib/webview_flutter_web.dart | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart index e9ef48b3bac5..0bfddab92545 100644 --- a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart +++ b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart @@ -45,16 +45,24 @@ class WebWebViewPlatform implements WebViewPlatform { if (onWebViewPlatformCreated == null) { return; } + final IFrameElement element = document.getElementById('webview-$viewId')! as IFrameElement; final WebWebViewPlatformController controller = - WebWebViewPlatformController(element, viewId); + WebWebViewPlatformController( + element, viewId, javascriptChannelRegistry); js.context['webview${viewId}_getWindow'] = (js.JsObject window) { controller.window = window; }; + js.context['webview${viewId}_channel'] = (String name, String message) { + javascriptChannelRegistry?.channels.values + .firstWhere((channel) => channel.name == name) + .onMessageReceived(JavascriptMessage(message)); + }; + if (creationParams.initialUrl != null) { // ignore: unsafe_html element.src = creationParams.initialUrl; @@ -74,10 +82,13 @@ class WebWebViewPlatform implements WebViewPlatform { /// Implementation of [WebViewPlatformController] for web. class WebWebViewPlatformController implements WebViewPlatformController { /// Constructs a [WebWebViewPlatformController]. - WebWebViewPlatformController(this._element, [this._viewId = 1]); + WebWebViewPlatformController(this._element, + [this._viewId = 1, this._javascriptChannelRegistry]); /// The IFrame's Window object. late js.JsObject window; + + final JavascriptChannelRegistry? _javascriptChannelRegistry; final int _viewId; final IFrameElement _element; HttpRequestFactory _httpRequestFactory = HttpRequestFactory(); @@ -227,12 +238,24 @@ class WebWebViewPlatformController implements WebViewPlatformController { throw UnimplementedError(); } + /// Change and process the Html before passing it to the iframe. String preprocessHtml(String html) { final dom.Document document = parse(html); final dom.Element scriptElement = document.createElement('script'); - scriptElement.text = 'parent.webview${_viewId}_getWindow(window)'; + final scriptContent = StringBuffer(); + + scriptContent.writeln('parent.webview${_viewId}_getWindow(window);'); + + _javascriptChannelRegistry?.channels + .forEach((String _, JavascriptChannel channel) { + final String funcName = 'parent.webview${_viewId}_channel'; + + scriptContent.writeln( + 'window.${channel.name} = { postMessage: (message) => $funcName("${channel.name}", message) };'); + }); + scriptElement.text = scriptContent.toString(); document.head?.insertBefore(scriptElement, document.head!.firstChild); String outputHtml = document.outerHtml; From ee406e1eae836d63b7d9c3aad787ab327e627eb2 Mon Sep 17 00:00:00 2001 From: FlafyDev Date: Sun, 15 May 2022 20:17:19 +0300 Subject: [PATCH 06/16] Specify types --- .../webview_flutter_web/lib/webview_flutter_web.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart index 0bfddab92545..8d4204f716a9 100644 --- a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart +++ b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart @@ -59,7 +59,7 @@ class WebWebViewPlatform implements WebViewPlatform { js.context['webview${viewId}_channel'] = (String name, String message) { javascriptChannelRegistry?.channels.values - .firstWhere((channel) => channel.name == name) + .firstWhere((JavascriptChannel channel) => channel.name == name) .onMessageReceived(JavascriptMessage(message)); }; @@ -238,12 +238,12 @@ class WebWebViewPlatformController implements WebViewPlatformController { throw UnimplementedError(); } - /// Change and process the Html before passing it to the iframe. + /// Change the Html before passing it to the iframe. String preprocessHtml(String html) { final dom.Document document = parse(html); final dom.Element scriptElement = document.createElement('script'); - final scriptContent = StringBuffer(); + final StringBuffer scriptContent = StringBuffer(); scriptContent.writeln('parent.webview${_viewId}_getWindow(window);'); From 974dd970cd389f413fc67e3cb352d70098b8b33b Mon Sep 17 00:00:00 2001 From: FlafyDev Date: Sun, 15 May 2022 21:02:49 +0300 Subject: [PATCH 07/16] added loadHtml and JavascriptChannel tests --- .../webview_flutter_test.dart | 63 +++++++++++++++++++ .../example/lib/web_view.dart | 11 +++- 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/packages/webview_flutter/webview_flutter_web/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_web/example/integration_test/webview_flutter_test.dart index 232ecdd302b7..94c2797ce98f 100644 --- a/packages/webview_flutter/webview_flutter_web/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_web/example/integration_test/webview_flutter_test.dart @@ -9,6 +9,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; +import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart'; import 'package:webview_flutter_web_example/web_view.dart'; void main() { @@ -69,4 +70,66 @@ void main() { expect(element, isNotNull); expect(element!.src, secondaryUrl); }); + + testWidgets('loadHtml', (WidgetTester tester) async { + final Completer controllerCompleter = + Completer(); + await tester.pumpWidget( + Directionality( + textDirection: TextDirection.ltr, + child: WebView( + key: GlobalKey(), + onWebViewCreated: (WebViewController controller) { + controllerCompleter.complete(controller); + }, + ), + ), + ); + final WebViewController controller = await controllerCompleter.future; + await controller.loadHtmlString('
Te#st
'); + + // Assert an iframe has been rendered to the DOM with the correct src attribute. + final html.IFrameElement? element = + html.document.querySelector('iframe') as html.IFrameElement?; + expect(element, isNotNull); + expect( + element!.srcdoc, + '
Te#st
'); + }); + + testWidgets('JavascriptChannel', (WidgetTester tester) async { + final Completer controllerCompleter = + Completer(); + final List messagesReceived = []; + await tester.pumpWidget( + Directionality( + textDirection: TextDirection.ltr, + child: WebView( + key: GlobalKey(), + onWebViewCreated: (WebViewController controller) { + controllerCompleter.complete(controller); + }, + javascriptChannels: { + JavascriptChannel( + name: 'Echo', + onMessageReceived: (JavascriptMessage message) { + messagesReceived.add(message.message); + }, + ), + }, + ), + ), + ); + final WebViewController controller = await controllerCompleter.future; + await controller.loadHtmlString('
'); + + // Assert an iframe has been rendered to the DOM with the correct src attribute. + final html.IFrameElement? element = + html.document.querySelector('iframe') as html.IFrameElement?; + expect(element, isNotNull); + + await controller.runJavascript('Echo.postMessage("hello");'); + expect(messagesReceived, equals(['hello'])); + }); } diff --git a/packages/webview_flutter/webview_flutter_web/example/lib/web_view.dart b/packages/webview_flutter/webview_flutter_web/example/lib/web_view.dart index ffd3367d33f4..73b6c082b83e 100644 --- a/packages/webview_flutter/webview_flutter_web/example/lib/web_view.dart +++ b/packages/webview_flutter/webview_flutter_web/example/lib/web_view.dart @@ -30,6 +30,7 @@ class WebView extends StatefulWidget { Key? key, this.onWebViewCreated, this.initialUrl, + this.javascriptChannels, }) : super(key: key); /// The WebView platform that's used by this WebView. @@ -45,6 +46,9 @@ class WebView extends StatefulWidget { /// The initial URL to load. final String? initialUrl; + /// The set of [JavascriptChannel]s available to JavaScript code running in the web view. + final Set? javascriptChannels; + @override State createState() => _WebViewState(); } @@ -90,7 +94,7 @@ class _WebViewState extends State { webSettings: _webSettingsFromWidget(widget), ), javascriptChannelRegistry: - JavascriptChannelRegistry({}), + JavascriptChannelRegistry(widget.javascriptChannels), ); } } @@ -159,6 +163,11 @@ class WebViewController { return _webViewPlatformController.loadRequest(request); } + /// Loads an Html document. + Future loadHtmlString(String html) async { + return _webViewPlatformController.loadHtmlString(html); + } + /// Accessor to the current URL that the WebView is displaying. /// /// If [WebView.initialUrl] was never specified, returns `null`. From 214c4bceb4ad7b7fae9417145949cffe7b05ad7b Mon Sep 17 00:00:00 2001 From: FlafyDev Date: Sun, 15 May 2022 21:03:00 +0300 Subject: [PATCH 08/16] loadHtmlString wait for load --- .../webview_flutter_web/lib/webview_flutter_web.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart index 8d4204f716a9..7f9384b6577a 100644 --- a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart +++ b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart @@ -211,6 +211,9 @@ class WebWebViewPlatformController implements WebViewPlatformController { }) async { // ignore: unsafe_html _element.srcdoc = preprocessHtml(html); + final Completer loaded = Completer(); + _element.addEventListener('load', (Event event) => loaded.complete()); + return loaded.future; } @override From d325c0ea7565384485410f4ea4f3ec710624c811 Mon Sep 17 00:00:00 2001 From: FlafyDev Date: Sun, 15 May 2022 21:30:10 +0300 Subject: [PATCH 09/16] Make runJavascript safer --- .../lib/webview_flutter_web.dart | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart index 7f9384b6577a..c5184295191f 100644 --- a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart +++ b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart @@ -86,7 +86,7 @@ class WebWebViewPlatformController implements WebViewPlatformController { [this._viewId = 1, this._javascriptChannelRegistry]); /// The IFrame's Window object. - late js.JsObject window; + js.JsObject? window; final JavascriptChannelRegistry? _javascriptChannelRegistry; final int _viewId; @@ -173,14 +173,26 @@ class WebWebViewPlatformController implements WebViewPlatformController { @override Future runJavascript(String javascript) { + if (window == null) { + throw UnsupportedError( + 'Running Javascript is available only by loading the Html as a string', + ); + } + return Future.value( - window.callMethod('eval', [javascript])); + window!.callMethod('eval', [javascript])); } @override Future runJavascriptReturningResult(String javascript) { + if (window == null) { + throw UnsupportedError( + 'Running Javascript is available only by loading the Html as a string', + ); + } + return Future.value( - window.callMethod('eval', [javascript])) + window?.callMethod('eval', [javascript])) .then((dynamic value) => value.toString()); } @@ -255,7 +267,8 @@ class WebWebViewPlatformController implements WebViewPlatformController { final String funcName = 'parent.webview${_viewId}_channel'; scriptContent.writeln( - 'window.${channel.name} = { postMessage: (message) => $funcName("${channel.name}", message) };'); + 'window.${channel.name} = { postMessage: (message) => $funcName("${channel.name}", message) };', + ); }); scriptElement.text = scriptContent.toString(); From 7e25b40fc9eaaac9259412b0b883934d8c9f57ac Mon Sep 17 00:00:00 2001 From: FlafyDev Date: Mon, 16 May 2022 10:40:32 +0300 Subject: [PATCH 10/16] Implement evaluateJavascript --- .../webview_flutter_web/lib/webview_flutter_web.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart index c5184295191f..21940cff51cd 100644 --- a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart +++ b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart @@ -127,7 +127,7 @@ class WebWebViewPlatformController implements WebViewPlatformController { @override Future evaluateJavascript(String javascript) { - throw UnimplementedError(); + return runJavascriptReturningResult(javascript); } @override From 98ce7a8e53b1ee73666eafbfd2219371ee8db16e Mon Sep 17 00:00:00 2001 From: FlafyDev Date: Thu, 19 May 2022 04:51:04 +0300 Subject: [PATCH 11/16] chore: changelog and version --- packages/webview_flutter/webview_flutter_web/CHANGELOG.md | 3 ++- packages/webview_flutter/webview_flutter_web/pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_web/CHANGELOG.md b/packages/webview_flutter/webview_flutter_web/CHANGELOG.md index 2f40537ebafd..befd7e6422c2 100644 --- a/packages/webview_flutter/webview_flutter_web/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_web/CHANGELOG.md @@ -1,6 +1,7 @@ -## 0.1.0+4 +## 0.1.1 * Fixes unreliable encoding of HTML to the iframe element. +* Adds JavascriptChannels and running Javascript support only for loading Html as a string. ## 0.1.0+3 diff --git a/packages/webview_flutter/webview_flutter_web/pubspec.yaml b/packages/webview_flutter/webview_flutter_web/pubspec.yaml index 41338c360a6e..b21a8c9dd0ed 100644 --- a/packages/webview_flutter/webview_flutter_web/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_web/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter_web description: A Flutter plugin that provides a WebView widget on web. repository: https://github.com/flutter/plugins/tree/main/packages/webview_flutter/webview_flutter_web issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 0.1.0+4 +version: 0.1.1 environment: sdk: ">=2.14.0 <3.0.0" From 6af1972c1ad05c890c6615e31844d12e95c43afe Mon Sep 17 00:00:00 2001 From: FlafyDev Date: Thu, 26 May 2022 16:20:59 +0300 Subject: [PATCH 12/16] revert fix for flutter/flutter#104273 --- .../lib/webview_flutter_web.dart | 1276 ++++++++++++++++- 1 file changed, 1270 insertions(+), 6 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart index 21940cff51cd..681500af29e6 100644 --- a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart +++ b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart @@ -11,7 +11,1274 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_web_plugins/flutter_web_plugins.dart'; import 'package:html/dom.dart' as dom; -import 'package:html/parser.dart'; +import 'package:html/parser.dart';// Mocks generated by Mockito 5.2.0 from annotations +// in webview_flutter_web/test/webview_flutter_web_test.dart. +// Do not manually edit this file. + +import 'dart:async' as _i6; +import 'dart:html' as _i2; +import 'dart:math' as _i3; + +import 'package:flutter/foundation.dart' as _i5; +import 'package:flutter/widgets.dart' as _i4; +import 'package:mockito/mockito.dart' as _i1; +import 'package:webview_flutter_platform_interface/src/types/types.dart' as _i7; +import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart' + as _i8; +import 'package:webview_flutter_web/webview_flutter_web.dart' as _i9; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types + +class _FakeCssClassSet_0 extends _i1.Fake implements _i2.CssClassSet {} + +class _FakeRectangle_1 extends _i1.Fake + implements _i3.Rectangle {} + +class _FakeCssRect_2 extends _i1.Fake implements _i2.CssRect {} + +class _FakePoint_3 extends _i1.Fake implements _i3.Point {} + +class _FakeElementEvents_4 extends _i1.Fake implements _i2.ElementEvents {} + +class _FakeCssStyleDeclaration_5 extends _i1.Fake + implements _i2.CssStyleDeclaration {} + +class _FakeElementStream_6 extends _i1.Fake + implements _i2.ElementStream {} + +class _FakeElementList_7 extends _i1.Fake + implements _i2.ElementList {} + +class _FakeScrollState_8 extends _i1.Fake implements _i2.ScrollState {} + +class _FakeAnimation_9 extends _i1.Fake implements _i2.Animation {} + +class _FakeElement_10 extends _i1.Fake implements _i2.Element {} + +class _FakeShadowRoot_11 extends _i1.Fake implements _i2.ShadowRoot {} + +class _FakeDocumentFragment_12 extends _i1.Fake + implements _i2.DocumentFragment {} + +class _FakeNode_13 extends _i1.Fake implements _i2.Node {} + +class _FakeWidget_14 extends _i1.Fake implements _i4.Widget { + @override + String toString({_i5.DiagnosticLevel? minLevel = _i5.DiagnosticLevel.info}) => + super.toString(); +} + +class _FakeInheritedWidget_15 extends _i1.Fake implements _i4.InheritedWidget { + @override + String toString({_i5.DiagnosticLevel? minLevel = _i5.DiagnosticLevel.info}) => + super.toString(); +} + +class _FakeDiagnosticsNode_16 extends _i1.Fake implements _i5.DiagnosticsNode { + @override + String toString( + {_i5.TextTreeConfiguration? parentConfiguration, + _i5.DiagnosticLevel? minLevel = _i5.DiagnosticLevel.info}) => + super.toString(); +} + +class _FakeHttpRequest_17 extends _i1.Fake implements _i2.HttpRequest {} + +class _FakeHttpRequestUpload_18 extends _i1.Fake + implements _i2.HttpRequestUpload {} + +class _FakeEvents_19 extends _i1.Fake implements _i2.Events {} + +/// A class which mocks [IFrameElement]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockIFrameElement extends _i1.Mock implements _i2.IFrameElement { + MockIFrameElement() { + _i1.throwOnMissingStub(this); + } + + @override + set allow(String? value) => + super.noSuchMethod(Invocation.setter(#allow, value), + returnValueForMissingStub: null); + @override + set allowFullscreen(bool? value) => + super.noSuchMethod(Invocation.setter(#allowFullscreen, value), + returnValueForMissingStub: null); + @override + set allowPaymentRequest(bool? value) => + super.noSuchMethod(Invocation.setter(#allowPaymentRequest, value), + returnValueForMissingStub: null); + @override + set csp(String? value) => super.noSuchMethod(Invocation.setter(#csp, value), + returnValueForMissingStub: null); + @override + set height(String? value) => + super.noSuchMethod(Invocation.setter(#height, value), + returnValueForMissingStub: null); + @override + set name(String? value) => super.noSuchMethod(Invocation.setter(#name, value), + returnValueForMissingStub: null); + @override + set referrerPolicy(String? value) => + super.noSuchMethod(Invocation.setter(#referrerPolicy, value), + returnValueForMissingStub: null); + @override + set src(String? value) => super.noSuchMethod(Invocation.setter(#src, value), + returnValueForMissingStub: null); + @override + set srcdoc(String? value) => + super.noSuchMethod(Invocation.setter(#srcdoc, value), + returnValueForMissingStub: null); + @override + set width(String? value) => + super.noSuchMethod(Invocation.setter(#width, value), + returnValueForMissingStub: null); + @override + set nonce(String? value) => + super.noSuchMethod(Invocation.setter(#nonce, value), + returnValueForMissingStub: null); + @override + Map get attributes => + (super.noSuchMethod(Invocation.getter(#attributes), + returnValue: {}) as Map); + @override + set attributes(Map? value) => + super.noSuchMethod(Invocation.setter(#attributes, value), + returnValueForMissingStub: null); + @override + List<_i2.Element> get children => + (super.noSuchMethod(Invocation.getter(#children), + returnValue: <_i2.Element>[]) as List<_i2.Element>); + @override + set children(List<_i2.Element>? value) => + super.noSuchMethod(Invocation.setter(#children, value), + returnValueForMissingStub: null); + @override + _i2.CssClassSet get classes => + (super.noSuchMethod(Invocation.getter(#classes), + returnValue: _FakeCssClassSet_0()) as _i2.CssClassSet); + @override + set classes(Iterable? value) => + super.noSuchMethod(Invocation.setter(#classes, value), + returnValueForMissingStub: null); + @override + Map get dataset => + (super.noSuchMethod(Invocation.getter(#dataset), + returnValue: {}) as Map); + @override + set dataset(Map? value) => + super.noSuchMethod(Invocation.setter(#dataset, value), + returnValueForMissingStub: null); + @override + _i3.Rectangle get client => + (super.noSuchMethod(Invocation.getter(#client), + returnValue: _FakeRectangle_1()) as _i3.Rectangle); + @override + _i3.Rectangle get offset => + (super.noSuchMethod(Invocation.getter(#offset), + returnValue: _FakeRectangle_1()) as _i3.Rectangle); + @override + String get localName => + (super.noSuchMethod(Invocation.getter(#localName), returnValue: '') + as String); + @override + _i2.CssRect get contentEdge => + (super.noSuchMethod(Invocation.getter(#contentEdge), + returnValue: _FakeCssRect_2()) as _i2.CssRect); + @override + _i2.CssRect get paddingEdge => + (super.noSuchMethod(Invocation.getter(#paddingEdge), + returnValue: _FakeCssRect_2()) as _i2.CssRect); + @override + _i2.CssRect get borderEdge => + (super.noSuchMethod(Invocation.getter(#borderEdge), + returnValue: _FakeCssRect_2()) as _i2.CssRect); + @override + _i2.CssRect get marginEdge => + (super.noSuchMethod(Invocation.getter(#marginEdge), + returnValue: _FakeCssRect_2()) as _i2.CssRect); + @override + _i3.Point get documentOffset => + (super.noSuchMethod(Invocation.getter(#documentOffset), + returnValue: _FakePoint_3()) as _i3.Point); + @override + set innerHtml(String? html) => + super.noSuchMethod(Invocation.setter(#innerHtml, html), + returnValueForMissingStub: null); + @override + String get innerText => + (super.noSuchMethod(Invocation.getter(#innerText), returnValue: '') + as String); + @override + set innerText(String? value) => + super.noSuchMethod(Invocation.setter(#innerText, value), + returnValueForMissingStub: null); + @override + _i2.ElementEvents get on => (super.noSuchMethod(Invocation.getter(#on), + returnValue: _FakeElementEvents_4()) as _i2.ElementEvents); + @override + int get offsetHeight => + (super.noSuchMethod(Invocation.getter(#offsetHeight), returnValue: 0) + as int); + @override + int get offsetLeft => + (super.noSuchMethod(Invocation.getter(#offsetLeft), returnValue: 0) + as int); + @override + int get offsetTop => + (super.noSuchMethod(Invocation.getter(#offsetTop), returnValue: 0) + as int); + @override + int get offsetWidth => + (super.noSuchMethod(Invocation.getter(#offsetWidth), returnValue: 0) + as int); + @override + int get scrollHeight => + (super.noSuchMethod(Invocation.getter(#scrollHeight), returnValue: 0) + as int); + @override + int get scrollLeft => + (super.noSuchMethod(Invocation.getter(#scrollLeft), returnValue: 0) + as int); + @override + set scrollLeft(int? value) => + super.noSuchMethod(Invocation.setter(#scrollLeft, value), + returnValueForMissingStub: null); + @override + int get scrollTop => + (super.noSuchMethod(Invocation.getter(#scrollTop), returnValue: 0) + as int); + @override + set scrollTop(int? value) => + super.noSuchMethod(Invocation.setter(#scrollTop, value), + returnValueForMissingStub: null); + @override + int get scrollWidth => + (super.noSuchMethod(Invocation.getter(#scrollWidth), returnValue: 0) + as int); + @override + String get contentEditable => + (super.noSuchMethod(Invocation.getter(#contentEditable), returnValue: '') + as String); + @override + set contentEditable(String? value) => + super.noSuchMethod(Invocation.setter(#contentEditable, value), + returnValueForMissingStub: null); + @override + set dir(String? value) => super.noSuchMethod(Invocation.setter(#dir, value), + returnValueForMissingStub: null); + @override + bool get draggable => + (super.noSuchMethod(Invocation.getter(#draggable), returnValue: false) + as bool); + @override + set draggable(bool? value) => + super.noSuchMethod(Invocation.setter(#draggable, value), + returnValueForMissingStub: null); + @override + bool get hidden => + (super.noSuchMethod(Invocation.getter(#hidden), returnValue: false) + as bool); + @override + set hidden(bool? value) => + super.noSuchMethod(Invocation.setter(#hidden, value), + returnValueForMissingStub: null); + @override + set inert(bool? value) => super.noSuchMethod(Invocation.setter(#inert, value), + returnValueForMissingStub: null); + @override + set inputMode(String? value) => + super.noSuchMethod(Invocation.setter(#inputMode, value), + returnValueForMissingStub: null); + @override + set lang(String? value) => super.noSuchMethod(Invocation.setter(#lang, value), + returnValueForMissingStub: null); + @override + set spellcheck(bool? value) => + super.noSuchMethod(Invocation.setter(#spellcheck, value), + returnValueForMissingStub: null); + @override + _i2.CssStyleDeclaration get style => (super.noSuchMethod( + Invocation.getter(#style), + returnValue: _FakeCssStyleDeclaration_5()) as _i2.CssStyleDeclaration); + @override + set tabIndex(int? value) => + super.noSuchMethod(Invocation.setter(#tabIndex, value), + returnValueForMissingStub: null); + @override + set title(String? value) => + super.noSuchMethod(Invocation.setter(#title, value), + returnValueForMissingStub: null); + @override + set translate(bool? value) => + super.noSuchMethod(Invocation.setter(#translate, value), + returnValueForMissingStub: null); + @override + String get className => + (super.noSuchMethod(Invocation.getter(#className), returnValue: '') + as String); + @override + set className(String? value) => + super.noSuchMethod(Invocation.setter(#className, value), + returnValueForMissingStub: null); + @override + int get clientHeight => + (super.noSuchMethod(Invocation.getter(#clientHeight), returnValue: 0) + as int); + @override + int get clientWidth => + (super.noSuchMethod(Invocation.getter(#clientWidth), returnValue: 0) + as int); + @override + String get id => + (super.noSuchMethod(Invocation.getter(#id), returnValue: '') as String); + @override + set id(String? value) => super.noSuchMethod(Invocation.setter(#id, value), + returnValueForMissingStub: null); + @override + set slot(String? value) => super.noSuchMethod(Invocation.setter(#slot, value), + returnValueForMissingStub: null); + @override + String get tagName => + (super.noSuchMethod(Invocation.getter(#tagName), returnValue: '') + as String); + @override + _i2.ElementStream<_i2.Event> get onAbort => + (super.noSuchMethod(Invocation.getter(#onAbort), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onBeforeCopy => + (super.noSuchMethod(Invocation.getter(#onBeforeCopy), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onBeforeCut => + (super.noSuchMethod(Invocation.getter(#onBeforeCut), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onBeforePaste => + (super.noSuchMethod(Invocation.getter(#onBeforePaste), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onBlur => + (super.noSuchMethod(Invocation.getter(#onBlur), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onCanPlay => + (super.noSuchMethod(Invocation.getter(#onCanPlay), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onCanPlayThrough => + (super.noSuchMethod(Invocation.getter(#onCanPlayThrough), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onChange => + (super.noSuchMethod(Invocation.getter(#onChange), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.MouseEvent> get onClick => + (super.noSuchMethod(Invocation.getter(#onClick), + returnValue: _FakeElementStream_6<_i2.MouseEvent>()) + as _i2.ElementStream<_i2.MouseEvent>); + @override + _i2.ElementStream<_i2.MouseEvent> get onContextMenu => + (super.noSuchMethod(Invocation.getter(#onContextMenu), + returnValue: _FakeElementStream_6<_i2.MouseEvent>()) + as _i2.ElementStream<_i2.MouseEvent>); + @override + _i2.ElementStream<_i2.ClipboardEvent> get onCopy => + (super.noSuchMethod(Invocation.getter(#onCopy), + returnValue: _FakeElementStream_6<_i2.ClipboardEvent>()) + as _i2.ElementStream<_i2.ClipboardEvent>); + @override + _i2.ElementStream<_i2.ClipboardEvent> get onCut => + (super.noSuchMethod(Invocation.getter(#onCut), + returnValue: _FakeElementStream_6<_i2.ClipboardEvent>()) + as _i2.ElementStream<_i2.ClipboardEvent>); + @override + _i2.ElementStream<_i2.Event> get onDoubleClick => + (super.noSuchMethod(Invocation.getter(#onDoubleClick), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.MouseEvent> get onDrag => + (super.noSuchMethod(Invocation.getter(#onDrag), + returnValue: _FakeElementStream_6<_i2.MouseEvent>()) + as _i2.ElementStream<_i2.MouseEvent>); + @override + _i2.ElementStream<_i2.MouseEvent> get onDragEnd => + (super.noSuchMethod(Invocation.getter(#onDragEnd), + returnValue: _FakeElementStream_6<_i2.MouseEvent>()) + as _i2.ElementStream<_i2.MouseEvent>); + @override + _i2.ElementStream<_i2.MouseEvent> get onDragEnter => + (super.noSuchMethod(Invocation.getter(#onDragEnter), + returnValue: _FakeElementStream_6<_i2.MouseEvent>()) + as _i2.ElementStream<_i2.MouseEvent>); + @override + _i2.ElementStream<_i2.MouseEvent> get onDragLeave => + (super.noSuchMethod(Invocation.getter(#onDragLeave), + returnValue: _FakeElementStream_6<_i2.MouseEvent>()) + as _i2.ElementStream<_i2.MouseEvent>); + @override + _i2.ElementStream<_i2.MouseEvent> get onDragOver => + (super.noSuchMethod(Invocation.getter(#onDragOver), + returnValue: _FakeElementStream_6<_i2.MouseEvent>()) + as _i2.ElementStream<_i2.MouseEvent>); + @override + _i2.ElementStream<_i2.MouseEvent> get onDragStart => + (super.noSuchMethod(Invocation.getter(#onDragStart), + returnValue: _FakeElementStream_6<_i2.MouseEvent>()) + as _i2.ElementStream<_i2.MouseEvent>); + @override + _i2.ElementStream<_i2.MouseEvent> get onDrop => + (super.noSuchMethod(Invocation.getter(#onDrop), + returnValue: _FakeElementStream_6<_i2.MouseEvent>()) + as _i2.ElementStream<_i2.MouseEvent>); + @override + _i2.ElementStream<_i2.Event> get onDurationChange => + (super.noSuchMethod(Invocation.getter(#onDurationChange), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onEmptied => + (super.noSuchMethod(Invocation.getter(#onEmptied), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onEnded => + (super.noSuchMethod(Invocation.getter(#onEnded), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onError => + (super.noSuchMethod(Invocation.getter(#onError), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onFocus => + (super.noSuchMethod(Invocation.getter(#onFocus), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onInput => + (super.noSuchMethod(Invocation.getter(#onInput), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onInvalid => + (super.noSuchMethod(Invocation.getter(#onInvalid), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.KeyboardEvent> get onKeyDown => + (super.noSuchMethod(Invocation.getter(#onKeyDown), + returnValue: _FakeElementStream_6<_i2.KeyboardEvent>()) + as _i2.ElementStream<_i2.KeyboardEvent>); + @override + _i2.ElementStream<_i2.KeyboardEvent> get onKeyPress => + (super.noSuchMethod(Invocation.getter(#onKeyPress), + returnValue: _FakeElementStream_6<_i2.KeyboardEvent>()) + as _i2.ElementStream<_i2.KeyboardEvent>); + @override + _i2.ElementStream<_i2.KeyboardEvent> get onKeyUp => + (super.noSuchMethod(Invocation.getter(#onKeyUp), + returnValue: _FakeElementStream_6<_i2.KeyboardEvent>()) + as _i2.ElementStream<_i2.KeyboardEvent>); + @override + _i2.ElementStream<_i2.Event> get onLoad => + (super.noSuchMethod(Invocation.getter(#onLoad), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onLoadedData => + (super.noSuchMethod(Invocation.getter(#onLoadedData), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onLoadedMetadata => + (super.noSuchMethod(Invocation.getter(#onLoadedMetadata), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.MouseEvent> get onMouseDown => + (super.noSuchMethod(Invocation.getter(#onMouseDown), + returnValue: _FakeElementStream_6<_i2.MouseEvent>()) + as _i2.ElementStream<_i2.MouseEvent>); + @override + _i2.ElementStream<_i2.MouseEvent> get onMouseEnter => + (super.noSuchMethod(Invocation.getter(#onMouseEnter), + returnValue: _FakeElementStream_6<_i2.MouseEvent>()) + as _i2.ElementStream<_i2.MouseEvent>); + @override + _i2.ElementStream<_i2.MouseEvent> get onMouseLeave => + (super.noSuchMethod(Invocation.getter(#onMouseLeave), + returnValue: _FakeElementStream_6<_i2.MouseEvent>()) + as _i2.ElementStream<_i2.MouseEvent>); + @override + _i2.ElementStream<_i2.MouseEvent> get onMouseMove => + (super.noSuchMethod(Invocation.getter(#onMouseMove), + returnValue: _FakeElementStream_6<_i2.MouseEvent>()) + as _i2.ElementStream<_i2.MouseEvent>); + @override + _i2.ElementStream<_i2.MouseEvent> get onMouseOut => + (super.noSuchMethod(Invocation.getter(#onMouseOut), + returnValue: _FakeElementStream_6<_i2.MouseEvent>()) + as _i2.ElementStream<_i2.MouseEvent>); + @override + _i2.ElementStream<_i2.MouseEvent> get onMouseOver => + (super.noSuchMethod(Invocation.getter(#onMouseOver), + returnValue: _FakeElementStream_6<_i2.MouseEvent>()) + as _i2.ElementStream<_i2.MouseEvent>); + @override + _i2.ElementStream<_i2.MouseEvent> get onMouseUp => + (super.noSuchMethod(Invocation.getter(#onMouseUp), + returnValue: _FakeElementStream_6<_i2.MouseEvent>()) + as _i2.ElementStream<_i2.MouseEvent>); + @override + _i2.ElementStream<_i2.WheelEvent> get onMouseWheel => + (super.noSuchMethod(Invocation.getter(#onMouseWheel), + returnValue: _FakeElementStream_6<_i2.WheelEvent>()) + as _i2.ElementStream<_i2.WheelEvent>); + @override + _i2.ElementStream<_i2.ClipboardEvent> get onPaste => + (super.noSuchMethod(Invocation.getter(#onPaste), + returnValue: _FakeElementStream_6<_i2.ClipboardEvent>()) + as _i2.ElementStream<_i2.ClipboardEvent>); + @override + _i2.ElementStream<_i2.Event> get onPause => + (super.noSuchMethod(Invocation.getter(#onPause), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onPlay => + (super.noSuchMethod(Invocation.getter(#onPlay), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onPlaying => + (super.noSuchMethod(Invocation.getter(#onPlaying), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onRateChange => + (super.noSuchMethod(Invocation.getter(#onRateChange), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onReset => + (super.noSuchMethod(Invocation.getter(#onReset), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onResize => + (super.noSuchMethod(Invocation.getter(#onResize), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onScroll => + (super.noSuchMethod(Invocation.getter(#onScroll), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onSearch => + (super.noSuchMethod(Invocation.getter(#onSearch), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onSeeked => + (super.noSuchMethod(Invocation.getter(#onSeeked), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onSeeking => + (super.noSuchMethod(Invocation.getter(#onSeeking), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onSelect => + (super.noSuchMethod(Invocation.getter(#onSelect), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onSelectStart => + (super.noSuchMethod(Invocation.getter(#onSelectStart), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onStalled => + (super.noSuchMethod(Invocation.getter(#onStalled), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onSubmit => + (super.noSuchMethod(Invocation.getter(#onSubmit), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onSuspend => + (super.noSuchMethod(Invocation.getter(#onSuspend), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onTimeUpdate => + (super.noSuchMethod(Invocation.getter(#onTimeUpdate), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.TouchEvent> get onTouchCancel => + (super.noSuchMethod(Invocation.getter(#onTouchCancel), + returnValue: _FakeElementStream_6<_i2.TouchEvent>()) + as _i2.ElementStream<_i2.TouchEvent>); + @override + _i2.ElementStream<_i2.TouchEvent> get onTouchEnd => + (super.noSuchMethod(Invocation.getter(#onTouchEnd), + returnValue: _FakeElementStream_6<_i2.TouchEvent>()) + as _i2.ElementStream<_i2.TouchEvent>); + @override + _i2.ElementStream<_i2.TouchEvent> get onTouchEnter => + (super.noSuchMethod(Invocation.getter(#onTouchEnter), + returnValue: _FakeElementStream_6<_i2.TouchEvent>()) + as _i2.ElementStream<_i2.TouchEvent>); + @override + _i2.ElementStream<_i2.TouchEvent> get onTouchLeave => + (super.noSuchMethod(Invocation.getter(#onTouchLeave), + returnValue: _FakeElementStream_6<_i2.TouchEvent>()) + as _i2.ElementStream<_i2.TouchEvent>); + @override + _i2.ElementStream<_i2.TouchEvent> get onTouchMove => + (super.noSuchMethod(Invocation.getter(#onTouchMove), + returnValue: _FakeElementStream_6<_i2.TouchEvent>()) + as _i2.ElementStream<_i2.TouchEvent>); + @override + _i2.ElementStream<_i2.TouchEvent> get onTouchStart => + (super.noSuchMethod(Invocation.getter(#onTouchStart), + returnValue: _FakeElementStream_6<_i2.TouchEvent>()) + as _i2.ElementStream<_i2.TouchEvent>); + @override + _i2.ElementStream<_i2.TransitionEvent> get onTransitionEnd => + (super.noSuchMethod(Invocation.getter(#onTransitionEnd), + returnValue: _FakeElementStream_6<_i2.TransitionEvent>()) + as _i2.ElementStream<_i2.TransitionEvent>); + @override + _i2.ElementStream<_i2.Event> get onVolumeChange => + (super.noSuchMethod(Invocation.getter(#onVolumeChange), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onWaiting => + (super.noSuchMethod(Invocation.getter(#onWaiting), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onFullscreenChange => + (super.noSuchMethod(Invocation.getter(#onFullscreenChange), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.Event> get onFullscreenError => + (super.noSuchMethod(Invocation.getter(#onFullscreenError), + returnValue: _FakeElementStream_6<_i2.Event>()) + as _i2.ElementStream<_i2.Event>); + @override + _i2.ElementStream<_i2.WheelEvent> get onWheel => + (super.noSuchMethod(Invocation.getter(#onWheel), + returnValue: _FakeElementStream_6<_i2.WheelEvent>()) + as _i2.ElementStream<_i2.WheelEvent>); + @override + List<_i2.Node> get nodes => + (super.noSuchMethod(Invocation.getter(#nodes), returnValue: <_i2.Node>[]) + as List<_i2.Node>); + @override + set nodes(Iterable<_i2.Node>? value) => + super.noSuchMethod(Invocation.setter(#nodes, value), + returnValueForMissingStub: null); + @override + List<_i2.Node> get childNodes => + (super.noSuchMethod(Invocation.getter(#childNodes), + returnValue: <_i2.Node>[]) as List<_i2.Node>); + @override + int get nodeType => + (super.noSuchMethod(Invocation.getter(#nodeType), returnValue: 0) as int); + @override + set text(String? value) => super.noSuchMethod(Invocation.setter(#text, value), + returnValueForMissingStub: null); + @override + String? getAttribute(String? name) => + (super.noSuchMethod(Invocation.method(#getAttribute, [name])) as String?); + @override + String? getAttributeNS(String? namespaceURI, String? name) => + (super.noSuchMethod( + Invocation.method(#getAttributeNS, [namespaceURI, name])) as String?); + @override + bool hasAttribute(String? name) => + (super.noSuchMethod(Invocation.method(#hasAttribute, [name]), + returnValue: false) as bool); + @override + bool hasAttributeNS(String? namespaceURI, String? name) => (super + .noSuchMethod(Invocation.method(#hasAttributeNS, [namespaceURI, name]), + returnValue: false) as bool); + @override + void removeAttribute(String? name) => + super.noSuchMethod(Invocation.method(#removeAttribute, [name]), + returnValueForMissingStub: null); + @override + void removeAttributeNS(String? namespaceURI, String? name) => super + .noSuchMethod(Invocation.method(#removeAttributeNS, [namespaceURI, name]), + returnValueForMissingStub: null); + @override + void setAttribute(String? name, Object? value) => + super.noSuchMethod(Invocation.method(#setAttribute, [name, value]), + returnValueForMissingStub: null); + @override + void setAttributeNS(String? namespaceURI, String? name, Object? value) => + super.noSuchMethod( + Invocation.method(#setAttributeNS, [namespaceURI, name, value]), + returnValueForMissingStub: null); + @override + _i2.ElementList querySelectorAll( + String? selectors) => + (super.noSuchMethod(Invocation.method(#querySelectorAll, [selectors]), + returnValue: _FakeElementList_7()) as _i2.ElementList); + @override + _i6.Future<_i2.ScrollState> setApplyScroll(String? nativeScrollBehavior) => + (super.noSuchMethod( + Invocation.method(#setApplyScroll, [nativeScrollBehavior]), + returnValue: Future<_i2.ScrollState>.value(_FakeScrollState_8())) + as _i6.Future<_i2.ScrollState>); + @override + _i6.Future<_i2.ScrollState> setDistributeScroll( + String? nativeScrollBehavior) => + (super.noSuchMethod( + Invocation.method(#setDistributeScroll, [nativeScrollBehavior]), + returnValue: Future<_i2.ScrollState>.value(_FakeScrollState_8())) + as _i6.Future<_i2.ScrollState>); + @override + Map getNamespacedAttributes(String? namespace) => (super + .noSuchMethod(Invocation.method(#getNamespacedAttributes, [namespace]), + returnValue: {}) as Map); + @override + _i2.CssStyleDeclaration getComputedStyle([String? pseudoElement]) => + (super.noSuchMethod(Invocation.method(#getComputedStyle, [pseudoElement]), + returnValue: _FakeCssStyleDeclaration_5()) + as _i2.CssStyleDeclaration); + @override + void appendText(String? text) => + super.noSuchMethod(Invocation.method(#appendText, [text]), + returnValueForMissingStub: null); + @override + void appendHtml(String? text, + {_i2.NodeValidator? validator, + _i2.NodeTreeSanitizer? treeSanitizer}) => + super.noSuchMethod( + Invocation.method(#appendHtml, [text], + {#validator: validator, #treeSanitizer: treeSanitizer}), + returnValueForMissingStub: null); + @override + void attached() => super.noSuchMethod(Invocation.method(#attached, []), + returnValueForMissingStub: null); + @override + void detached() => super.noSuchMethod(Invocation.method(#detached, []), + returnValueForMissingStub: null); + @override + void enteredView() => super.noSuchMethod(Invocation.method(#enteredView, []), + returnValueForMissingStub: null); + @override + List<_i3.Rectangle> getClientRects() => + (super.noSuchMethod(Invocation.method(#getClientRects, []), + returnValue: <_i3.Rectangle>[]) as List<_i3.Rectangle>); + @override + void leftView() => super.noSuchMethod(Invocation.method(#leftView, []), + returnValueForMissingStub: null); + @override + _i2.Animation animate(Iterable>? frames, + [dynamic timing]) => + (super.noSuchMethod(Invocation.method(#animate, [frames, timing]), + returnValue: _FakeAnimation_9()) as _i2.Animation); + @override + void attributeChanged(String? name, String? oldValue, String? newValue) => + super.noSuchMethod( + Invocation.method(#attributeChanged, [name, oldValue, newValue]), + returnValueForMissingStub: null); + @override + void scrollIntoView([_i2.ScrollAlignment? alignment]) => + super.noSuchMethod(Invocation.method(#scrollIntoView, [alignment]), + returnValueForMissingStub: null); + @override + void insertAdjacentText(String? where, String? text) => + super.noSuchMethod(Invocation.method(#insertAdjacentText, [where, text]), + returnValueForMissingStub: null); + @override + void insertAdjacentHtml(String? where, String? html, + {_i2.NodeValidator? validator, + _i2.NodeTreeSanitizer? treeSanitizer}) => + super.noSuchMethod( + Invocation.method(#insertAdjacentHtml, [where, html], + {#validator: validator, #treeSanitizer: treeSanitizer}), + returnValueForMissingStub: null); + @override + _i2.Element insertAdjacentElement(String? where, _i2.Element? element) => + (super.noSuchMethod( + Invocation.method(#insertAdjacentElement, [where, element]), + returnValue: _FakeElement_10()) as _i2.Element); + @override + bool matches(String? selectors) => + (super.noSuchMethod(Invocation.method(#matches, [selectors]), + returnValue: false) as bool); + @override + bool matchesWithAncestors(String? selectors) => + (super.noSuchMethod(Invocation.method(#matchesWithAncestors, [selectors]), + returnValue: false) as bool); + @override + _i2.ShadowRoot createShadowRoot() => + (super.noSuchMethod(Invocation.method(#createShadowRoot, []), + returnValue: _FakeShadowRoot_11()) as _i2.ShadowRoot); + @override + _i3.Point offsetTo(_i2.Element? parent) => + (super.noSuchMethod(Invocation.method(#offsetTo, [parent]), + returnValue: _FakePoint_3()) as _i3.Point); + @override + _i2.DocumentFragment createFragment(String? html, + {_i2.NodeValidator? validator, + _i2.NodeTreeSanitizer? treeSanitizer}) => + (super.noSuchMethod( + Invocation.method(#createFragment, [html], + {#validator: validator, #treeSanitizer: treeSanitizer}), + returnValue: _FakeDocumentFragment_12()) as _i2.DocumentFragment); + @override + void setInnerHtml(String? html, + {_i2.NodeValidator? validator, + _i2.NodeTreeSanitizer? treeSanitizer}) => + super.noSuchMethod( + Invocation.method(#setInnerHtml, [html], + {#validator: validator, #treeSanitizer: treeSanitizer}), + returnValueForMissingStub: null); + @override + void blur() => super.noSuchMethod(Invocation.method(#blur, []), + returnValueForMissingStub: null); + @override + void click() => super.noSuchMethod(Invocation.method(#click, []), + returnValueForMissingStub: null); + @override + void focus() => super.noSuchMethod(Invocation.method(#focus, []), + returnValueForMissingStub: null); + @override + _i2.ShadowRoot attachShadow(Map? shadowRootInitDict) => + (super.noSuchMethod( + Invocation.method(#attachShadow, [shadowRootInitDict]), + returnValue: _FakeShadowRoot_11()) as _i2.ShadowRoot); + @override + _i2.Element? closest(String? selectors) => + (super.noSuchMethod(Invocation.method(#closest, [selectors])) + as _i2.Element?); + @override + List<_i2.Animation> getAnimations() => + (super.noSuchMethod(Invocation.method(#getAnimations, []), + returnValue: <_i2.Animation>[]) as List<_i2.Animation>); + @override + List getAttributeNames() => + (super.noSuchMethod(Invocation.method(#getAttributeNames, []), + returnValue: []) as List); + @override + _i3.Rectangle getBoundingClientRect() => + (super.noSuchMethod(Invocation.method(#getBoundingClientRect, []), + returnValue: _FakeRectangle_1()) as _i3.Rectangle); + @override + List<_i2.Node> getDestinationInsertionPoints() => + (super.noSuchMethod(Invocation.method(#getDestinationInsertionPoints, []), + returnValue: <_i2.Node>[]) as List<_i2.Node>); + @override + List<_i2.Node> getElementsByClassName(String? classNames) => (super + .noSuchMethod(Invocation.method(#getElementsByClassName, [classNames]), + returnValue: <_i2.Node>[]) as List<_i2.Node>); + @override + bool hasPointerCapture(int? pointerId) => + (super.noSuchMethod(Invocation.method(#hasPointerCapture, [pointerId]), + returnValue: false) as bool); + @override + void releasePointerCapture(int? pointerId) => + super.noSuchMethod(Invocation.method(#releasePointerCapture, [pointerId]), + returnValueForMissingStub: null); + @override + void requestPointerLock() => + super.noSuchMethod(Invocation.method(#requestPointerLock, []), + returnValueForMissingStub: null); + @override + void scroll([dynamic options_OR_x, num? y]) => + super.noSuchMethod(Invocation.method(#scroll, [options_OR_x, y]), + returnValueForMissingStub: null); + @override + void scrollBy([dynamic options_OR_x, num? y]) => + super.noSuchMethod(Invocation.method(#scrollBy, [options_OR_x, y]), + returnValueForMissingStub: null); + @override + void scrollTo([dynamic options_OR_x, num? y]) => + super.noSuchMethod(Invocation.method(#scrollTo, [options_OR_x, y]), + returnValueForMissingStub: null); + @override + void setPointerCapture(int? pointerId) => + super.noSuchMethod(Invocation.method(#setPointerCapture, [pointerId]), + returnValueForMissingStub: null); + @override + void requestFullscreen() => + super.noSuchMethod(Invocation.method(#requestFullscreen, []), + returnValueForMissingStub: null); + @override + void after(Object? nodes) => + super.noSuchMethod(Invocation.method(#after, [nodes]), + returnValueForMissingStub: null); + @override + void before(Object? nodes) => + super.noSuchMethod(Invocation.method(#before, [nodes]), + returnValueForMissingStub: null); + @override + _i2.Element? querySelector(String? selectors) => + (super.noSuchMethod(Invocation.method(#querySelector, [selectors])) + as _i2.Element?); + @override + void remove() => super.noSuchMethod(Invocation.method(#remove, []), + returnValueForMissingStub: null); + @override + _i2.Node replaceWith(_i2.Node? otherNode) => + (super.noSuchMethod(Invocation.method(#replaceWith, [otherNode]), + returnValue: _FakeNode_13()) as _i2.Node); + @override + void insertAllBefore(Iterable<_i2.Node>? newNodes, _i2.Node? child) => + super.noSuchMethod(Invocation.method(#insertAllBefore, [newNodes, child]), + returnValueForMissingStub: null); + @override + _i2.Node append(_i2.Node? node) => + (super.noSuchMethod(Invocation.method(#append, [node]), + returnValue: _FakeNode_13()) as _i2.Node); + @override + _i2.Node clone(bool? deep) => + (super.noSuchMethod(Invocation.method(#clone, [deep]), + returnValue: _FakeNode_13()) as _i2.Node); + @override + bool contains(_i2.Node? other) => + (super.noSuchMethod(Invocation.method(#contains, [other]), + returnValue: false) as bool); + @override + _i2.Node getRootNode([Map? options]) => + (super.noSuchMethod(Invocation.method(#getRootNode, [options]), + returnValue: _FakeNode_13()) as _i2.Node); + @override + bool hasChildNodes() => + (super.noSuchMethod(Invocation.method(#hasChildNodes, []), + returnValue: false) as bool); + @override + _i2.Node insertBefore(_i2.Node? node, _i2.Node? child) => + (super.noSuchMethod(Invocation.method(#insertBefore, [node, child]), + returnValue: _FakeNode_13()) as _i2.Node); + @override + void addEventListener(String? type, _i2.EventListener? listener, + [bool? useCapture]) => + super.noSuchMethod( + Invocation.method(#addEventListener, [type, listener, useCapture]), + returnValueForMissingStub: null); + @override + void removeEventListener(String? type, _i2.EventListener? listener, + [bool? useCapture]) => + super.noSuchMethod( + Invocation.method(#removeEventListener, [type, listener, useCapture]), + returnValueForMissingStub: null); + @override + bool dispatchEvent(_i2.Event? event) => + (super.noSuchMethod(Invocation.method(#dispatchEvent, [event]), + returnValue: false) as bool); +} + +/// A class which mocks [BuildContext]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockBuildContext extends _i1.Mock implements _i4.BuildContext { + MockBuildContext() { + _i1.throwOnMissingStub(this); + } + + @override + _i4.Widget get widget => (super.noSuchMethod(Invocation.getter(#widget), + returnValue: _FakeWidget_14()) as _i4.Widget); + @override + bool get debugDoingBuild => (super + .noSuchMethod(Invocation.getter(#debugDoingBuild), returnValue: false) + as bool); + @override + _i4.InheritedWidget dependOnInheritedElement(_i4.InheritedElement? ancestor, + {Object? aspect}) => + (super.noSuchMethod( + Invocation.method( + #dependOnInheritedElement, [ancestor], {#aspect: aspect}), + returnValue: _FakeInheritedWidget_15()) as _i4.InheritedWidget); + @override + void visitAncestorElements(bool Function(_i4.Element)? visitor) => + super.noSuchMethod(Invocation.method(#visitAncestorElements, [visitor]), + returnValueForMissingStub: null); + @override + void visitChildElements(_i4.ElementVisitor? visitor) => + super.noSuchMethod(Invocation.method(#visitChildElements, [visitor]), + returnValueForMissingStub: null); + @override + _i5.DiagnosticsNode describeElement(String? name, + {_i5.DiagnosticsTreeStyle? style = + _i5.DiagnosticsTreeStyle.errorProperty}) => + (super.noSuchMethod( + Invocation.method(#describeElement, [name], {#style: style}), + returnValue: _FakeDiagnosticsNode_16()) as _i5.DiagnosticsNode); + @override + _i5.DiagnosticsNode describeWidget(String? name, + {_i5.DiagnosticsTreeStyle? style = + _i5.DiagnosticsTreeStyle.errorProperty}) => + (super.noSuchMethod( + Invocation.method(#describeWidget, [name], {#style: style}), + returnValue: _FakeDiagnosticsNode_16()) as _i5.DiagnosticsNode); + @override + List<_i5.DiagnosticsNode> describeMissingAncestor( + {Type? expectedAncestorType}) => + (super.noSuchMethod( + Invocation.method(#describeMissingAncestor, [], + {#expectedAncestorType: expectedAncestorType}), + returnValue: <_i5.DiagnosticsNode>[]) as List<_i5.DiagnosticsNode>); + @override + _i5.DiagnosticsNode describeOwnershipChain(String? name) => + (super.noSuchMethod(Invocation.method(#describeOwnershipChain, [name]), + returnValue: _FakeDiagnosticsNode_16()) as _i5.DiagnosticsNode); +} + +/// A class which mocks [CreationParams]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockCreationParams extends _i1.Mock implements _i7.CreationParams { + MockCreationParams() { + _i1.throwOnMissingStub(this); + } + + @override + Set get javascriptChannelNames => + (super.noSuchMethod(Invocation.getter(#javascriptChannelNames), + returnValue: {}) as Set); + @override + _i7.AutoMediaPlaybackPolicy get autoMediaPlaybackPolicy => + (super.noSuchMethod(Invocation.getter(#autoMediaPlaybackPolicy), + returnValue: _i7.AutoMediaPlaybackPolicy + .require_user_action_for_all_media_types) + as _i7.AutoMediaPlaybackPolicy); + @override + List<_i7.WebViewCookie> get cookies => + (super.noSuchMethod(Invocation.getter(#cookies), + returnValue: <_i7.WebViewCookie>[]) as List<_i7.WebViewCookie>); +} + +/// A class which mocks [WebViewPlatformCallbacksHandler]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockWebViewPlatformCallbacksHandler extends _i1.Mock + implements _i8.WebViewPlatformCallbacksHandler { + MockWebViewPlatformCallbacksHandler() { + _i1.throwOnMissingStub(this); + } + + @override + _i6.FutureOr onNavigationRequest({String? url, bool? isForMainFrame}) => + (super.noSuchMethod( + Invocation.method(#onNavigationRequest, [], + {#url: url, #isForMainFrame: isForMainFrame}), + returnValue: Future.value(false)) as _i6.FutureOr); + @override + void onPageStarted(String? url) => + super.noSuchMethod(Invocation.method(#onPageStarted, [url]), + returnValueForMissingStub: null); + @override + void onPageFinished(String? url) => + super.noSuchMethod(Invocation.method(#onPageFinished, [url]), + returnValueForMissingStub: null); + @override + void onProgress(int? progress) => + super.noSuchMethod(Invocation.method(#onProgress, [progress]), + returnValueForMissingStub: null); + @override + void onWebResourceError(_i7.WebResourceError? error) => + super.noSuchMethod(Invocation.method(#onWebResourceError, [error]), + returnValueForMissingStub: null); +} + +/// A class which mocks [HttpRequestFactory]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockHttpRequestFactory extends _i1.Mock + implements _i9.HttpRequestFactory { + MockHttpRequestFactory() { + _i1.throwOnMissingStub(this); + } + + @override + _i6.Future<_i2.HttpRequest> request(String? url, + {String? method, + bool? withCredentials, + String? responseType, + String? mimeType, + Map? requestHeaders, + dynamic sendData, + void Function(_i2.ProgressEvent)? onProgress}) => + (super.noSuchMethod( + Invocation.method(#request, [ + url + ], { + #method: method, + #withCredentials: withCredentials, + #responseType: responseType, + #mimeType: mimeType, + #requestHeaders: requestHeaders, + #sendData: sendData, + #onProgress: onProgress + }), + returnValue: Future<_i2.HttpRequest>.value(_FakeHttpRequest_17())) + as _i6.Future<_i2.HttpRequest>); +} + +/// A class which mocks [HttpRequest]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockHttpRequest extends _i1.Mock implements _i2.HttpRequest { + MockHttpRequest() { + _i1.throwOnMissingStub(this); + } + + @override + Map get responseHeaders => + (super.noSuchMethod(Invocation.getter(#responseHeaders), + returnValue: {}) as Map); + @override + int get readyState => + (super.noSuchMethod(Invocation.getter(#readyState), returnValue: 0) + as int); + @override + String get responseType => + (super.noSuchMethod(Invocation.getter(#responseType), returnValue: '') + as String); + @override + set responseType(String? value) => + super.noSuchMethod(Invocation.setter(#responseType, value), + returnValueForMissingStub: null); + @override + set timeout(int? value) => + super.noSuchMethod(Invocation.setter(#timeout, value), + returnValueForMissingStub: null); + @override + _i2.HttpRequestUpload get upload => + (super.noSuchMethod(Invocation.getter(#upload), + returnValue: _FakeHttpRequestUpload_18()) as _i2.HttpRequestUpload); + @override + set withCredentials(bool? value) => + super.noSuchMethod(Invocation.setter(#withCredentials, value), + returnValueForMissingStub: null); + @override + _i6.Stream<_i2.Event> get onReadyStateChange => + (super.noSuchMethod(Invocation.getter(#onReadyStateChange), + returnValue: Stream<_i2.Event>.empty()) as _i6.Stream<_i2.Event>); + @override + _i6.Stream<_i2.ProgressEvent> get onAbort => + (super.noSuchMethod(Invocation.getter(#onAbort), + returnValue: Stream<_i2.ProgressEvent>.empty()) + as _i6.Stream<_i2.ProgressEvent>); + @override + _i6.Stream<_i2.ProgressEvent> get onError => + (super.noSuchMethod(Invocation.getter(#onError), + returnValue: Stream<_i2.ProgressEvent>.empty()) + as _i6.Stream<_i2.ProgressEvent>); + @override + _i6.Stream<_i2.ProgressEvent> get onLoad => + (super.noSuchMethod(Invocation.getter(#onLoad), + returnValue: Stream<_i2.ProgressEvent>.empty()) + as _i6.Stream<_i2.ProgressEvent>); + @override + _i6.Stream<_i2.ProgressEvent> get onLoadEnd => + (super.noSuchMethod(Invocation.getter(#onLoadEnd), + returnValue: Stream<_i2.ProgressEvent>.empty()) + as _i6.Stream<_i2.ProgressEvent>); + @override + _i6.Stream<_i2.ProgressEvent> get onLoadStart => + (super.noSuchMethod(Invocation.getter(#onLoadStart), + returnValue: Stream<_i2.ProgressEvent>.empty()) + as _i6.Stream<_i2.ProgressEvent>); + @override + _i6.Stream<_i2.ProgressEvent> get onProgress => + (super.noSuchMethod(Invocation.getter(#onProgress), + returnValue: Stream<_i2.ProgressEvent>.empty()) + as _i6.Stream<_i2.ProgressEvent>); + @override + _i6.Stream<_i2.ProgressEvent> get onTimeout => + (super.noSuchMethod(Invocation.getter(#onTimeout), + returnValue: Stream<_i2.ProgressEvent>.empty()) + as _i6.Stream<_i2.ProgressEvent>); + @override + _i2.Events get on => + (super.noSuchMethod(Invocation.getter(#on), returnValue: _FakeEvents_19()) + as _i2.Events); + @override + void open(String? method, String? url, + {bool? async, String? user, String? password}) => + super.noSuchMethod( + Invocation.method(#open, [method, url], + {#async: async, #user: user, #password: password}), + returnValueForMissingStub: null); + @override + void abort() => super.noSuchMethod(Invocation.method(#abort, []), + returnValueForMissingStub: null); + @override + String getAllResponseHeaders() => + (super.noSuchMethod(Invocation.method(#getAllResponseHeaders, []), + returnValue: '') as String); + @override + String? getResponseHeader(String? name) => + (super.noSuchMethod(Invocation.method(#getResponseHeader, [name])) + as String?); + @override + void overrideMimeType(String? mime) => + super.noSuchMethod(Invocation.method(#overrideMimeType, [mime]), + returnValueForMissingStub: null); + @override + void send([dynamic body_OR_data]) => + super.noSuchMethod(Invocation.method(#send, [body_OR_data]), + returnValueForMissingStub: null); + @override + void setRequestHeader(String? name, String? value) => + super.noSuchMethod(Invocation.method(#setRequestHeader, [name, value]), + returnValueForMissingStub: null); + @override + void addEventListener(String? type, _i2.EventListener? listener, + [bool? useCapture]) => + super.noSuchMethod( + Invocation.method(#addEventListener, [type, listener, useCapture]), + returnValueForMissingStub: null); + @override + void removeEventListener(String? type, _i2.EventListener? listener, + [bool? useCapture]) => + super.noSuchMethod( + Invocation.method(#removeEventListener, [type, listener, useCapture]), + returnValueForMissingStub: null); + @override + bool dispatchEvent(_i2.Event? event) => + (super.noSuchMethod(Invocation.method(#dispatchEvent, [event]), + returnValue: false) as bool); +} + import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart'; import 'shims/dart_ui.dart' as ui; @@ -241,11 +1508,8 @@ class WebWebViewPlatformController implements WebViewPlatformController { final String contentType = httpReq.getResponseHeader('content-type') ?? 'text/html'; // ignore: unsafe_html - _element.src = Uri.dataFromString( - httpReq.responseText ?? '', - mimeType: contentType, - encoding: Encoding.getByName('utf-8'), - ).toString(); + _element.src = + 'data:$contentType,${Uri.encodeFull(httpReq.responseText ?? '')}'; } @override From 450b0f420ff8635c87b921b16bd97af36ddda131 Mon Sep 17 00:00:00 2001 From: FlafyDev Date: Thu, 26 May 2022 20:14:55 +0300 Subject: [PATCH 13/16] Revert "revert fix for flutter/flutter#104273" This reverts commit 6af1972c1ad05c890c6615e31844d12e95c43afe. The revert was bad. --- .../lib/webview_flutter_web.dart | 1276 +---------------- 1 file changed, 6 insertions(+), 1270 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart index 681500af29e6..21940cff51cd 100644 --- a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart +++ b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart @@ -11,1274 +11,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_web_plugins/flutter_web_plugins.dart'; import 'package:html/dom.dart' as dom; -import 'package:html/parser.dart';// Mocks generated by Mockito 5.2.0 from annotations -// in webview_flutter_web/test/webview_flutter_web_test.dart. -// Do not manually edit this file. - -import 'dart:async' as _i6; -import 'dart:html' as _i2; -import 'dart:math' as _i3; - -import 'package:flutter/foundation.dart' as _i5; -import 'package:flutter/widgets.dart' as _i4; -import 'package:mockito/mockito.dart' as _i1; -import 'package:webview_flutter_platform_interface/src/types/types.dart' as _i7; -import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart' - as _i8; -import 'package:webview_flutter_web/webview_flutter_web.dart' as _i9; - -// ignore_for_file: type=lint -// ignore_for_file: avoid_redundant_argument_values -// ignore_for_file: avoid_setters_without_getters -// ignore_for_file: comment_references -// ignore_for_file: implementation_imports -// ignore_for_file: invalid_use_of_visible_for_testing_member -// ignore_for_file: prefer_const_constructors -// ignore_for_file: unnecessary_parenthesis -// ignore_for_file: camel_case_types - -class _FakeCssClassSet_0 extends _i1.Fake implements _i2.CssClassSet {} - -class _FakeRectangle_1 extends _i1.Fake - implements _i3.Rectangle {} - -class _FakeCssRect_2 extends _i1.Fake implements _i2.CssRect {} - -class _FakePoint_3 extends _i1.Fake implements _i3.Point {} - -class _FakeElementEvents_4 extends _i1.Fake implements _i2.ElementEvents {} - -class _FakeCssStyleDeclaration_5 extends _i1.Fake - implements _i2.CssStyleDeclaration {} - -class _FakeElementStream_6 extends _i1.Fake - implements _i2.ElementStream {} - -class _FakeElementList_7 extends _i1.Fake - implements _i2.ElementList {} - -class _FakeScrollState_8 extends _i1.Fake implements _i2.ScrollState {} - -class _FakeAnimation_9 extends _i1.Fake implements _i2.Animation {} - -class _FakeElement_10 extends _i1.Fake implements _i2.Element {} - -class _FakeShadowRoot_11 extends _i1.Fake implements _i2.ShadowRoot {} - -class _FakeDocumentFragment_12 extends _i1.Fake - implements _i2.DocumentFragment {} - -class _FakeNode_13 extends _i1.Fake implements _i2.Node {} - -class _FakeWidget_14 extends _i1.Fake implements _i4.Widget { - @override - String toString({_i5.DiagnosticLevel? minLevel = _i5.DiagnosticLevel.info}) => - super.toString(); -} - -class _FakeInheritedWidget_15 extends _i1.Fake implements _i4.InheritedWidget { - @override - String toString({_i5.DiagnosticLevel? minLevel = _i5.DiagnosticLevel.info}) => - super.toString(); -} - -class _FakeDiagnosticsNode_16 extends _i1.Fake implements _i5.DiagnosticsNode { - @override - String toString( - {_i5.TextTreeConfiguration? parentConfiguration, - _i5.DiagnosticLevel? minLevel = _i5.DiagnosticLevel.info}) => - super.toString(); -} - -class _FakeHttpRequest_17 extends _i1.Fake implements _i2.HttpRequest {} - -class _FakeHttpRequestUpload_18 extends _i1.Fake - implements _i2.HttpRequestUpload {} - -class _FakeEvents_19 extends _i1.Fake implements _i2.Events {} - -/// A class which mocks [IFrameElement]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockIFrameElement extends _i1.Mock implements _i2.IFrameElement { - MockIFrameElement() { - _i1.throwOnMissingStub(this); - } - - @override - set allow(String? value) => - super.noSuchMethod(Invocation.setter(#allow, value), - returnValueForMissingStub: null); - @override - set allowFullscreen(bool? value) => - super.noSuchMethod(Invocation.setter(#allowFullscreen, value), - returnValueForMissingStub: null); - @override - set allowPaymentRequest(bool? value) => - super.noSuchMethod(Invocation.setter(#allowPaymentRequest, value), - returnValueForMissingStub: null); - @override - set csp(String? value) => super.noSuchMethod(Invocation.setter(#csp, value), - returnValueForMissingStub: null); - @override - set height(String? value) => - super.noSuchMethod(Invocation.setter(#height, value), - returnValueForMissingStub: null); - @override - set name(String? value) => super.noSuchMethod(Invocation.setter(#name, value), - returnValueForMissingStub: null); - @override - set referrerPolicy(String? value) => - super.noSuchMethod(Invocation.setter(#referrerPolicy, value), - returnValueForMissingStub: null); - @override - set src(String? value) => super.noSuchMethod(Invocation.setter(#src, value), - returnValueForMissingStub: null); - @override - set srcdoc(String? value) => - super.noSuchMethod(Invocation.setter(#srcdoc, value), - returnValueForMissingStub: null); - @override - set width(String? value) => - super.noSuchMethod(Invocation.setter(#width, value), - returnValueForMissingStub: null); - @override - set nonce(String? value) => - super.noSuchMethod(Invocation.setter(#nonce, value), - returnValueForMissingStub: null); - @override - Map get attributes => - (super.noSuchMethod(Invocation.getter(#attributes), - returnValue: {}) as Map); - @override - set attributes(Map? value) => - super.noSuchMethod(Invocation.setter(#attributes, value), - returnValueForMissingStub: null); - @override - List<_i2.Element> get children => - (super.noSuchMethod(Invocation.getter(#children), - returnValue: <_i2.Element>[]) as List<_i2.Element>); - @override - set children(List<_i2.Element>? value) => - super.noSuchMethod(Invocation.setter(#children, value), - returnValueForMissingStub: null); - @override - _i2.CssClassSet get classes => - (super.noSuchMethod(Invocation.getter(#classes), - returnValue: _FakeCssClassSet_0()) as _i2.CssClassSet); - @override - set classes(Iterable? value) => - super.noSuchMethod(Invocation.setter(#classes, value), - returnValueForMissingStub: null); - @override - Map get dataset => - (super.noSuchMethod(Invocation.getter(#dataset), - returnValue: {}) as Map); - @override - set dataset(Map? value) => - super.noSuchMethod(Invocation.setter(#dataset, value), - returnValueForMissingStub: null); - @override - _i3.Rectangle get client => - (super.noSuchMethod(Invocation.getter(#client), - returnValue: _FakeRectangle_1()) as _i3.Rectangle); - @override - _i3.Rectangle get offset => - (super.noSuchMethod(Invocation.getter(#offset), - returnValue: _FakeRectangle_1()) as _i3.Rectangle); - @override - String get localName => - (super.noSuchMethod(Invocation.getter(#localName), returnValue: '') - as String); - @override - _i2.CssRect get contentEdge => - (super.noSuchMethod(Invocation.getter(#contentEdge), - returnValue: _FakeCssRect_2()) as _i2.CssRect); - @override - _i2.CssRect get paddingEdge => - (super.noSuchMethod(Invocation.getter(#paddingEdge), - returnValue: _FakeCssRect_2()) as _i2.CssRect); - @override - _i2.CssRect get borderEdge => - (super.noSuchMethod(Invocation.getter(#borderEdge), - returnValue: _FakeCssRect_2()) as _i2.CssRect); - @override - _i2.CssRect get marginEdge => - (super.noSuchMethod(Invocation.getter(#marginEdge), - returnValue: _FakeCssRect_2()) as _i2.CssRect); - @override - _i3.Point get documentOffset => - (super.noSuchMethod(Invocation.getter(#documentOffset), - returnValue: _FakePoint_3()) as _i3.Point); - @override - set innerHtml(String? html) => - super.noSuchMethod(Invocation.setter(#innerHtml, html), - returnValueForMissingStub: null); - @override - String get innerText => - (super.noSuchMethod(Invocation.getter(#innerText), returnValue: '') - as String); - @override - set innerText(String? value) => - super.noSuchMethod(Invocation.setter(#innerText, value), - returnValueForMissingStub: null); - @override - _i2.ElementEvents get on => (super.noSuchMethod(Invocation.getter(#on), - returnValue: _FakeElementEvents_4()) as _i2.ElementEvents); - @override - int get offsetHeight => - (super.noSuchMethod(Invocation.getter(#offsetHeight), returnValue: 0) - as int); - @override - int get offsetLeft => - (super.noSuchMethod(Invocation.getter(#offsetLeft), returnValue: 0) - as int); - @override - int get offsetTop => - (super.noSuchMethod(Invocation.getter(#offsetTop), returnValue: 0) - as int); - @override - int get offsetWidth => - (super.noSuchMethod(Invocation.getter(#offsetWidth), returnValue: 0) - as int); - @override - int get scrollHeight => - (super.noSuchMethod(Invocation.getter(#scrollHeight), returnValue: 0) - as int); - @override - int get scrollLeft => - (super.noSuchMethod(Invocation.getter(#scrollLeft), returnValue: 0) - as int); - @override - set scrollLeft(int? value) => - super.noSuchMethod(Invocation.setter(#scrollLeft, value), - returnValueForMissingStub: null); - @override - int get scrollTop => - (super.noSuchMethod(Invocation.getter(#scrollTop), returnValue: 0) - as int); - @override - set scrollTop(int? value) => - super.noSuchMethod(Invocation.setter(#scrollTop, value), - returnValueForMissingStub: null); - @override - int get scrollWidth => - (super.noSuchMethod(Invocation.getter(#scrollWidth), returnValue: 0) - as int); - @override - String get contentEditable => - (super.noSuchMethod(Invocation.getter(#contentEditable), returnValue: '') - as String); - @override - set contentEditable(String? value) => - super.noSuchMethod(Invocation.setter(#contentEditable, value), - returnValueForMissingStub: null); - @override - set dir(String? value) => super.noSuchMethod(Invocation.setter(#dir, value), - returnValueForMissingStub: null); - @override - bool get draggable => - (super.noSuchMethod(Invocation.getter(#draggable), returnValue: false) - as bool); - @override - set draggable(bool? value) => - super.noSuchMethod(Invocation.setter(#draggable, value), - returnValueForMissingStub: null); - @override - bool get hidden => - (super.noSuchMethod(Invocation.getter(#hidden), returnValue: false) - as bool); - @override - set hidden(bool? value) => - super.noSuchMethod(Invocation.setter(#hidden, value), - returnValueForMissingStub: null); - @override - set inert(bool? value) => super.noSuchMethod(Invocation.setter(#inert, value), - returnValueForMissingStub: null); - @override - set inputMode(String? value) => - super.noSuchMethod(Invocation.setter(#inputMode, value), - returnValueForMissingStub: null); - @override - set lang(String? value) => super.noSuchMethod(Invocation.setter(#lang, value), - returnValueForMissingStub: null); - @override - set spellcheck(bool? value) => - super.noSuchMethod(Invocation.setter(#spellcheck, value), - returnValueForMissingStub: null); - @override - _i2.CssStyleDeclaration get style => (super.noSuchMethod( - Invocation.getter(#style), - returnValue: _FakeCssStyleDeclaration_5()) as _i2.CssStyleDeclaration); - @override - set tabIndex(int? value) => - super.noSuchMethod(Invocation.setter(#tabIndex, value), - returnValueForMissingStub: null); - @override - set title(String? value) => - super.noSuchMethod(Invocation.setter(#title, value), - returnValueForMissingStub: null); - @override - set translate(bool? value) => - super.noSuchMethod(Invocation.setter(#translate, value), - returnValueForMissingStub: null); - @override - String get className => - (super.noSuchMethod(Invocation.getter(#className), returnValue: '') - as String); - @override - set className(String? value) => - super.noSuchMethod(Invocation.setter(#className, value), - returnValueForMissingStub: null); - @override - int get clientHeight => - (super.noSuchMethod(Invocation.getter(#clientHeight), returnValue: 0) - as int); - @override - int get clientWidth => - (super.noSuchMethod(Invocation.getter(#clientWidth), returnValue: 0) - as int); - @override - String get id => - (super.noSuchMethod(Invocation.getter(#id), returnValue: '') as String); - @override - set id(String? value) => super.noSuchMethod(Invocation.setter(#id, value), - returnValueForMissingStub: null); - @override - set slot(String? value) => super.noSuchMethod(Invocation.setter(#slot, value), - returnValueForMissingStub: null); - @override - String get tagName => - (super.noSuchMethod(Invocation.getter(#tagName), returnValue: '') - as String); - @override - _i2.ElementStream<_i2.Event> get onAbort => - (super.noSuchMethod(Invocation.getter(#onAbort), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onBeforeCopy => - (super.noSuchMethod(Invocation.getter(#onBeforeCopy), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onBeforeCut => - (super.noSuchMethod(Invocation.getter(#onBeforeCut), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onBeforePaste => - (super.noSuchMethod(Invocation.getter(#onBeforePaste), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onBlur => - (super.noSuchMethod(Invocation.getter(#onBlur), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onCanPlay => - (super.noSuchMethod(Invocation.getter(#onCanPlay), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onCanPlayThrough => - (super.noSuchMethod(Invocation.getter(#onCanPlayThrough), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onChange => - (super.noSuchMethod(Invocation.getter(#onChange), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.MouseEvent> get onClick => - (super.noSuchMethod(Invocation.getter(#onClick), - returnValue: _FakeElementStream_6<_i2.MouseEvent>()) - as _i2.ElementStream<_i2.MouseEvent>); - @override - _i2.ElementStream<_i2.MouseEvent> get onContextMenu => - (super.noSuchMethod(Invocation.getter(#onContextMenu), - returnValue: _FakeElementStream_6<_i2.MouseEvent>()) - as _i2.ElementStream<_i2.MouseEvent>); - @override - _i2.ElementStream<_i2.ClipboardEvent> get onCopy => - (super.noSuchMethod(Invocation.getter(#onCopy), - returnValue: _FakeElementStream_6<_i2.ClipboardEvent>()) - as _i2.ElementStream<_i2.ClipboardEvent>); - @override - _i2.ElementStream<_i2.ClipboardEvent> get onCut => - (super.noSuchMethod(Invocation.getter(#onCut), - returnValue: _FakeElementStream_6<_i2.ClipboardEvent>()) - as _i2.ElementStream<_i2.ClipboardEvent>); - @override - _i2.ElementStream<_i2.Event> get onDoubleClick => - (super.noSuchMethod(Invocation.getter(#onDoubleClick), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.MouseEvent> get onDrag => - (super.noSuchMethod(Invocation.getter(#onDrag), - returnValue: _FakeElementStream_6<_i2.MouseEvent>()) - as _i2.ElementStream<_i2.MouseEvent>); - @override - _i2.ElementStream<_i2.MouseEvent> get onDragEnd => - (super.noSuchMethod(Invocation.getter(#onDragEnd), - returnValue: _FakeElementStream_6<_i2.MouseEvent>()) - as _i2.ElementStream<_i2.MouseEvent>); - @override - _i2.ElementStream<_i2.MouseEvent> get onDragEnter => - (super.noSuchMethod(Invocation.getter(#onDragEnter), - returnValue: _FakeElementStream_6<_i2.MouseEvent>()) - as _i2.ElementStream<_i2.MouseEvent>); - @override - _i2.ElementStream<_i2.MouseEvent> get onDragLeave => - (super.noSuchMethod(Invocation.getter(#onDragLeave), - returnValue: _FakeElementStream_6<_i2.MouseEvent>()) - as _i2.ElementStream<_i2.MouseEvent>); - @override - _i2.ElementStream<_i2.MouseEvent> get onDragOver => - (super.noSuchMethod(Invocation.getter(#onDragOver), - returnValue: _FakeElementStream_6<_i2.MouseEvent>()) - as _i2.ElementStream<_i2.MouseEvent>); - @override - _i2.ElementStream<_i2.MouseEvent> get onDragStart => - (super.noSuchMethod(Invocation.getter(#onDragStart), - returnValue: _FakeElementStream_6<_i2.MouseEvent>()) - as _i2.ElementStream<_i2.MouseEvent>); - @override - _i2.ElementStream<_i2.MouseEvent> get onDrop => - (super.noSuchMethod(Invocation.getter(#onDrop), - returnValue: _FakeElementStream_6<_i2.MouseEvent>()) - as _i2.ElementStream<_i2.MouseEvent>); - @override - _i2.ElementStream<_i2.Event> get onDurationChange => - (super.noSuchMethod(Invocation.getter(#onDurationChange), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onEmptied => - (super.noSuchMethod(Invocation.getter(#onEmptied), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onEnded => - (super.noSuchMethod(Invocation.getter(#onEnded), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onError => - (super.noSuchMethod(Invocation.getter(#onError), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onFocus => - (super.noSuchMethod(Invocation.getter(#onFocus), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onInput => - (super.noSuchMethod(Invocation.getter(#onInput), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onInvalid => - (super.noSuchMethod(Invocation.getter(#onInvalid), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.KeyboardEvent> get onKeyDown => - (super.noSuchMethod(Invocation.getter(#onKeyDown), - returnValue: _FakeElementStream_6<_i2.KeyboardEvent>()) - as _i2.ElementStream<_i2.KeyboardEvent>); - @override - _i2.ElementStream<_i2.KeyboardEvent> get onKeyPress => - (super.noSuchMethod(Invocation.getter(#onKeyPress), - returnValue: _FakeElementStream_6<_i2.KeyboardEvent>()) - as _i2.ElementStream<_i2.KeyboardEvent>); - @override - _i2.ElementStream<_i2.KeyboardEvent> get onKeyUp => - (super.noSuchMethod(Invocation.getter(#onKeyUp), - returnValue: _FakeElementStream_6<_i2.KeyboardEvent>()) - as _i2.ElementStream<_i2.KeyboardEvent>); - @override - _i2.ElementStream<_i2.Event> get onLoad => - (super.noSuchMethod(Invocation.getter(#onLoad), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onLoadedData => - (super.noSuchMethod(Invocation.getter(#onLoadedData), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onLoadedMetadata => - (super.noSuchMethod(Invocation.getter(#onLoadedMetadata), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.MouseEvent> get onMouseDown => - (super.noSuchMethod(Invocation.getter(#onMouseDown), - returnValue: _FakeElementStream_6<_i2.MouseEvent>()) - as _i2.ElementStream<_i2.MouseEvent>); - @override - _i2.ElementStream<_i2.MouseEvent> get onMouseEnter => - (super.noSuchMethod(Invocation.getter(#onMouseEnter), - returnValue: _FakeElementStream_6<_i2.MouseEvent>()) - as _i2.ElementStream<_i2.MouseEvent>); - @override - _i2.ElementStream<_i2.MouseEvent> get onMouseLeave => - (super.noSuchMethod(Invocation.getter(#onMouseLeave), - returnValue: _FakeElementStream_6<_i2.MouseEvent>()) - as _i2.ElementStream<_i2.MouseEvent>); - @override - _i2.ElementStream<_i2.MouseEvent> get onMouseMove => - (super.noSuchMethod(Invocation.getter(#onMouseMove), - returnValue: _FakeElementStream_6<_i2.MouseEvent>()) - as _i2.ElementStream<_i2.MouseEvent>); - @override - _i2.ElementStream<_i2.MouseEvent> get onMouseOut => - (super.noSuchMethod(Invocation.getter(#onMouseOut), - returnValue: _FakeElementStream_6<_i2.MouseEvent>()) - as _i2.ElementStream<_i2.MouseEvent>); - @override - _i2.ElementStream<_i2.MouseEvent> get onMouseOver => - (super.noSuchMethod(Invocation.getter(#onMouseOver), - returnValue: _FakeElementStream_6<_i2.MouseEvent>()) - as _i2.ElementStream<_i2.MouseEvent>); - @override - _i2.ElementStream<_i2.MouseEvent> get onMouseUp => - (super.noSuchMethod(Invocation.getter(#onMouseUp), - returnValue: _FakeElementStream_6<_i2.MouseEvent>()) - as _i2.ElementStream<_i2.MouseEvent>); - @override - _i2.ElementStream<_i2.WheelEvent> get onMouseWheel => - (super.noSuchMethod(Invocation.getter(#onMouseWheel), - returnValue: _FakeElementStream_6<_i2.WheelEvent>()) - as _i2.ElementStream<_i2.WheelEvent>); - @override - _i2.ElementStream<_i2.ClipboardEvent> get onPaste => - (super.noSuchMethod(Invocation.getter(#onPaste), - returnValue: _FakeElementStream_6<_i2.ClipboardEvent>()) - as _i2.ElementStream<_i2.ClipboardEvent>); - @override - _i2.ElementStream<_i2.Event> get onPause => - (super.noSuchMethod(Invocation.getter(#onPause), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onPlay => - (super.noSuchMethod(Invocation.getter(#onPlay), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onPlaying => - (super.noSuchMethod(Invocation.getter(#onPlaying), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onRateChange => - (super.noSuchMethod(Invocation.getter(#onRateChange), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onReset => - (super.noSuchMethod(Invocation.getter(#onReset), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onResize => - (super.noSuchMethod(Invocation.getter(#onResize), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onScroll => - (super.noSuchMethod(Invocation.getter(#onScroll), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onSearch => - (super.noSuchMethod(Invocation.getter(#onSearch), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onSeeked => - (super.noSuchMethod(Invocation.getter(#onSeeked), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onSeeking => - (super.noSuchMethod(Invocation.getter(#onSeeking), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onSelect => - (super.noSuchMethod(Invocation.getter(#onSelect), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onSelectStart => - (super.noSuchMethod(Invocation.getter(#onSelectStart), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onStalled => - (super.noSuchMethod(Invocation.getter(#onStalled), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onSubmit => - (super.noSuchMethod(Invocation.getter(#onSubmit), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onSuspend => - (super.noSuchMethod(Invocation.getter(#onSuspend), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onTimeUpdate => - (super.noSuchMethod(Invocation.getter(#onTimeUpdate), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.TouchEvent> get onTouchCancel => - (super.noSuchMethod(Invocation.getter(#onTouchCancel), - returnValue: _FakeElementStream_6<_i2.TouchEvent>()) - as _i2.ElementStream<_i2.TouchEvent>); - @override - _i2.ElementStream<_i2.TouchEvent> get onTouchEnd => - (super.noSuchMethod(Invocation.getter(#onTouchEnd), - returnValue: _FakeElementStream_6<_i2.TouchEvent>()) - as _i2.ElementStream<_i2.TouchEvent>); - @override - _i2.ElementStream<_i2.TouchEvent> get onTouchEnter => - (super.noSuchMethod(Invocation.getter(#onTouchEnter), - returnValue: _FakeElementStream_6<_i2.TouchEvent>()) - as _i2.ElementStream<_i2.TouchEvent>); - @override - _i2.ElementStream<_i2.TouchEvent> get onTouchLeave => - (super.noSuchMethod(Invocation.getter(#onTouchLeave), - returnValue: _FakeElementStream_6<_i2.TouchEvent>()) - as _i2.ElementStream<_i2.TouchEvent>); - @override - _i2.ElementStream<_i2.TouchEvent> get onTouchMove => - (super.noSuchMethod(Invocation.getter(#onTouchMove), - returnValue: _FakeElementStream_6<_i2.TouchEvent>()) - as _i2.ElementStream<_i2.TouchEvent>); - @override - _i2.ElementStream<_i2.TouchEvent> get onTouchStart => - (super.noSuchMethod(Invocation.getter(#onTouchStart), - returnValue: _FakeElementStream_6<_i2.TouchEvent>()) - as _i2.ElementStream<_i2.TouchEvent>); - @override - _i2.ElementStream<_i2.TransitionEvent> get onTransitionEnd => - (super.noSuchMethod(Invocation.getter(#onTransitionEnd), - returnValue: _FakeElementStream_6<_i2.TransitionEvent>()) - as _i2.ElementStream<_i2.TransitionEvent>); - @override - _i2.ElementStream<_i2.Event> get onVolumeChange => - (super.noSuchMethod(Invocation.getter(#onVolumeChange), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onWaiting => - (super.noSuchMethod(Invocation.getter(#onWaiting), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onFullscreenChange => - (super.noSuchMethod(Invocation.getter(#onFullscreenChange), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.Event> get onFullscreenError => - (super.noSuchMethod(Invocation.getter(#onFullscreenError), - returnValue: _FakeElementStream_6<_i2.Event>()) - as _i2.ElementStream<_i2.Event>); - @override - _i2.ElementStream<_i2.WheelEvent> get onWheel => - (super.noSuchMethod(Invocation.getter(#onWheel), - returnValue: _FakeElementStream_6<_i2.WheelEvent>()) - as _i2.ElementStream<_i2.WheelEvent>); - @override - List<_i2.Node> get nodes => - (super.noSuchMethod(Invocation.getter(#nodes), returnValue: <_i2.Node>[]) - as List<_i2.Node>); - @override - set nodes(Iterable<_i2.Node>? value) => - super.noSuchMethod(Invocation.setter(#nodes, value), - returnValueForMissingStub: null); - @override - List<_i2.Node> get childNodes => - (super.noSuchMethod(Invocation.getter(#childNodes), - returnValue: <_i2.Node>[]) as List<_i2.Node>); - @override - int get nodeType => - (super.noSuchMethod(Invocation.getter(#nodeType), returnValue: 0) as int); - @override - set text(String? value) => super.noSuchMethod(Invocation.setter(#text, value), - returnValueForMissingStub: null); - @override - String? getAttribute(String? name) => - (super.noSuchMethod(Invocation.method(#getAttribute, [name])) as String?); - @override - String? getAttributeNS(String? namespaceURI, String? name) => - (super.noSuchMethod( - Invocation.method(#getAttributeNS, [namespaceURI, name])) as String?); - @override - bool hasAttribute(String? name) => - (super.noSuchMethod(Invocation.method(#hasAttribute, [name]), - returnValue: false) as bool); - @override - bool hasAttributeNS(String? namespaceURI, String? name) => (super - .noSuchMethod(Invocation.method(#hasAttributeNS, [namespaceURI, name]), - returnValue: false) as bool); - @override - void removeAttribute(String? name) => - super.noSuchMethod(Invocation.method(#removeAttribute, [name]), - returnValueForMissingStub: null); - @override - void removeAttributeNS(String? namespaceURI, String? name) => super - .noSuchMethod(Invocation.method(#removeAttributeNS, [namespaceURI, name]), - returnValueForMissingStub: null); - @override - void setAttribute(String? name, Object? value) => - super.noSuchMethod(Invocation.method(#setAttribute, [name, value]), - returnValueForMissingStub: null); - @override - void setAttributeNS(String? namespaceURI, String? name, Object? value) => - super.noSuchMethod( - Invocation.method(#setAttributeNS, [namespaceURI, name, value]), - returnValueForMissingStub: null); - @override - _i2.ElementList querySelectorAll( - String? selectors) => - (super.noSuchMethod(Invocation.method(#querySelectorAll, [selectors]), - returnValue: _FakeElementList_7()) as _i2.ElementList); - @override - _i6.Future<_i2.ScrollState> setApplyScroll(String? nativeScrollBehavior) => - (super.noSuchMethod( - Invocation.method(#setApplyScroll, [nativeScrollBehavior]), - returnValue: Future<_i2.ScrollState>.value(_FakeScrollState_8())) - as _i6.Future<_i2.ScrollState>); - @override - _i6.Future<_i2.ScrollState> setDistributeScroll( - String? nativeScrollBehavior) => - (super.noSuchMethod( - Invocation.method(#setDistributeScroll, [nativeScrollBehavior]), - returnValue: Future<_i2.ScrollState>.value(_FakeScrollState_8())) - as _i6.Future<_i2.ScrollState>); - @override - Map getNamespacedAttributes(String? namespace) => (super - .noSuchMethod(Invocation.method(#getNamespacedAttributes, [namespace]), - returnValue: {}) as Map); - @override - _i2.CssStyleDeclaration getComputedStyle([String? pseudoElement]) => - (super.noSuchMethod(Invocation.method(#getComputedStyle, [pseudoElement]), - returnValue: _FakeCssStyleDeclaration_5()) - as _i2.CssStyleDeclaration); - @override - void appendText(String? text) => - super.noSuchMethod(Invocation.method(#appendText, [text]), - returnValueForMissingStub: null); - @override - void appendHtml(String? text, - {_i2.NodeValidator? validator, - _i2.NodeTreeSanitizer? treeSanitizer}) => - super.noSuchMethod( - Invocation.method(#appendHtml, [text], - {#validator: validator, #treeSanitizer: treeSanitizer}), - returnValueForMissingStub: null); - @override - void attached() => super.noSuchMethod(Invocation.method(#attached, []), - returnValueForMissingStub: null); - @override - void detached() => super.noSuchMethod(Invocation.method(#detached, []), - returnValueForMissingStub: null); - @override - void enteredView() => super.noSuchMethod(Invocation.method(#enteredView, []), - returnValueForMissingStub: null); - @override - List<_i3.Rectangle> getClientRects() => - (super.noSuchMethod(Invocation.method(#getClientRects, []), - returnValue: <_i3.Rectangle>[]) as List<_i3.Rectangle>); - @override - void leftView() => super.noSuchMethod(Invocation.method(#leftView, []), - returnValueForMissingStub: null); - @override - _i2.Animation animate(Iterable>? frames, - [dynamic timing]) => - (super.noSuchMethod(Invocation.method(#animate, [frames, timing]), - returnValue: _FakeAnimation_9()) as _i2.Animation); - @override - void attributeChanged(String? name, String? oldValue, String? newValue) => - super.noSuchMethod( - Invocation.method(#attributeChanged, [name, oldValue, newValue]), - returnValueForMissingStub: null); - @override - void scrollIntoView([_i2.ScrollAlignment? alignment]) => - super.noSuchMethod(Invocation.method(#scrollIntoView, [alignment]), - returnValueForMissingStub: null); - @override - void insertAdjacentText(String? where, String? text) => - super.noSuchMethod(Invocation.method(#insertAdjacentText, [where, text]), - returnValueForMissingStub: null); - @override - void insertAdjacentHtml(String? where, String? html, - {_i2.NodeValidator? validator, - _i2.NodeTreeSanitizer? treeSanitizer}) => - super.noSuchMethod( - Invocation.method(#insertAdjacentHtml, [where, html], - {#validator: validator, #treeSanitizer: treeSanitizer}), - returnValueForMissingStub: null); - @override - _i2.Element insertAdjacentElement(String? where, _i2.Element? element) => - (super.noSuchMethod( - Invocation.method(#insertAdjacentElement, [where, element]), - returnValue: _FakeElement_10()) as _i2.Element); - @override - bool matches(String? selectors) => - (super.noSuchMethod(Invocation.method(#matches, [selectors]), - returnValue: false) as bool); - @override - bool matchesWithAncestors(String? selectors) => - (super.noSuchMethod(Invocation.method(#matchesWithAncestors, [selectors]), - returnValue: false) as bool); - @override - _i2.ShadowRoot createShadowRoot() => - (super.noSuchMethod(Invocation.method(#createShadowRoot, []), - returnValue: _FakeShadowRoot_11()) as _i2.ShadowRoot); - @override - _i3.Point offsetTo(_i2.Element? parent) => - (super.noSuchMethod(Invocation.method(#offsetTo, [parent]), - returnValue: _FakePoint_3()) as _i3.Point); - @override - _i2.DocumentFragment createFragment(String? html, - {_i2.NodeValidator? validator, - _i2.NodeTreeSanitizer? treeSanitizer}) => - (super.noSuchMethod( - Invocation.method(#createFragment, [html], - {#validator: validator, #treeSanitizer: treeSanitizer}), - returnValue: _FakeDocumentFragment_12()) as _i2.DocumentFragment); - @override - void setInnerHtml(String? html, - {_i2.NodeValidator? validator, - _i2.NodeTreeSanitizer? treeSanitizer}) => - super.noSuchMethod( - Invocation.method(#setInnerHtml, [html], - {#validator: validator, #treeSanitizer: treeSanitizer}), - returnValueForMissingStub: null); - @override - void blur() => super.noSuchMethod(Invocation.method(#blur, []), - returnValueForMissingStub: null); - @override - void click() => super.noSuchMethod(Invocation.method(#click, []), - returnValueForMissingStub: null); - @override - void focus() => super.noSuchMethod(Invocation.method(#focus, []), - returnValueForMissingStub: null); - @override - _i2.ShadowRoot attachShadow(Map? shadowRootInitDict) => - (super.noSuchMethod( - Invocation.method(#attachShadow, [shadowRootInitDict]), - returnValue: _FakeShadowRoot_11()) as _i2.ShadowRoot); - @override - _i2.Element? closest(String? selectors) => - (super.noSuchMethod(Invocation.method(#closest, [selectors])) - as _i2.Element?); - @override - List<_i2.Animation> getAnimations() => - (super.noSuchMethod(Invocation.method(#getAnimations, []), - returnValue: <_i2.Animation>[]) as List<_i2.Animation>); - @override - List getAttributeNames() => - (super.noSuchMethod(Invocation.method(#getAttributeNames, []), - returnValue: []) as List); - @override - _i3.Rectangle getBoundingClientRect() => - (super.noSuchMethod(Invocation.method(#getBoundingClientRect, []), - returnValue: _FakeRectangle_1()) as _i3.Rectangle); - @override - List<_i2.Node> getDestinationInsertionPoints() => - (super.noSuchMethod(Invocation.method(#getDestinationInsertionPoints, []), - returnValue: <_i2.Node>[]) as List<_i2.Node>); - @override - List<_i2.Node> getElementsByClassName(String? classNames) => (super - .noSuchMethod(Invocation.method(#getElementsByClassName, [classNames]), - returnValue: <_i2.Node>[]) as List<_i2.Node>); - @override - bool hasPointerCapture(int? pointerId) => - (super.noSuchMethod(Invocation.method(#hasPointerCapture, [pointerId]), - returnValue: false) as bool); - @override - void releasePointerCapture(int? pointerId) => - super.noSuchMethod(Invocation.method(#releasePointerCapture, [pointerId]), - returnValueForMissingStub: null); - @override - void requestPointerLock() => - super.noSuchMethod(Invocation.method(#requestPointerLock, []), - returnValueForMissingStub: null); - @override - void scroll([dynamic options_OR_x, num? y]) => - super.noSuchMethod(Invocation.method(#scroll, [options_OR_x, y]), - returnValueForMissingStub: null); - @override - void scrollBy([dynamic options_OR_x, num? y]) => - super.noSuchMethod(Invocation.method(#scrollBy, [options_OR_x, y]), - returnValueForMissingStub: null); - @override - void scrollTo([dynamic options_OR_x, num? y]) => - super.noSuchMethod(Invocation.method(#scrollTo, [options_OR_x, y]), - returnValueForMissingStub: null); - @override - void setPointerCapture(int? pointerId) => - super.noSuchMethod(Invocation.method(#setPointerCapture, [pointerId]), - returnValueForMissingStub: null); - @override - void requestFullscreen() => - super.noSuchMethod(Invocation.method(#requestFullscreen, []), - returnValueForMissingStub: null); - @override - void after(Object? nodes) => - super.noSuchMethod(Invocation.method(#after, [nodes]), - returnValueForMissingStub: null); - @override - void before(Object? nodes) => - super.noSuchMethod(Invocation.method(#before, [nodes]), - returnValueForMissingStub: null); - @override - _i2.Element? querySelector(String? selectors) => - (super.noSuchMethod(Invocation.method(#querySelector, [selectors])) - as _i2.Element?); - @override - void remove() => super.noSuchMethod(Invocation.method(#remove, []), - returnValueForMissingStub: null); - @override - _i2.Node replaceWith(_i2.Node? otherNode) => - (super.noSuchMethod(Invocation.method(#replaceWith, [otherNode]), - returnValue: _FakeNode_13()) as _i2.Node); - @override - void insertAllBefore(Iterable<_i2.Node>? newNodes, _i2.Node? child) => - super.noSuchMethod(Invocation.method(#insertAllBefore, [newNodes, child]), - returnValueForMissingStub: null); - @override - _i2.Node append(_i2.Node? node) => - (super.noSuchMethod(Invocation.method(#append, [node]), - returnValue: _FakeNode_13()) as _i2.Node); - @override - _i2.Node clone(bool? deep) => - (super.noSuchMethod(Invocation.method(#clone, [deep]), - returnValue: _FakeNode_13()) as _i2.Node); - @override - bool contains(_i2.Node? other) => - (super.noSuchMethod(Invocation.method(#contains, [other]), - returnValue: false) as bool); - @override - _i2.Node getRootNode([Map? options]) => - (super.noSuchMethod(Invocation.method(#getRootNode, [options]), - returnValue: _FakeNode_13()) as _i2.Node); - @override - bool hasChildNodes() => - (super.noSuchMethod(Invocation.method(#hasChildNodes, []), - returnValue: false) as bool); - @override - _i2.Node insertBefore(_i2.Node? node, _i2.Node? child) => - (super.noSuchMethod(Invocation.method(#insertBefore, [node, child]), - returnValue: _FakeNode_13()) as _i2.Node); - @override - void addEventListener(String? type, _i2.EventListener? listener, - [bool? useCapture]) => - super.noSuchMethod( - Invocation.method(#addEventListener, [type, listener, useCapture]), - returnValueForMissingStub: null); - @override - void removeEventListener(String? type, _i2.EventListener? listener, - [bool? useCapture]) => - super.noSuchMethod( - Invocation.method(#removeEventListener, [type, listener, useCapture]), - returnValueForMissingStub: null); - @override - bool dispatchEvent(_i2.Event? event) => - (super.noSuchMethod(Invocation.method(#dispatchEvent, [event]), - returnValue: false) as bool); -} - -/// A class which mocks [BuildContext]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockBuildContext extends _i1.Mock implements _i4.BuildContext { - MockBuildContext() { - _i1.throwOnMissingStub(this); - } - - @override - _i4.Widget get widget => (super.noSuchMethod(Invocation.getter(#widget), - returnValue: _FakeWidget_14()) as _i4.Widget); - @override - bool get debugDoingBuild => (super - .noSuchMethod(Invocation.getter(#debugDoingBuild), returnValue: false) - as bool); - @override - _i4.InheritedWidget dependOnInheritedElement(_i4.InheritedElement? ancestor, - {Object? aspect}) => - (super.noSuchMethod( - Invocation.method( - #dependOnInheritedElement, [ancestor], {#aspect: aspect}), - returnValue: _FakeInheritedWidget_15()) as _i4.InheritedWidget); - @override - void visitAncestorElements(bool Function(_i4.Element)? visitor) => - super.noSuchMethod(Invocation.method(#visitAncestorElements, [visitor]), - returnValueForMissingStub: null); - @override - void visitChildElements(_i4.ElementVisitor? visitor) => - super.noSuchMethod(Invocation.method(#visitChildElements, [visitor]), - returnValueForMissingStub: null); - @override - _i5.DiagnosticsNode describeElement(String? name, - {_i5.DiagnosticsTreeStyle? style = - _i5.DiagnosticsTreeStyle.errorProperty}) => - (super.noSuchMethod( - Invocation.method(#describeElement, [name], {#style: style}), - returnValue: _FakeDiagnosticsNode_16()) as _i5.DiagnosticsNode); - @override - _i5.DiagnosticsNode describeWidget(String? name, - {_i5.DiagnosticsTreeStyle? style = - _i5.DiagnosticsTreeStyle.errorProperty}) => - (super.noSuchMethod( - Invocation.method(#describeWidget, [name], {#style: style}), - returnValue: _FakeDiagnosticsNode_16()) as _i5.DiagnosticsNode); - @override - List<_i5.DiagnosticsNode> describeMissingAncestor( - {Type? expectedAncestorType}) => - (super.noSuchMethod( - Invocation.method(#describeMissingAncestor, [], - {#expectedAncestorType: expectedAncestorType}), - returnValue: <_i5.DiagnosticsNode>[]) as List<_i5.DiagnosticsNode>); - @override - _i5.DiagnosticsNode describeOwnershipChain(String? name) => - (super.noSuchMethod(Invocation.method(#describeOwnershipChain, [name]), - returnValue: _FakeDiagnosticsNode_16()) as _i5.DiagnosticsNode); -} - -/// A class which mocks [CreationParams]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockCreationParams extends _i1.Mock implements _i7.CreationParams { - MockCreationParams() { - _i1.throwOnMissingStub(this); - } - - @override - Set get javascriptChannelNames => - (super.noSuchMethod(Invocation.getter(#javascriptChannelNames), - returnValue: {}) as Set); - @override - _i7.AutoMediaPlaybackPolicy get autoMediaPlaybackPolicy => - (super.noSuchMethod(Invocation.getter(#autoMediaPlaybackPolicy), - returnValue: _i7.AutoMediaPlaybackPolicy - .require_user_action_for_all_media_types) - as _i7.AutoMediaPlaybackPolicy); - @override - List<_i7.WebViewCookie> get cookies => - (super.noSuchMethod(Invocation.getter(#cookies), - returnValue: <_i7.WebViewCookie>[]) as List<_i7.WebViewCookie>); -} - -/// A class which mocks [WebViewPlatformCallbacksHandler]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockWebViewPlatformCallbacksHandler extends _i1.Mock - implements _i8.WebViewPlatformCallbacksHandler { - MockWebViewPlatformCallbacksHandler() { - _i1.throwOnMissingStub(this); - } - - @override - _i6.FutureOr onNavigationRequest({String? url, bool? isForMainFrame}) => - (super.noSuchMethod( - Invocation.method(#onNavigationRequest, [], - {#url: url, #isForMainFrame: isForMainFrame}), - returnValue: Future.value(false)) as _i6.FutureOr); - @override - void onPageStarted(String? url) => - super.noSuchMethod(Invocation.method(#onPageStarted, [url]), - returnValueForMissingStub: null); - @override - void onPageFinished(String? url) => - super.noSuchMethod(Invocation.method(#onPageFinished, [url]), - returnValueForMissingStub: null); - @override - void onProgress(int? progress) => - super.noSuchMethod(Invocation.method(#onProgress, [progress]), - returnValueForMissingStub: null); - @override - void onWebResourceError(_i7.WebResourceError? error) => - super.noSuchMethod(Invocation.method(#onWebResourceError, [error]), - returnValueForMissingStub: null); -} - -/// A class which mocks [HttpRequestFactory]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockHttpRequestFactory extends _i1.Mock - implements _i9.HttpRequestFactory { - MockHttpRequestFactory() { - _i1.throwOnMissingStub(this); - } - - @override - _i6.Future<_i2.HttpRequest> request(String? url, - {String? method, - bool? withCredentials, - String? responseType, - String? mimeType, - Map? requestHeaders, - dynamic sendData, - void Function(_i2.ProgressEvent)? onProgress}) => - (super.noSuchMethod( - Invocation.method(#request, [ - url - ], { - #method: method, - #withCredentials: withCredentials, - #responseType: responseType, - #mimeType: mimeType, - #requestHeaders: requestHeaders, - #sendData: sendData, - #onProgress: onProgress - }), - returnValue: Future<_i2.HttpRequest>.value(_FakeHttpRequest_17())) - as _i6.Future<_i2.HttpRequest>); -} - -/// A class which mocks [HttpRequest]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockHttpRequest extends _i1.Mock implements _i2.HttpRequest { - MockHttpRequest() { - _i1.throwOnMissingStub(this); - } - - @override - Map get responseHeaders => - (super.noSuchMethod(Invocation.getter(#responseHeaders), - returnValue: {}) as Map); - @override - int get readyState => - (super.noSuchMethod(Invocation.getter(#readyState), returnValue: 0) - as int); - @override - String get responseType => - (super.noSuchMethod(Invocation.getter(#responseType), returnValue: '') - as String); - @override - set responseType(String? value) => - super.noSuchMethod(Invocation.setter(#responseType, value), - returnValueForMissingStub: null); - @override - set timeout(int? value) => - super.noSuchMethod(Invocation.setter(#timeout, value), - returnValueForMissingStub: null); - @override - _i2.HttpRequestUpload get upload => - (super.noSuchMethod(Invocation.getter(#upload), - returnValue: _FakeHttpRequestUpload_18()) as _i2.HttpRequestUpload); - @override - set withCredentials(bool? value) => - super.noSuchMethod(Invocation.setter(#withCredentials, value), - returnValueForMissingStub: null); - @override - _i6.Stream<_i2.Event> get onReadyStateChange => - (super.noSuchMethod(Invocation.getter(#onReadyStateChange), - returnValue: Stream<_i2.Event>.empty()) as _i6.Stream<_i2.Event>); - @override - _i6.Stream<_i2.ProgressEvent> get onAbort => - (super.noSuchMethod(Invocation.getter(#onAbort), - returnValue: Stream<_i2.ProgressEvent>.empty()) - as _i6.Stream<_i2.ProgressEvent>); - @override - _i6.Stream<_i2.ProgressEvent> get onError => - (super.noSuchMethod(Invocation.getter(#onError), - returnValue: Stream<_i2.ProgressEvent>.empty()) - as _i6.Stream<_i2.ProgressEvent>); - @override - _i6.Stream<_i2.ProgressEvent> get onLoad => - (super.noSuchMethod(Invocation.getter(#onLoad), - returnValue: Stream<_i2.ProgressEvent>.empty()) - as _i6.Stream<_i2.ProgressEvent>); - @override - _i6.Stream<_i2.ProgressEvent> get onLoadEnd => - (super.noSuchMethod(Invocation.getter(#onLoadEnd), - returnValue: Stream<_i2.ProgressEvent>.empty()) - as _i6.Stream<_i2.ProgressEvent>); - @override - _i6.Stream<_i2.ProgressEvent> get onLoadStart => - (super.noSuchMethod(Invocation.getter(#onLoadStart), - returnValue: Stream<_i2.ProgressEvent>.empty()) - as _i6.Stream<_i2.ProgressEvent>); - @override - _i6.Stream<_i2.ProgressEvent> get onProgress => - (super.noSuchMethod(Invocation.getter(#onProgress), - returnValue: Stream<_i2.ProgressEvent>.empty()) - as _i6.Stream<_i2.ProgressEvent>); - @override - _i6.Stream<_i2.ProgressEvent> get onTimeout => - (super.noSuchMethod(Invocation.getter(#onTimeout), - returnValue: Stream<_i2.ProgressEvent>.empty()) - as _i6.Stream<_i2.ProgressEvent>); - @override - _i2.Events get on => - (super.noSuchMethod(Invocation.getter(#on), returnValue: _FakeEvents_19()) - as _i2.Events); - @override - void open(String? method, String? url, - {bool? async, String? user, String? password}) => - super.noSuchMethod( - Invocation.method(#open, [method, url], - {#async: async, #user: user, #password: password}), - returnValueForMissingStub: null); - @override - void abort() => super.noSuchMethod(Invocation.method(#abort, []), - returnValueForMissingStub: null); - @override - String getAllResponseHeaders() => - (super.noSuchMethod(Invocation.method(#getAllResponseHeaders, []), - returnValue: '') as String); - @override - String? getResponseHeader(String? name) => - (super.noSuchMethod(Invocation.method(#getResponseHeader, [name])) - as String?); - @override - void overrideMimeType(String? mime) => - super.noSuchMethod(Invocation.method(#overrideMimeType, [mime]), - returnValueForMissingStub: null); - @override - void send([dynamic body_OR_data]) => - super.noSuchMethod(Invocation.method(#send, [body_OR_data]), - returnValueForMissingStub: null); - @override - void setRequestHeader(String? name, String? value) => - super.noSuchMethod(Invocation.method(#setRequestHeader, [name, value]), - returnValueForMissingStub: null); - @override - void addEventListener(String? type, _i2.EventListener? listener, - [bool? useCapture]) => - super.noSuchMethod( - Invocation.method(#addEventListener, [type, listener, useCapture]), - returnValueForMissingStub: null); - @override - void removeEventListener(String? type, _i2.EventListener? listener, - [bool? useCapture]) => - super.noSuchMethod( - Invocation.method(#removeEventListener, [type, listener, useCapture]), - returnValueForMissingStub: null); - @override - bool dispatchEvent(_i2.Event? event) => - (super.noSuchMethod(Invocation.method(#dispatchEvent, [event]), - returnValue: false) as bool); -} - +import 'package:html/parser.dart'; import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart'; import 'shims/dart_ui.dart' as ui; @@ -1508,8 +241,11 @@ class WebWebViewPlatformController implements WebViewPlatformController { final String contentType = httpReq.getResponseHeader('content-type') ?? 'text/html'; // ignore: unsafe_html - _element.src = - 'data:$contentType,${Uri.encodeFull(httpReq.responseText ?? '')}'; + _element.src = Uri.dataFromString( + httpReq.responseText ?? '', + mimeType: contentType, + encoding: Encoding.getByName('utf-8'), + ).toString(); } @override From cf4de8db8e922ad101a911b28596e588dc71e915 Mon Sep 17 00:00:00 2001 From: FlafyDev Date: Thu, 26 May 2022 20:19:49 +0300 Subject: [PATCH 14/16] revert fix for flutter/flutter#104273 --- .../webview_flutter_test.dart | 27 ------------------- .../lib/webview_flutter_web.dart | 7 ++--- 2 files changed, 2 insertions(+), 32 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_web/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_web/example/integration_test/webview_flutter_test.dart index 94c2797ce98f..20e4429038b6 100644 --- a/packages/webview_flutter/webview_flutter_web/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_web/example/integration_test/webview_flutter_test.dart @@ -71,33 +71,6 @@ void main() { expect(element!.src, secondaryUrl); }); - testWidgets('loadHtml', (WidgetTester tester) async { - final Completer controllerCompleter = - Completer(); - await tester.pumpWidget( - Directionality( - textDirection: TextDirection.ltr, - child: WebView( - key: GlobalKey(), - onWebViewCreated: (WebViewController controller) { - controllerCompleter.complete(controller); - }, - ), - ), - ); - final WebViewController controller = await controllerCompleter.future; - await controller.loadHtmlString('
Te#st
'); - - // Assert an iframe has been rendered to the DOM with the correct src attribute. - final html.IFrameElement? element = - html.document.querySelector('iframe') as html.IFrameElement?; - expect(element, isNotNull); - expect( - element!.srcdoc, - '
Te#st
'); - }); - testWidgets('JavascriptChannel', (WidgetTester tester) async { final Completer controllerCompleter = Completer(); diff --git a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart index 21940cff51cd..fac23511e31e 100644 --- a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart +++ b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart @@ -241,11 +241,8 @@ class WebWebViewPlatformController implements WebViewPlatformController { final String contentType = httpReq.getResponseHeader('content-type') ?? 'text/html'; // ignore: unsafe_html - _element.src = Uri.dataFromString( - httpReq.responseText ?? '', - mimeType: contentType, - encoding: Encoding.getByName('utf-8'), - ).toString(); + _element.src = + 'data:$contentType,${Uri.encodeFull(httpReq.responseText ?? '')}'; } @override From 99dad9aa8a2370d5626985e7b4cfa5f2f4d14f51 Mon Sep 17 00:00:00 2001 From: FlafyDev Date: Thu, 26 May 2022 20:26:50 +0300 Subject: [PATCH 15/16] modify test to use srcdoc instead of src --- .../webview_flutter_web/test/webview_flutter_web_test.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/webview_flutter/webview_flutter_web/test/webview_flutter_web_test.dart b/packages/webview_flutter/webview_flutter_web/test/webview_flutter_web_test.dart index 6058dcf07272..72337ec3cb26 100644 --- a/packages/webview_flutter/webview_flutter_web/test/webview_flutter_web_test.dart +++ b/packages/webview_flutter/webview_flutter_web/test/webview_flutter_web_test.dart @@ -64,7 +64,8 @@ void main() { // Run controller.loadHtmlString('test html'); // Verify - verify(mockElement.src = 'data:text/html,${Uri.encodeFull('test html')}'); + verify(mockElement.srcdoc = + 'test html'); }); group('loadRequest', () { From a69e837140cb2746ef56753585fa6be06c11815d Mon Sep 17 00:00:00 2001 From: FlafyDev Date: Thu, 26 May 2022 21:19:40 +0300 Subject: [PATCH 16/16] remove unused import --- .../webview_flutter_web/lib/webview_flutter_web.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart index fac23511e31e..c803639f06ed 100644 --- a/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart +++ b/packages/webview_flutter/webview_flutter_web/lib/webview_flutter_web.dart @@ -3,7 +3,6 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:convert'; import 'dart:html'; import 'dart:js' as js; import 'package:flutter/foundation.dart';