-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[google_maps_flutter_web] Migrate to package:web #5254
[google_maps_flutter_web] Migrate to package:web #5254
Conversation
treeSanitizer: NodeTreeSanitizer.trusted, | ||
); | ||
container.children.add(snippet); | ||
..innerHTML = sanitizeHtml(markerSnippet); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no NodeSanitizer
anymore, not sure of the implications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the "safe" way to solve this now is to :
Then define a setter for HTMLElement
that lets us set the innerHTML
property with a TrustedHTML
instance, rather than the current Node
or HTMLElement
type.
The sanitizeHtml
method could be the implementation of the Trusted Type policy, as described in the MDN example:
const escapeHTMLPolicy = trustedTypes.createPolicy("flutter-sanitize-maps", {
createHTML: (String html) => sanitizeHtml(html), // Returns an instance of TrustedHTML
});
let el = document.getElementById("myDiv");
const escaped = escapeHTMLPolicy.createHTML(markerSnippet);
el.safeInnerHTML = escaped; // safeInnerHTML only accepts TrustedHTML objects.
(The above is a js-ification of what we need to do in Dart though :P)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The support for TrustedHTML
is a bit lacking though, neither Safari nor Firefox support it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neither Safari nor Firefox support it.
The stance until very recently was that they'd never will support it, but that's what the unsafe_html
lint is actually looking at 😱
There's progress of the dart-google-maps package migration, here: |
I've updated the branch to use the new beta version of Edit: Still have to help the web compiler out a little, still have JS type violations to fix. |
The Logs
Some CI tasks still fail because of a version problem with
The new |
15acde3
to
e6e5d5a
Compare
e6e5d5a
to
15acde3
Compare
@@ -20,6 +20,9 @@ class MyApp extends StatefulWidget { | |||
class _MyAppState extends State<MyApp> { | |||
@override | |||
Widget build(BuildContext context) { | |||
return const Text('Testing... Look at the console output for results!'); | |||
return const Directionality( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I accidentally ran the example app once directly (using flutter run -d chrome
) and it did throw an error about a missing Directionality widget
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine, the skeleton app is only used to have a Flutter context where things run, but IIRC this particular test does not render a map or anything.
I have three failing integration tests, which all relate to the bitmap of the test Tile. Not sure what the resolution is? (this refactor should not have affected the loading of the bitmap)
|
We have a thread in discord about the test failures here: |
@ditman The test failure was resolved on my end. Turns out you were right about JS converting stuff to strings, as mentioned in dart-lang/web#91 (comment) See 44e4335 for that fix. |
packages/google_maps_flutter/google_maps_flutter_web/lib/src/convert.dart
Outdated
Show resolved
Hide resolved
@navaronbracke thanks for keeping this PR fresh, if you don't mind I may be able to push stuff to this branch to fix the annoying bits of CI? |
Feel free to do so, I'll give it some attention regarding your review comments as well. |
packages/google_maps_flutter/google_maps_flutter_web/lib/src/convert.dart
Outdated
Show resolved
Hide resolved
@ditman What version bump should this be for |
packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml
Outdated
Show resolved
Hide resolved
@kevmoo With Could you look into landing dart-lang/web@975e55c officially as 0.5.1 ? |
@navaronbracke – you can always just add your own extensions or helpers, too. Copy-paste here is fine. |
I'm aware of that, I did this for the nullable TrustedTypes in this PR. However, the |
92b404c
to
1951a6a
Compare
This seems to work fine, and I can't find anything else to say! Let's land this! Thanks for your patience @navaronbracke! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go!
This comment was marked as outdated.
This comment was marked as outdated.
packages/google_maps_flutter/google_maps_flutter_web/lib/src/map_styler.dart
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter_web/lib/src/map_styler.dart
Show resolved
Hide resolved
flutter/packages@353086c...6d02f03 2024-02-28 [email protected] Manual roll Flutter from c30f998 to d00bfe8 (32 revisions) (flutter/packages#6222) 2024-02-28 [email protected] [google_maps_flutter] Add `style` to widget (flutter/packages#6192) 2024-02-28 [email protected] Add library annotations for js interop (flutter/packages#6216) 2024-02-28 [email protected] [google_map_flutter] Add style to widget - platform impls (flutter/packages#6205) 2024-02-28 [email protected] [google_maps_flutter_web] Migrate to package:web (flutter/packages#5254) 2024-02-28 [email protected] [pigeon] Remove heap allocation in generated C++ code (flutter/packages#6196) 2024-02-27 [email protected] [pigeon] Allows kotlin generator to skip error class generation (flutter/packages#6183) 2024-02-27 [email protected] [camerax] Implements `setExposureMode` (flutter/packages#6110) 2024-02-27 [email protected] Roll Flutter from b77560e to c30f998 (12 revisions) (flutter/packages#6211) 2024-02-26 [email protected] Add `InkResponse`, `Material` and fix `Opacity` (flutter/packages#6199) 2024-02-26 [email protected] [url_launcher] Add explicit imports of UIKit (flutter/packages#6208) 2024-02-26 [email protected] [pigeon] Fix tool hangs on verbose sub-processes (flutter/packages#6198) 2024-02-26 [email protected] [tool] Ignore GeneratedPluginRegistrant.swift for `format` (flutter/packages#6195) 2024-02-26 [email protected] Roll Flutter from 1e8dd1e to b77560e (8 revisions) (flutter/packages#6207) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This PR migrates `google_maps_flutter_web` from `dart:html` to `package:web`. The `google_maps` package does provide a beta version with support for `package:web`, which is currently what this PR is depending on. Before landing this change, we should change the dependency to the stable release version of that package. Fixes flutter/flutter#137374 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* N/A
This PR migrates `google_maps_flutter_web` from `dart:html` to `package:web`. The `google_maps` package does provide a beta version with support for `package:web`, which is currently what this PR is depending on. Before landing this change, we should change the dependency to the stable release version of that package. Fixes flutter/flutter#137374 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* N/A
This PR migrates
google_maps_flutter_web
fromdart:html
topackage:web
.The
google_maps
package does provide a beta version with support forpackage:web
, which is currently what this PR is depending on. Before landing this change, we should change the dependency to the stable release version of that package.Fixes flutter/flutter#137374
If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
N/A
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.