[google_maps_flutter] Refactor the JavaScript interaction and verify integration tests - #1066
Conversation
370807c to
39802fe
Compare
There was a problem hiding this comment.
Code Review
This pull request refactors the JavaScript interaction layer of the google_maps_flutter_tizen plugin by introducing a GoogleMapsJsBridge to replace direct WebViewController calls. The review feedback highlights a critical serialization issue in the bridge where arguments are directly interpolated, potentially causing runtime crashes and security vulnerabilities. To resolve this, the reviewer suggests introducing a JsExpression class to handle raw JS code and properly encoding other arguments. Additionally, the feedback recommends marking MapsJsEvent as sealed for exhaustiveness, utilizing the new bridge.addListener abstraction across controllers instead of executing raw JavaScript, and wrapping JS references in JsExpression to prevent them from being treated as string literals.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
JSUYA
left a comment
There was a problem hiding this comment.
Please review gemini's review and modify the code.
I will update the review and the code after merging #1071. |
…dListener consistently Address Gemini Code Assist review on PR flutter-tizen#1066. - Fix a critical bug where callMethod/setProperty interpolated arguments via List.toString(), so a plain String like a marker title was spliced into the JS snippet unquoted (e.g. ['My Title'] instead of ["My Title"]), breaking at runtime for any string containing whitespace or special characters and risking JS injection. Add JsExpression to mark raw JS code that must not be quoted, and JSON-encode plain String arguments so they're safely treated as string literals. - Wrap the few call sites that relied on the old unquoted behavior (setMap's 'map' JS-global reference, setPosition's LatLng constructor, setPixelOffset's GSize object literal) in JsExpression so they keep working under the new serialization. - Mark MapsJsEvent sealed so the exhaustive switch in GoogleMapsController._onJsEvent is statically checked when new event types are added. - Use the bridge.addListener abstraction in polyline/circle/polygon/ ground_overlay instead of hand-built runJavaScript strings, for consistency with the rest of the bridge.
39802fe to
174d20a
Compare
… based on upstream v2.17.0
…dListener consistently Address Gemini Code Assist review on PR flutter-tizen#1066. - Fix a critical bug where callMethod/setProperty interpolated arguments via List.toString(), so a plain String like a marker title was spliced into the JS snippet unquoted (e.g. ['My Title'] instead of ["My Title"]), breaking at runtime for any string containing whitespace or special characters and risking JS injection. Add JsExpression to mark raw JS code that must not be quoted, and JSON-encode plain String arguments so they're safely treated as string literals. - Wrap the few call sites that relied on the old unquoted behavior (setMap's 'map' JS-global reference, setPosition's LatLng constructor, setPixelOffset's GSize object literal) in JsExpression so they keep working under the new serialization. - Mark MapsJsEvent sealed so the exhaustive switch in GoogleMapsController._onJsEvent is statically checked when new event types are added. - Use the bridge.addListener abstraction in polyline/circle/polygon/ ground_overlay instead of hand-built runJavaScript strings, for consistency with the rest of the bridge.
…JsEvent Follow-up to 8b9c3079: GInfoWindowOptions.toString() still spliced the info window content string directly into the JS snippet unquoted, the same unsafe-serialization issue fixed elsewhere in that commit. Also mark MessageJsEvent sealed, matching MapsJsEvent, so exhaustive switches over its subclasses stay statically checked.
174d20a to
c04ae3a
Compare
c04ae3a to
e8d9e43
Compare
GoogleMapsJsBridge, replacing directWebViewControllercalls.webview_flutterto ^4.13.1 andwebview_flutter_lweto ^0.5.3.