[tool][web] Makes flutter.js more G3 friendly. (#120504)

* Allow any JS file in flutter loader.

* Nag only if service worker API is completely unavailable.

* Add info about Secure Contexts if that may be the reason why serviceworker is not available.

* Update sanity test.

* If service worker settings are null, do not even check if the API is available.
This commit is contained in:
David Iglesias
2023-02-21 12:51:37 -08:00
committed by GitHub
parent 06ccf55454
commit a463bb82c4
2 changed files with 14 additions and 4 deletions

View File

@@ -881,6 +881,8 @@ void main() {
flutter_js.generateFlutterJsFile(fileGeneratorsPath);
expect(flutterJsContents, contains('"use strict";'));
expect(flutterJsContents, contains('main.dart.js'));
expect(flutterJsContents, contains('if (!("serviceWorker" in navigator))'));
expect(flutterJsContents, contains(r'/\.js$/,'));
expect(flutterJsContents, contains('flutter_service_worker.js?v='));
expect(flutterJsContents, contains('document.createElement("script")'));
expect(flutterJsContents, contains('"application/javascript"'));