ReviewOS

also looking at this

craft-native/craft

fix(android): an apostrophe in a reply hangs the page forever

#156
Merged glennmichael123 wants to merge fix/android-js-escaping into main
4 files +279 -73
packages/zig/build.zigmodified+45-0
Changes to packages/zig/build.zig
@@ -505,6 +505,49 @@ pub fn build(b: *std.Build) void {
505505 });
506506 const run_android_bridge_tests = b.addRunArtifact(android_bridge_tests);
507507
508 // The reply channel's escaping, across every Kotlin template.
509 //
510 // Every template is imported, not just the four that talk to the WebView
511 // today, so a file starting to emit JavaScript is already covered.
512 //
513 // The list is hand-written. Generating it by reading the directory here was
514 // tried and removed: `zig build` caches this script's evaluation against its
515 // own contents, so the generated list did not change when a template was
516 // added — the completeness check passed by reading a stale list, which is
517 // the exact failure it existed to prevent.
518 const android_escaping_tests = b.addTest(.{
519 .root_module = b.createModule(.{
520 .root_source_file = b.path("test/android_reply_escaping_test.zig"),
521 .target = target,
522 .optimize = optimize,
523 }),
524 });
525 android_escaping_tests.root_module.addAnonymousImport("CraftBridge.kt.template", .{
526 .root_source_file = b.path("../android/templates/CraftBridge.kt.template"),
527 });
528 android_escaping_tests.root_module.addAnonymousImport("CraftBridgeExtensions.kt.template", .{
529 .root_source_file = b.path("../android/templates/CraftBridgeExtensions.kt.template"),
530 });
531 android_escaping_tests.root_module.addAnonymousImport("CraftHealthConnect.kt.template", .{
532 .root_source_file = b.path("../android/templates/CraftHealthConnect.kt.template"),
533 });
534 android_escaping_tests.root_module.addAnonymousImport("CraftHealthConnectStub.kt.template", .{
535 .root_source_file = b.path("../android/templates/CraftHealthConnectStub.kt.template"),
536 });
537 android_escaping_tests.root_module.addAnonymousImport("CraftNative.kt.template", .{
538 .root_source_file = b.path("../android/templates/CraftNative.kt.template"),
539 });
540 android_escaping_tests.root_module.addAnonymousImport("CraftWidgetProvider.kt.template", .{
541 .root_source_file = b.path("../android/templates/CraftWidgetProvider.kt.template"),
542 });
543 android_escaping_tests.root_module.addAnonymousImport("LocationRecordingService.kt.template", .{
544 .root_source_file = b.path("../android/templates/LocationRecordingService.kt.template"),
545 });
546 android_escaping_tests.root_module.addAnonymousImport("MainActivity.kt.template", .{
547 .root_source_file = b.path("../android/templates/MainActivity.kt.template"),
548 });
549 const run_android_escaping_tests = b.addRunArtifact(android_escaping_tests);
550
508551 ios_conformance_tests.root_module.addAnonymousImport("CraftApp.swift", .{
509552 .root_source_file = b.path("../ios/templates/CraftApp.swift"),
510553 });
@@ -1648,6 +1691,7 @@ pub fn build(b: *std.Build) void {
16481691 test_step.dependOn(&run_bridge_surface_tests.step);
16491692 test_step.dependOn(&run_android_conformance_tests.step);
16501693 test_step.dependOn(&run_android_bridge_tests.step);
1694 test_step.dependOn(&run_android_escaping_tests.step);
16511695 test_step.dependOn(&run_menubar_tests.step);
16521696 test_step.dependOn(&run_components_tests.step);
16531697 test_step.dependOn(&run_gpu_tests.step);
@@ -2377,6 +2421,7 @@ pub fn build(b: *std.Build) void {
23772421 test_android_step.dependOn(&run_bridge_surface_tests.step);
23782422 test_android_step.dependOn(&run_android_conformance_tests.step);
23792423 test_android_step.dependOn(&run_android_bridge_tests.step);
2424 test_android_step.dependOn(&run_android_escaping_tests.step);
23802425
23812426 // Add Android tests to the main test step
23822427 test_step.dependOn(&run_android_tests.step);