Visual Studio Code, rebuilt in Rust
Rust
feat(webview): host webviews on Linux in WebKitGTK
rokartur1e28a4d536ba
diff --git a/README.md b/README.mdindex 680bb428e54..590c7ca2c69 100644--- a/README.md+++ b/README.md@@ -45,7 +45,7 @@ Left out on purpose: AI features, Microsoft services, telemetry, remote and tunn[Releases](https://github.com/rokartur/vsrustium/releases):- macOS: `darwin-arm64` for Apple silicon, `darwin-x64` for Intel. Signed, notarized, updates itself.-- Linux: `linux-x64` and `linux-arm64` archives (`.tar.gz`, glibc 2.39 or newer: Ubuntu 24.04, Debian 13). A preview: no webviews, secrets kept in memory only, no self-update, the rest in the "M23 Linux" rows of [port/ledger.md](port/ledger.md).+- Linux: `linux-x64` and `linux-arm64` archives (`.tar.gz`, glibc 2.39 or newer: Ubuntu 24.04, Debian 13). A preview: webviews in X11 sessions only (WebKitGTK 4.1), no self-update, the rest in the "M23 Linux" rows of [port/ledger.md](port/ledger.md).## Licensediff --git a/native/Cargo.lock b/native/Cargo.lockindex 45a815efe21..7b1e6329197 100644--- a/native/Cargo.lock+++ b/native/Cargo.lock@@ -159,7 +159,7 @@ version = "0.25.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "46319972e74179d707445f64aaa2893bbf6a111de3a9af29b7eb382f8b39e282"dependencies = [- "base64",+ "base64 0.22.1","bitflags 2.13.2","home","libc",@@ -229,7 +229,8 @@ version = "0.1.0"dependencies = ["alacritty_terminal","anyhow",- "base64",+ "async-openssl",+ "base64 0.22.1","block2 0.6.2","chrono","config",@@ -238,8 +239,10 @@ dependencies = ["exthost","files","futures",+ "gdkx11","gpui","gpui_platform",+ "gtk","icu_collator","icu_locale_core","icu_normalizer",@@ -251,8 +254,10 @@ dependencies = ["objc2-foundation 0.3.2","objc2-web-kit","onig",+ "openssl","pulldown-cmark","raw-window-handle",+ "rcgen","regex","search","security-framework",@@ -264,7 +269,9 @@ dependencies = ["textmate","ttf-parser","url",+ "webkit2gtk","wuff",+ "x11","zbus 5.19.0",]@@ -339,6 +346,45 @@ dependencies = ["zbus 5.19.0",]+[[package]]+name = "asn1-rs"+version = "0.7.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b7f43a50ac4fdca5df8e885c21b835997f0a1cdee65494a6847694a98652d9d8"+dependencies = [+ "asn1-rs-derive",+ "asn1-rs-impl",+ "displaydoc",+ "nom 7.1.3",+ "num-traits",+ "rusticata-macros",+ "thiserror 2.0.21",+ "time",+]++[[package]]+name = "asn1-rs-derive"+version = "0.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3109e49b1e4909e9db6515a30c633684d68cdeaa252f215214cb4fa1a5bfee2c"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+ "synstructure 0.13.2",+]++[[package]]+name = "asn1-rs-impl"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]+[[package]]name = "async-broadcast"version = "0.7.2"@@ -440,6 +486,17 @@ dependencies = ["futures-lite",]+[[package]]+name = "async-openssl"+version = "0.2.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c821d5c5787337c6e6328bc21f7564238e543bc1387cfa84b2199336ea407031"+dependencies = [+ "futures-io",+ "openssl",+ "openssl-sys",+]+[[package]]name = "async-process"version = "2.5.0"@@ -504,6 +561,29 @@ dependencies = ["syn 3.0.10",]+[[package]]+name = "atk"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "241b621213072e993be4f6f3a9e4b45f65b7e6faad43001be957184b7bb1824b"+dependencies = [+ "atk-sys",+ "glib",+ "libc",+]++[[package]]+name = "atk-sys"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c5e48b684b0ca77d2bbadeef17424c2ea3c897d44d566a1617e7e8f30614d086"+dependencies = [+ "glib-sys",+ "gobject-sys",+ "libc",+ "system-deps",+]+[[package]]name = "atomic"version = "0.5.3"@@ -623,6 +703,12 @@ version = "0.22.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"+[[package]]+name = "base64"+version = "0.23.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5"+[[package]]name = "base64ct"version = "1.8.3"@@ -678,6 +764,9 @@ name = "bit-vec"version = "0.9.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51"+dependencies = [+ "serde",+][[package]]name = "bit_field"@@ -842,6 +931,31 @@ dependencies = ["libbz2-rs-sys",]+[[package]]+name = "cairo-rs"+version = "0.18.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8ca26ef0159422fb77631dc9d17b102f253b876fe1586b03b803e63a309b4ee2"+dependencies = [+ "bitflags 2.13.2",+ "cairo-sys-rs",+ "glib",+ "libc",+ "once_cell",+ "thiserror 1.0.69",+]++[[package]]+name = "cairo-sys-rs"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "685c9fa8e590b8b3d678873528d83411db17242a73fccaed827770ea0fedda51"+dependencies = [+ "glib-sys",+ "libc",+ "system-deps",+]+[[package]]name = "calloop"version = "0.14.5"@@ -914,6 +1028,16 @@ dependencies = ["nom 7.1.3",]+[[package]]+name = "cfg-expr"+version = "0.15.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02"+dependencies = [+ "smallvec",+ "target-lexicon",+]+[[package]]name = "cfg-if"version = "1.0.5"@@ -982,7 +1106,7 @@ dependencies = ["cocoa-foundation","core-foundation","core-graphics",- "foreign-types",+ "foreign-types 0.5.0","libc","objc",]@@ -1140,7 +1264,7 @@ dependencies = ["bitflags 2.13.2","core-foundation","core-graphics-types",- "foreign-types",+ "foreign-types 0.5.0","libc",]@@ -1176,7 +1300,7 @@ checksum = "a593227b66cbd4007b2a050dfdd9e1d1318311409c8d600dc82ba1b15ca9c130"dependencies = ["core-foundation","core-graphics",- "foreign-types",+ "foreign-types 0.5.0","libc",]@@ -1344,6 +1468,12 @@ dependencies = ["syn 2.0.119",]+[[package]]+name = "data-encoding"+version = "2.11.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06"+[[package]]name = "data-url"version = "0.3.2"@@ -1360,6 +1490,20 @@ dependencies = ["zeroize",]+[[package]]+name = "der-parser"+version = "10.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "07da5016415d5a3c4dd39b11ed26f915f52fc4e0dc197d87908bc916e51bc1a6"+dependencies = [+ "asn1-rs",+ "displaydoc",+ "nom 7.1.3",+ "num-bigint",+ "num-traits",+ "rusticata-macros",+]+[[package]]name = "deranged"version = "0.5.9"@@ -1713,7 +1857,7 @@ version = "0.1.0"dependencies = ["anyhow","async-lock",- "base64",+ "base64 0.22.1","block2 0.6.2","config","ed25519-dalek",@@ -1775,6 +1919,16 @@ version = "0.2.9"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d"+[[package]]+name = "field-offset"+version = "0.3.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f"+dependencies = [+ "memoffset",+ "rustc_version",+]+[[package]]name = "filedescriptor"version = "0.8.3"@@ -1911,6 +2065,15 @@ dependencies = ["ttf-parser",]+[[package]]+name = "foreign-types"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"+dependencies = [+ "foreign-types-shared 0.1.1",+]+[[package]]name = "foreign-types"version = "0.5.0"@@ -1918,7 +2081,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965"dependencies = ["foreign-types-macros",- "foreign-types-shared",+ "foreign-types-shared 0.3.1",][[package]]@@ -1932,6 +2095,12 @@ dependencies = ["syn 3.0.10",]+[[package]]+name = "foreign-types-shared"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"+[[package]]name = "foreign-types-shared"version = "0.3.1"@@ -2072,6 +2241,91 @@ dependencies = ["slab",]+[[package]]+name = "gdk"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d9f245958c627ac99d8e529166f9823fb3b838d1d41fd2b297af3075093c2691"+dependencies = [+ "cairo-rs",+ "gdk-pixbuf",+ "gdk-sys",+ "gio",+ "glib",+ "libc",+ "pango",+]++[[package]]+name = "gdk-pixbuf"+version = "0.18.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "50e1f5f1b0bfb830d6ccc8066d18db35c487b1b2b1e8589b5dfe9f07e8defaec"+dependencies = [+ "gdk-pixbuf-sys",+ "gio",+ "glib",+ "libc",+ "once_cell",+]++[[package]]+name = "gdk-pixbuf-sys"+version = "0.18.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3f9839ea644ed9c97a34d129ad56d38a25e6756f99f3a88e15cd39c20629caf7"+dependencies = [+ "gio-sys",+ "glib-sys",+ "gobject-sys",+ "libc",+ "system-deps",+]++[[package]]+name = "gdk-sys"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5c2d13f38594ac1e66619e188c6d5a1adb98d11b2fcf7894fc416ad76aa2f3f7"+dependencies = [+ "cairo-sys-rs",+ "gdk-pixbuf-sys",+ "gio-sys",+ "glib-sys",+ "gobject-sys",+ "libc",+ "pango-sys",+ "pkg-config",+ "system-deps",+]++[[package]]+name = "gdkx11"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3caa00e14351bebbc8183b3c36690327eb77c49abc2268dd4bd36b856db3fbfe"+dependencies = [+ "gdk",+ "gdkx11-sys",+ "gio",+ "glib",+ "libc",+ "x11",+]++[[package]]+name = "gdkx11-sys"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6e2e7445fe01ac26f11601db260dd8608fe172514eb63b3b5e261ea6b0f4428d"+dependencies = [+ "gdk-sys",+ "glib-sys",+ "libc",+ "system-deps",+ "x11",+]+[[package]]name = "generic-array"version = "0.14.7"@@ -2146,6 +2400,38 @@ version = "0.34.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "1033caf0b349c518623b5396bfb2cf0bddf44f0306d543a250e5743297aafd10"+[[package]]+name = "gio"+version = "0.18.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d4fc8f532f87b79cbc51a79748f16a6828fb784be93145a322fa14d06d354c73"+dependencies = [+ "futures-channel",+ "futures-core",+ "futures-io",+ "futures-util",+ "gio-sys",+ "glib",+ "libc",+ "once_cell",+ "pin-project-lite",+ "smallvec",+ "thiserror 1.0.69",+]++[[package]]+name = "gio-sys"+version = "0.18.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "37566df850baf5e4cb0dfb78af2e4b9898d817ed9263d1090a2df958c64737d2"+dependencies = [+ "glib-sys",+ "gobject-sys",+ "libc",+ "system-deps",+ "winapi",+]+[[package]]name = "gl_generator"version = "0.14.0"@@ -2157,6 +2443,53 @@ dependencies = ["xml-rs",]+[[package]]+name = "glib"+version = "0.18.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "233daaf6e83ae6a12a52055f568f9d7cf4671dabb78ff9560ab6da230ce00ee5"+dependencies = [+ "bitflags 2.13.2",+ "futures-channel",+ "futures-core",+ "futures-executor",+ "futures-task",+ "futures-util",+ "gio-sys",+ "glib-macros",+ "glib-sys",+ "gobject-sys",+ "libc",+ "memchr",+ "once_cell",+ "smallvec",+ "thiserror 1.0.69",+]++[[package]]+name = "glib-macros"+version = "0.18.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0bb0228f477c0900c880fd78c8759b95c7636dbd7842707f49e132378aa2acdc"+dependencies = [+ "heck 0.4.1",+ "proc-macro-crate 2.0.0",+ "proc-macro-error",+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "glib-sys"+version = "0.18.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "063ce2eb6a8d0ea93d2bf8ba1957e78dbab6be1c2220dd3daca57d5a9d869898"+dependencies = [+ "libc",+ "system-deps",+]+[[package]]name = "glob"version = "0.3.4"@@ -2184,6 +2517,17 @@ dependencies = ["gl_generator",]+[[package]]+name = "gobject-sys"+version = "0.18.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0850127b514d1c4a4654ead6dedadb18198999985908e6ffe4436f53c785ce44"+dependencies = [+ "glib-sys",+ "libc",+ "system-deps",+]+[[package]]name = "gpu-allocator"version = "0.28.0"@@ -2300,7 +2644,7 @@ dependencies = ["core-video","derive_more","etagere",- "foreign-types",+ "foreign-types 0.5.0","gpui","image","log",@@ -2374,7 +2718,7 @@ dependencies = ["core-text","ctor","dispatch2",- "foreign-types",+ "foreign-types 0.5.0","futures","gpui","gpui_apple",@@ -2523,6 +2867,58 @@ dependencies = ["windows-registry",]+[[package]]+name = "gtk"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fd56fb197bfc42bd5d2751f4f017d44ff59fbb58140c6b49f9b3b2bdab08506a"+dependencies = [+ "atk",+ "cairo-rs",+ "field-offset",+ "futures-channel",+ "gdk",+ "gdk-pixbuf",+ "gio",+ "glib",+ "gtk-sys",+ "gtk3-macros",+ "libc",+ "pango",+ "pkg-config",+]++[[package]]+name = "gtk-sys"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8f29a1c21c59553eb7dd40e918be54dccd60c52b049b75119d5d96ce6b624414"+dependencies = [+ "atk-sys",+ "cairo-sys-rs",+ "gdk-pixbuf-sys",+ "gdk-sys",+ "gio-sys",+ "glib-sys",+ "gobject-sys",+ "libc",+ "pango-sys",+ "system-deps",+]++[[package]]+name = "gtk3-macros"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "52ff3c5b21f14f0736fed6dcfc0bfb4225ebf5725f3c0209edeec181e4d73e9d"+dependencies = [+ "proc-macro-crate 1.3.1",+ "proc-macro-error",+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]+[[package]]name = "half"version = "2.7.1"@@ -3083,6 +3479,29 @@ version = "1.0.19"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4"+[[package]]+name = "javascriptcore-rs"+version = "1.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ca5671e9ffce8ffba57afc24070e906da7fc4b1ba66f2cabebf61bf2ea257fcc"+dependencies = [+ "bitflags 1.3.2",+ "glib",+ "javascriptcore-rs-sys",+]++[[package]]+name = "javascriptcore-rs-sys"+version = "1.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "af1be78d14ffa4b75b66df31840478fef72b51f8c2465d4ca7c194da9f7a5124"+dependencies = [+ "glib-sys",+ "gobject-sys",+ "libc",+ "system-deps",+]+[[package]]name = "jiff"version = "1.0.3"@@ -3502,7 +3921,7 @@ dependencies = ["bitflags 2.13.2","block","core-graphics-types",- "foreign-types",+ "foreign-types 0.5.0","log","objc","paste",@@ -4071,6 +4490,15 @@ dependencies = ["memchr",]+[[package]]+name = "oid-registry"+version = "0.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "12f40cff3dde1b6087cc5d5f5d4d65712f34016a03ed60e9c08dcc392736b5b7"+dependencies = [+ "asn1-rs",+]+[[package]]name = "once_cell"version = "1.21.4"@@ -4144,6 +4572,43 @@ dependencies = ["libc",]+[[package]]+name = "openssl"+version = "0.10.82"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4de8111e94a56adca7ebfe6c365b6d42f99deb69b74b6becacd4204e2f193aa2"+dependencies = [+ "bitflags 2.13.2",+ "cfg-if",+ "foreign-types 0.3.2",+ "libc",+ "openssl-macros",+ "openssl-sys",+]++[[package]]+name = "openssl-macros"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "openssl-sys"+version = "0.9.118"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "19c413d6ec9ebaf5e1c829d355cb3e9f783778d700f135be0921d52fce3c60ae"+dependencies = [+ "cc",+ "libc",+ "pkg-config",+ "vcpkg",+]+[[package]]name = "option-ext"version = "0.2.0"@@ -4169,6 +4634,31 @@ dependencies = ["pin-project-lite",]+[[package]]+name = "pango"+version = "0.18.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7ca27ec1eb0457ab26f3036ea52229edbdb74dee1edd29063f5b9b010e7ebee4"+dependencies = [+ "gio",+ "glib",+ "libc",+ "once_cell",+ "pango-sys",+]++[[package]]+name = "pango-sys"+version = "0.18.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "436737e391a843e5933d6d9aa102cb126d501e815b83601365a948a518555dc5"+dependencies = [+ "glib-sys",+ "gobject-sys",+ "libc",+ "system-deps",+]+[[package]]name = "parking"version = "2.2.1"@@ -4239,6 +4729,16 @@ dependencies = ["hmac",]+[[package]]+name = "pem"+version = "4.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d354a98a3d1251555de99e8fdd8afda05573c31b82f59063a7b0a29b5527f120"+dependencies = [+ "base64 0.23.1",+ "serde_core",+]+[[package]]name = "percent-encoding"version = "2.3.2"@@ -4500,6 +5000,25 @@ dependencies = ["syn 2.0.119",]+[[package]]+name = "proc-macro-crate"+version = "1.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919"+dependencies = [+ "once_cell",+ "toml_edit 0.19.15",+]++[[package]]+name = "proc-macro-crate"+version = "2.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8"+dependencies = [+ "toml_edit 0.20.7",+]+[[package]]name = "proc-macro-crate"version = "3.5.0"@@ -4509,6 +5028,30 @@ dependencies = ["toml_edit 0.25.20+spec-1.1.0",]+[[package]]+name = "proc-macro-error"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"+dependencies = [+ "proc-macro-error-attr",+ "proc-macro2",+ "quote",+ "syn 1.0.109",+ "version_check",+]++[[package]]+name = "proc-macro-error-attr"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"+dependencies = [+ "proc-macro2",+ "quote",+ "version_check",+]+[[package]]name = "proc-macro2"version = "1.0.107"@@ -4789,6 +5332,20 @@ dependencies = ["crossbeam-utils",]+[[package]]+name = "rcgen"+version = "0.14.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8774e05a7d0de114588e6a28fe7e71694b82614ed569d86d8b389dfbc98b8ad8"+dependencies = [+ "pem",+ "ring",+ "rustls-pki-types",+ "time",+ "x509-parser",+ "yasna",+]+[[package]]name = "read-fonts"version = "0.37.0"@@ -4919,6 +5476,20 @@ dependencies = ["bytemuck",]+[[package]]+name = "ring"+version = "0.17.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"+dependencies = [+ "cc",+ "cfg-if",+ "getrandom 0.2.17",+ "libc",+ "untrusted",+ "windows-sys 0.52.0",+]+[[package]]name = "roxmltree"version = "0.20.0"@@ -4975,6 +5546,15 @@ dependencies = ["semver",]+[[package]]+name = "rusticata-macros"+version = "4.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632"+dependencies = [+ "nom 7.1.3",+]+[[package]]name = "rustix"version = "1.1.6"@@ -4999,6 +5579,15 @@ dependencies = ["rustix",]+[[package]]+name = "rustls-pki-types"+version = "1.16.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "102f35f7de7b06d8c61f1cff6592f5253e0dea431c74867aad5dfd70f44663fb"+dependencies = [+ "zeroize",+]+[[package]]name = "rustversion"version = "1.0.23"@@ -5456,6 +6045,32 @@ dependencies = ["windows-sys 0.61.2",]+[[package]]+name = "soup3"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "471f924a40f31251afc77450e781cb26d55c0b650842efafc9c6cbd2f7cc4f9f"+dependencies = [+ "futures-channel",+ "gio",+ "glib",+ "libc",+ "soup3-sys",+]++[[package]]+name = "soup3-sys"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7ebe8950a680a12f24f15ebe1bf70db7af98ad242d9db43596ad3108aab86c27"+dependencies = [+ "gio-sys",+ "glib-sys",+ "gobject-sys",+ "libc",+ "system-deps",+]+[[package]]name = "spin"version = "0.9.9"@@ -5668,6 +6283,16 @@ dependencies = ["zeno",]+[[package]]+name = "syn"+version = "1.0.109"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"+dependencies = [+ "proc-macro2",+ "unicode-ident",+]+[[package]]name = "syn"version = "2.0.119"@@ -5690,6 +6315,17 @@ dependencies = ["unicode-ident",]+[[package]]+name = "synstructure"+version = "0.13.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]+[[package]]name = "synstructure"version = "0.14.0"@@ -5710,6 +6346,19 @@ dependencies = ["libc",]+[[package]]+name = "system-deps"+version = "6.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349"+dependencies = [+ "cfg-expr",+ "heck 0.5.0",+ "pkg-config",+ "toml 0.8.23",+ "version-compare",+]+[[package]]name = "taffy"version = "0.13.0"@@ -5728,6 +6377,12 @@ version = "0.1.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c1bbb9f3c5c463a01705937a24fdabc5047929ac764b2d5b9cf681c1f5041ed5"+[[package]]+name = "target-lexicon"+version = "0.12.16"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"+[[package]]name = "tauri-winrt-notification"version = "0.8.1"@@ -5843,6 +6498,7 @@ dependencies = ["powerfmt","serde_core","time-core",+ "time-macros",][[package]]@@ -5851,6 +6507,16 @@ version = "0.1.9"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109"+[[package]]+name = "time-macros"+version = "0.2.32"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85"+dependencies = [+ "num-conv",+ "time-core",+]+[[package]]name = "tiny-keccak"version = "2.0.2"@@ -5957,6 +6623,28 @@ dependencies = ["serde_core",]+[[package]]+name = "toml_edit"+version = "0.19.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"+dependencies = [+ "indexmap",+ "toml_datetime 0.6.11",+ "winnow 0.5.40",+]++[[package]]+name = "toml_edit"+version = "0.20.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81"+dependencies = [+ "indexmap",+ "toml_datetime 0.6.11",+ "winnow 0.5.40",+]+[[package]]name = "toml_edit"version = "0.22.27"@@ -6200,6 +6888,12 @@ version = "0.2.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"+[[package]]+name = "untrusted"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"+[[package]]name = "url"version = "2.5.9"@@ -6224,7 +6918,7 @@ version = "0.46.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "e419dff010bb12512b0ae9e3d2f318dfbdf0167fde7eb05465134d4e8756076f"dependencies = [- "base64",+ "base64 0.22.1","data-url","flate2","fontdb",@@ -6351,6 +7045,12 @@ version = "0.2.15"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"+[[package]]+name = "version-compare"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "03c2856837ef78f57382f06b2b8563a2f512f7185d732608fd9176cb3b8edf0e"+[[package]]name = "version_check"version = "0.9.5"@@ -6616,6 +7316,50 @@ dependencies = ["wasm-bindgen",]+[[package]]+name = "webkit2gtk"+version = "2.0.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a1027150013530fb2eaf806408df88461ae4815a45c541c8975e61d6f2fc4793"+dependencies = [+ "bitflags 1.3.2",+ "cairo-rs",+ "gdk",+ "gdk-sys",+ "gio",+ "gio-sys",+ "glib",+ "glib-sys",+ "gobject-sys",+ "gtk",+ "gtk-sys",+ "javascriptcore-rs",+ "libc",+ "once_cell",+ "soup3",+ "webkit2gtk-sys",+]++[[package]]+name = "webkit2gtk-sys"+version = "2.0.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "916a5f65c2ef0dfe12fff695960a2ec3d4565359fdbb2e9943c974e06c734ea5"+dependencies = [+ "bitflags 1.3.2",+ "cairo-sys-rs",+ "gdk-sys",+ "gio-sys",+ "glib-sys",+ "gobject-sys",+ "gtk-sys",+ "javascriptcore-rs-sys",+ "libc",+ "pkg-config",+ "soup3-sys",+ "system-deps",+]+[[package]]name = "weezl"version = "0.1.12"@@ -7032,6 +7776,15 @@ dependencies = ["windows-link 0.2.1",]+[[package]]+name = "windows-sys"+version = "0.52.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"+dependencies = [+ "windows-targets",+]+[[package]]name = "windows-sys"version = "0.59.0"@@ -7141,6 +7894,15 @@ version = "0.52.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"+[[package]]+name = "winnow"+version = "0.5.40"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876"+dependencies = [+ "memchr",+]+[[package]]name = "winnow"version = "0.7.15"@@ -7207,6 +7969,16 @@ dependencies = ["flate2",]+[[package]]+name = "x11"+version = "2.21.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e"+dependencies = [+ "libc",+ "pkg-config",+]+[[package]]name = "x11-clipboard"version = "0.9.3"@@ -7237,6 +8009,24 @@ version = "0.13.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd"+[[package]]+name = "x509-parser"+version = "0.18.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d43b0f71ce057da06bc0851b23ee24f3f86190b07203dd8f567d0b706a185202"+dependencies = [+ "asn1-rs",+ "data-encoding",+ "der-parser",+ "lazy_static",+ "nom 7.1.3",+ "oid-registry",+ "ring",+ "rusticata-macros",+ "thiserror 2.0.21",+ "time",+]+[[package]]name = "xcursor"version = "0.3.11"@@ -7295,6 +8085,16 @@ version = "0.8.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448"+[[package]]+name = "yasna"+version = "0.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b5f6765e852b9b4dc8e2a76843e4d64d1cea8e79bcde0b6901aea8e7c7f08282"+dependencies = [+ "bit-vec 0.9.1",+ "time",+]+[[package]]name = "yazi"version = "0.2.2"@@ -7332,7 +8132,7 @@ dependencies = ["proc-macro2","quote","syn 3.0.10",- "synstructure",+ "synstructure 0.14.0",][[package]]@@ -7427,7 +8227,7 @@ version = "5.19.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40"dependencies = [- "proc-macro-crate",+ "proc-macro-crate 3.5.0","proc-macro2","quote","syn 3.0.10",@@ -7574,7 +8374,7 @@ dependencies = ["proc-macro2","quote","syn 3.0.10",- "synstructure",+ "synstructure 0.14.0",][[package]]@@ -7730,7 +8530,7 @@ version = "5.15.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "ef2672456ba1cb54b5eaec136e63135b3c7495fb938e53b28a62e633496d486d"dependencies = [- "proc-macro-crate",+ "proc-macro-crate 3.5.0","proc-macro2","quote","syn 3.0.10",diff --git a/native/crates/app/Cargo.toml b/native/crates/app/Cargo.tomlindex e7a5f8df76e..5a0d3cbdac9 100644--- a/native/crates/app/Cargo.toml+++ b/native/crates/app/Cargo.toml@@ -53,6 +53,13 @@ security-framework = "3"[target.'cfg(target_os = "linux")'.dependencies]# The zbus gpui_linux's ashpd and oo7 use.zbus = { version = "5", default-features = false, features = ["async-io", "blocking-api"] }+async-openssl = "0.2"+gdkx11 = "0.18"+gtk = "0.18"+openssl = "0.10"+rcgen = { version = "0.14", default-features = false, features = ["crypto", "pem", "ring"] }+webkit2gtk = { version = "2.0", features = ["v2_40"] }+x11 = { version = "2", features = ["xlib"] }[build-dependencies]regex = "1"diff --git a/native/crates/app/src/main.rs b/native/crates/app/src/main.rsindex 56e8c9dabb3..ce72bc9cab8 100644--- a/native/crates/app/src/main.rs+++ b/native/crates/app/src/main.rs@@ -277,6 +277,8 @@ fn main() -> anyhow::Result<()> {application.run(move |cx: &mut App| {perf::mark("code/mainAppReady");workbench::accessibility::watch_assistive_apps(cx);+ #[cfg(target_os = "linux")]+ webview::pump_gtk(cx);// app.ts `macOpenFiles`: AppKit sends the launch's documents before `applicationDidFinishLaunching:`; they take the// startup window's place and open from the task, as effects deferred from this callback never run.let launch_urls: Vec<Vec<String>> = std::iter::from_fn(|| urls.try_recv().ok()).collect();diff --git a/native/crates/app/src/webview.rs b/native/crates/app/src/webview.rsindex 0a2e6cbf7c7..b1166005271 100644--- a/native/crates/app/src/webview.rs+++ b/native/crates/app/src/webview.rs@@ -1,6 +1,5 @@//! platform/webview: the host page (src/vs/workbench/contrib/webview/browser/pre/index.html) and what the workbench-//! answers it, shared by the native views: a WKWebView on macOS (`macos.rs`), none on Linux yet (`linux.rs`).-#![cfg_attr(target_os = "linux", allow(dead_code, reason = "the Linux webview (WebKitGTK) is not ported yet"))]+//! answers it, shared by the native views: a WKWebView on macOS (`macos.rs`), a WebKitGTK view on Linux (`linux.rs`).use std::path::{Component, Path, PathBuf};@@ -14,7 +13,7 @@ mod linux;#[cfg(target_os = "macos")]mod macos;#[cfg(target_os = "linux")]-pub use linux::{ClipView, Retained, Webview, place, supported};+pub use linux::{ClipView, Retained, Webview, pump_gtk, place, supported};#[cfg(target_os = "macos")]pub use macos::{ClipView, Retained, Webview, place, supported};diff --git a/native/crates/app/src/webview/linux.rs b/native/crates/app/src/webview/linux.rsindex 01524ae9ffc..40597882e89 100644--- a/native/crates/app/src/webview/linux.rs+++ b/native/crates/app/src/webview/linux.rs@@ -1,113 +1,591 @@-//! No webviews on Linux yet (WebKitGTK is the planned engine): `supported` is false, so callers never make one, and-//! the types below have no values.+//! platform/webview on Linux: a WebKitGTK view in a GTK window reparented into GPUI's X11 window, loading upstream's+//! host page (src/vs/workbench/contrib/webview/browser/pre/index.html) as macos.rs does. WebKitGTK refuses a scheme+//! handler on `https`, so a TLS proxy on loopback, set as the view's https proxy, stands in for the service worker:+//! it answers `https://*.vscode-webview.vscode-cdn.net` and `https://*.vscode-resource.vscode-cdn.net` with a+//! certificate the view's context trusts for those hosts only, and tunnels every other host. A script message handler+//! stands in for the window `message` event, as on macOS. GTK runs on GPUI's main thread, iterated by `pump_gtk`.-use std::convert::Infallible;+use std::cell::{OnceCell, RefCell};+use std::collections::HashSet;+use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4};+use std::os::unix::fs::MetadataExt;use std::path::PathBuf;+use std::pin::Pin;+use std::rc::Rc;+use std::sync::OnceLock;+use std::time::Duration;-use futures::channel::mpsc::UnboundedSender;-use gpui::{Bounds, Pixels, Window};+use async_openssl::SslStream;+use futures::channel::{mpsc::UnboundedSender, oneshot};+use futures::io::{AsyncBufRead, AsyncBufReadExt, AsyncWriteExt, BufReader};+use gpui::{App, Bounds, Pixels, Window};+use gtk::glib::translate::ToGlibPtr;+use gtk::prelude::*;+use gtk::{gdk, gio, glib};+use openssl::pkey::PKey;+use openssl::ssl::{Ssl, SslContext, SslMethod};+use openssl::x509::X509;+use raw_window_handle::{HasWindowHandle, RawWindowHandle};+use serde_json::{Value, json};pub use std::rc::Rc as Retained;-use serde_json::Value;+use webkit2gtk::{+ NetworkProxyMode, NetworkProxySettings, SecurityManagerExt, SettingsExt, UserContentInjectedFrames, UserContentManager, UserContentManagerExt, UserScript, UserScriptInjectionTime, WebContext, WebContextExt, WebInspectorExt,+ WebViewExt, WebsiteDataManagerExt,+};+use x11::xlib;-use super::WebviewEvent;+use super::{BRIDGE_SCRIPT, FIND_SCRIPT, HOST_SITE, MESSAGE_HANDLER, RESOURCE_AUTHORITY, ResourceRead, WebviewEvent, host_message, host_page_url, is_contained, mime_type, resource_response, resource_uri};+/// The native view of a webview, which `place` shows.+pub type View = webkit2gtk::WebView;++thread_local! {+ static SUPPORTED: OnceCell<bool> = const { OnceCell::new() };+}++/// GTK lives on the thread that initialized it: GPUI's main thread on X11, which unit tests do not run on. GPUI on+/// Wayland has no X window to hold the view.pub fn supported() -> bool {- false+ SUPPORTED.with(|supported| *supported.get_or_init(|| std::thread::current().name() == Some("main") && gpui::guess_compositor() == "X11" && gtk::init().is_ok()))}-pub struct Webview {- never: Infallible,+/// Runs GTK's pending events from GPUI's loop, which has no glib main context to share.+pub fn pump_gtk(cx: &mut App) {+ // shortcut: polls every 8 ms; hand glib's poll fds to GPUI's loop if the wakeups show up in power use.+ cx.spawn(async move |cx| {+ loop {+ if SUPPORTED.with(|supported| supported.get() == Some(&true)) {+ let context = glib::MainContext::default();+ while context.iteration(false) {}+ }+ cx.background_executor().timer(Duration::from_millis(8)).await;+ }+ })+ .detach();}-/// The native view of a webview, which `place` shows.-pub struct View {- never: Infallible,+pub struct Webview {+ view: View,+ /// The GTK window the view sits in until a `ClipView` takes it.+ window: gtk::Window,+ content: UserContentManager,+ proxy: gio::SocketService,+ roots: Rc<RefCell<Vec<files::Resource>>>,+ /// GPUI's X window, which gets the keyboard back.+ parent: xlib::Window,+ /// Messages for the host page before it posted `webview-ready`, sent in order once it has.+ pending: Option<Vec<String>>,}impl Webview {- pub fn new(_window: &Window, _id: &str, _origin: &str, _extension_id: &str, _pre_dir: PathBuf, _roots: Vec<files::Resource>, _events: UnboundedSender<WebviewEvent>) -> Self {- unreachable!("no webviews on Linux: callers check `supported`")+ /// A hidden webview over `window` loading the host page; `origin` is the webview's `this.origin`, the salt of its host name.+ pub fn new(window: &Window, id: &str, origin: &str, extension_id: &str, pre_dir: PathBuf, roots: Vec<files::Resource>, events: UnboundedSender<WebviewEvent>) -> Self {+ let roots = Rc::new(RefCell::new(roots));+ let context = WebContext::new_ephemeral();+ let (certificate, tls) = proxy_certificate();+ let proxy = gio::SocketService::new();+ let address = gio::InetSocketAddress::new(&gio::InetAddress::new_loopback(gio::SocketFamily::Ipv4), 0);+ let address = proxy.add_address(&address, gio::SocketType::Stream, gio::SocketProtocol::Tcp, None::<&glib::Object>).expect("a loopback port");+ let port = address.downcast::<gio::InetSocketAddress>().expect("an inet address").port();+ let state = Rc::new(ProxyState { id: id.to_string(), pre_dir, roots: roots.clone(), events: events.clone(), context: context.clone(), certificate, tls, trusted_hosts: RefCell::default(), port });+ proxy.connect_incoming(move |_, connection, _| {+ glib::MainContext::default().spawn_local(serve(connection.clone(), state.clone()));+ false+ });+ proxy.start();+ let mut settings = NetworkProxySettings::new(None, &[]);+ settings.add_proxy_for_scheme("https", &format!("http://127.0.0.1:{port}"));+ context.website_data_manager().expect("a context has a data manager").set_network_proxy_settings(NetworkProxyMode::Custom, Some(&mut settings));+ // WebKit blocks an http frame in the https host page as mixed content, loopback included, where Chromium lets+ // http://localhost load (the Simple Browser's dev servers).+ context.security_manager().expect("a context has a security manager").register_uri_scheme_as_secure("http");++ let content = UserContentManager::new();+ content.register_script_message_handler(MESSAGE_HANDLER);+ let id_for_messages = id.to_string();+ content.connect_script_message_received(Some(MESSAGE_HANDLER), move |_, result| {+ let Some(text) = result.js_value().map(|value| value.to_string()) else { return };+ if let Some(event) = host_message(&id_for_messages, &text) {+ let _ = events.unbounded_send(event);+ }+ });+ content.add_script(&UserScript::new(BRIDGE_SCRIPT, UserContentInjectedFrames::TopFrame, UserScriptInjectionTime::Start, &[], &[]));++ let view = webkit2gtk::WebView::builder().web_context(&context).user_content_manager(&content).build();+ // The page background shows until the host page paints, as the transparent iframe does upstream.+ view.set_background_color(&gdk::RGBA::new(0., 0., 0., 0.));+ view.connect_button_press_event(|view, _| {+ focus_x_window(view);+ glib::Propagation::Proceed+ });+ let parent = gpui_x_window(window);+ let gtk_window = embedded_window(parent);+ gtk_window.add(&view);+ view.load_uri(&host_page_url(id, origin, extension_id));+ Webview { view, window: gtk_window, content, proxy, roots, parent, pending: Some(Vec::new()) }}- pub fn send(&mut self, _channel: &str, _data: Value) {- match self.never {}+ /// `webviewElement.ts` `_send`: posts `{ channel, args }` on the host page's port.+ pub fn send(&mut self, channel: &str, data: Value) {+ let script = format!("globalThis.__vscodeWebviewHost.post({}, {})", json!(channel), data);+ match &mut self.pending {+ Some(pending) => pending.push(script),+ None => self.evaluate(&script),+ }}+ /// The host page posted `webview-ready`: messages queued before go out now.pub fn did_become_ready(&mut self) {- match self.never {}+ for script in self.pending.take().unwrap_or_default() {+ self.evaluate(&script);+ }}- pub fn set_local_resource_roots(&self, _roots: Vec<files::Resource>) {- match self.never {}+ pub fn set_local_resource_roots(&self, roots: Vec<files::Resource>) {+ *self.roots.borrow_mut() = roots;}+ /// The native view, for `place` from a paint callback.pub fn view(&self) -> View {- match self.never {}+ self.view.clone()}pub fn hide(&self) {- match self.never {}+ if !self.view.is_visible() {+ return;+ }+ self.release_keyboard();+ self.view.hide();+ self.window.hide();}+ /// `webviewElement.ts` `focus`: the view takes the keyboard and the host page focuses its content frame.pub fn focus(&mut self) {- match self.never {}+ self.take_keyboard();+ self.send("focus", Value::Null);}- pub fn clipboard_command(&mut self, _command: &str) {- match self.never {}+ /// `webviewElement.ts` `cut`, `copy`, `paste`: WebKitGTK's editing commands in the page, as Ctrl+C runs them, for+ /// the reason macos.rs gives.+ pub fn clipboard_command(&mut self, command: &str) {+ self.take_keyboard();+ self.view.execute_editing_command(match command {+ "cut" => "Cut",+ "copy" => "Copy",+ _ => "Paste",+ });}+ /// Gives the view's X window the keyboard, as a click into it does.pub fn take_keyboard(&self) {- match self.never {}+ if !self.has_keyboard() {+ focus_x_window(&self.view);+ }}+ /// Gives the keyboard back to GPUI's X window.pub fn release_keyboard(&self) {- match self.never {}+ if self.has_keyboard() {+ set_input_focus(self.parent);+ }}+ /// Whether the X window holding the view has the keyboard.pub fn has_keyboard(&self) -> bool {- match self.never {}+ let Some(holder) = x_window_of(&self.view) else { return false };+ let (mut focused, mut revert) = (0, 0);+ // SAFETY: GTK's open X display; the out pointers are locals.+ unsafe { xlib::XGetInputFocus(x_display(), &mut focused, &mut revert) };+ focused == holder}- pub fn show_find(&self, _styles: &Value, _icons: [String; 3]) {- match self.never {}+ /// webviewFindWidget.ts `reveal`: the find widget over the host page's top right, its input focused. `styles` is+ /// `theme_data`; `icons` the arrow-up, arrow-down and close codicons as SVG markup.+ pub fn show_find(&self, styles: &Value, icons: [String; 3]) {+ self.take_keyboard();+ self.evaluate(&format!("({FIND_SCRIPT})({styles}, {}).show()", json!(icons)));}pub fn hide_find(&self) {- match self.never {}+ self.evaluate("globalThis.__vscodeFind?.hide()");}- pub fn find(&self, _previous: bool) {- match self.never {}+ /// `WebviewFindWidget.find`: the next or previous match of the widget's text.+ pub fn find(&self, previous: bool) {+ self.evaluate(&format!("globalThis.__vscodeFind?.find({previous})"));}+ /// The Web Inspector of the view, as the Electron webview's dev tools.pub fn open_inspector(&self) {- match self.never {}+ if let Some(settings) = WebViewExt::settings(&self.view) {+ settings.set_enable_developer_extras(true);+ }+ if let Some(inspector) = self.view.inspector() {+ inspector.show();+ }+ }++ fn evaluate(&self, script: &str) {+ self.view.evaluate_javascript(script, None, None, None::<&gio::Cancellable>, |_| {});}}-pub fn place(view: &View, _window: &Window, _bounds: Bounds<Pixels>) {- match view.never {}+impl Drop for Webview {+ fn drop(&mut self) {+ self.content.unregister_script_message_handler(MESSAGE_HANDLER);+ self.release_keyboard();+ self.proxy.stop();+ self.proxy.close();+ // SAFETY: the view and its own window are this webview's; a clip view holding the view drops its reference.+ unsafe {+ self.view.destroy();+ self.window.destroy();+ }+ }+}++/// Shows `view` over `bounds`, in GPUI window coordinates.+pub fn place(view: &View, window: &Window, bounds: Bounds<Pixels>) {+ let Some(holder) = view.toplevel().and_then(|toplevel| toplevel.downcast::<gtk::Window>().ok()) else { return };+ move_window(&holder, window, bounds);+ view.show();+ holder.show();}+/// The notebook's back layer webview (backLayerWebView.ts) lies behind the cells upstream; here it floats over GPUI's+/// layer, so a clip window holds it: it shows the webview inside the notebook list only, and presses reach the+/// webview over its outputs and markdown previews only, GPUI's cells everywhere else.pub struct ClipView {- never: Infallible,+ window: gtk::Window,+ fixed: gtk::Fixed,+ /// The input shape last set: the hit rects without the hole, in clip coordinates.+ shape: RefCell<Option<(Vec<gdk::Rectangle>, Option<gdk::Rectangle>)>>,}impl ClipView {- pub fn new(_window: &Window, webview: &Webview) -> Retained<Self> {- match webview.never {}+ pub fn hide(&self) {+ self.window.hide();+ }++ pub fn remove(&self) {+ // SAFETY: the clip window is this clip view's; the webview it holds keeps its own reference.+ unsafe { self.window.destroy() };}- pub fn place(&self, _webview: &View, _window: &Window, _bounds: Bounds<Pixels>, _webview_frame: Bounds<Pixels>, _hit_rects: Vec<Bounds<Pixels>>, _hole: Option<Bounds<Pixels>>) {- match self.never {}+ /// A hidden clip window over `window` holding `webview`.+ pub fn new(window: &Window, webview: &Webview) -> Retained<Self> {+ let clip = embedded_window(gpui_x_window(window));+ let fixed = gtk::Fixed::new();+ clip.add(&fixed);+ webview.window.remove(&webview.view);+ fixed.put(&webview.view, 0, 0);+ webview.view.show();+ fixed.show();+ Rc::new(ClipView { window: clip, fixed, shape: RefCell::default() })}- pub fn hide(&self) {- match self.never {}+ /// Shows the clip over `bounds` in GPUI window coordinates, its webview at `webview` (relative to the clip's+ /// origin, as `hit_rects` are).+ pub fn place(&self, webview: &View, window: &Window, bounds: Bounds<Pixels>, webview_frame: Bounds<Pixels>, hit_rects: Vec<Bounds<Pixels>>, hole: Option<Bounds<Pixels>>) {+ move_window(&self.window, window, bounds);+ let frame = gtk_rect(&self.window, window, webview_frame);+ self.fixed.move_(webview, frame.x(), frame.y());+ webview.set_size_request(frame.width(), frame.height());+ self.window.show();+ let rects: Vec<gdk::Rectangle> = hit_rects.into_iter().map(|rect| gtk_rect(&self.window, window, rect)).collect();+ let hole = hole.map(|hole| gtk_rect(&self.window, window, hole));+ if self.shape.borrow().as_ref() != Some(&(rects.clone(), hole)) {+ self.set_shapes(&rects, hole);+ *self.shape.borrow_mut() = Some((rects, hole));+ }}- pub fn remove(&self) {- match self.never {}+ /// Presses reach the clip over `rects` only, never over `hole` (a GPUI widget over the clip: the notebook find+ /// widget), which the clip also leaves undrawn.+ fn set_shapes(&self, rects: &[gdk::Rectangle], hole: Option<gdk::Rectangle>) {+ let Some(gdk_window) = self.window.window() else { return };+ let input = gtk::cairo::Region::create();+ for rect in rects {+ let _ = input.union_rectangle(&cairo_rect(rect));+ }+ let drawn = gtk::cairo::Region::create_rectangle(>k::cairo::RectangleInt::new(0, 0, i32::MAX / 2, i32::MAX / 2));+ if let Some(hole) = hole {+ let _ = input.subtract_rectangle(&cairo_rect(&hole));+ let _ = drawn.subtract_rectangle(&cairo_rect(&hole));+ }+ gdk_window.input_shape_combine_region(&input, 0, 0);+ gdk_window.shape_combine_region(Some(&drawn), 0, 0);+ }+}++fn cairo_rect(rect: &gdk::Rectangle) -> gtk::cairo::RectangleInt {+ gtk::cairo::RectangleInt::new(rect.x(), rect.y(), rect.width(), rect.height())+}++/// `bounds` in GPUI's logical pixels as GTK's, which count device pixels over GTK's own scale.+fn gtk_rect(holder: >k::Window, window: &Window, bounds: Bounds<Pixels>) -> gdk::Rectangle {+ let scale = window.scale_factor() / holder.scale_factor() as f32;+ let value = |pixels: Pixels| (f32::from(pixels) * scale).round() as i32;+ gdk::Rectangle::new(value(bounds.origin.x), value(bounds.origin.y), value(bounds.size.width).max(1), value(bounds.size.height).max(1))+}++fn move_window(holder: >k::Window, window: &Window, bounds: Bounds<Pixels>) {+ let rect = gtk_rect(holder, window, bounds);+ if holder.position() != (rect.x(), rect.y()) {+ holder.move_(rect.x(), rect.y());+ }+ if holder.size() != (rect.width(), rect.height()) {+ holder.resize(rect.width(), rect.height());+ }+}++/// A hidden, undecorated GTK window whose X window is a child of `parent`.+fn embedded_window(parent: xlib::Window) -> gtk::Window {+ let window = gtk::Window::new(gtk::WindowType::Popup);+ window.realize();+ let display = gdk::Display::default().expect("GTK has a display").downcast::<gdkx11::X11Display>().expect("GTK on X11");+ let parent = gdkx11::X11Window::foreign_new_for_display(&display, parent);+ window.window().expect("a realized window").reparent(parent.upcast_ref::<gdk::Window>(), 0, 0);+ window+}++fn gpui_x_window(window: &Window) -> xlib::Window {+ let handle = HasWindowHandle::window_handle(window).expect("an open window has a handle");+ match handle.as_raw() {+ RawWindowHandle::Xcb(handle) => handle.window.get().into(),+ RawWindowHandle::Xlib(handle) => handle.window,+ _ => unreachable!("`supported` holds GPUI to X11"),+ }+}++fn x_window_of(view: &View) -> Option<xlib::Window> {+ let window = view.toplevel()?.window()?;+ Some(window.downcast::<gdkx11::X11Window>().ok()?.xid())+}++fn focus_x_window(view: &View) {+ if let Some(window) = x_window_of(view) {+ set_input_focus(window);+ }+ view.grab_focus();+}++fn set_input_focus(window: xlib::Window) {+ // A window not mapped yet answers BadMatch, which GDK's default X error handler aborts on.+ gdk::error_trap_push();+ // SAFETY: GTK's open X display and a window of GPUI or GTK. A reparented window is no toplevel, so no window+ // manager gives it the focus; X does on this request.+ unsafe {+ xlib::XSetInputFocus(x_display(), window, xlib::RevertToParent, xlib::CurrentTime);+ xlib::XFlush(x_display());+ }+ gdk::error_trap_pop_ignored();+}++fn x_display() -> *mut xlib::Display {+ let display = gdk::Display::default().expect("GTK has a display").downcast::<gdkx11::X11Display>().expect("GTK on X11");+ // SAFETY: an X11 display GTK keeps open.+ unsafe { gdkx11::ffi::gdk_x11_display_get_xdisplay(display.to_glib_none().0) }+}++/// The proxy's certificate, for the view's context to trust, and the TLS context serving it, made once per process.+/// OpenSSL serves it: GnuTLS, glib-networking's backend, refuses a resource host's SNI (`file+.vscode-resource...`).+fn proxy_certificate() -> (gio::TlsCertificate, SslContext) {+ static PEM: OnceLock<(String, String)> = OnceLock::new();+ let (certificate, key) = PEM.get_or_init(|| {+ let names = vec![format!("*.{HOST_SITE}"), format!("*.{RESOURCE_AUTHORITY}")];+ let certified = rcgen::generate_simple_self_signed(names).expect("a self-signed certificate");+ (certified.cert.pem(), certified.signing_key.serialize_pem())+ });+ let trusted = gio::TlsCertificate::from_pem(certificate).expect("rcgen's PEM");+ let mut tls = SslContext::builder(SslMethod::tls_server()).expect("an OpenSSL context");+ tls.set_certificate(&X509::from_pem(certificate.as_bytes()).expect("rcgen's PEM")).expect("the certificate");+ tls.set_private_key(&PKey::private_key_from_pem(key.as_bytes()).expect("rcgen's PEM")).expect("the key");+ (trusted, tls.build())+}++struct ProxyState {+ id: String,+ /// src/vs/workbench/contrib/webview/browser/pre, the host page's files.+ pre_dir: PathBuf,+ roots: Rc<RefCell<Vec<files::Resource>>>,+ /// Where resources of extension file system providers are asked for.+ events: UnboundedSender<WebviewEvent>,+ context: WebContext,+ certificate: gio::TlsCertificate,+ tls: SslContext,+ trusted_hosts: RefCell<HashSet<String>>,+ port: u16,+}++/// One proxy connection: `CONNECT host:port`, then the host page or resources over TLS, or a tunnel to another host.+async fn serve(connection: gio::SocketConnection, state: Rc<ProxyState>) {+ let client = connection.remote_address().ok().and_then(|address| address.downcast::<gio::InetSocketAddress>().ok()).map(SocketAddr::from);+ let uid = std::fs::metadata("/proc/self").map(|metadata| metadata.uid());+ let table = std::fs::read_to_string("/proc/net/tcp").unwrap_or_default();+ // Any local user can reach a loopback port; only WebKit's network process, ours, gets an answer.+ let (Some(SocketAddr::V4(client)), Ok(uid)) = (client, uid) else { return };+ if !is_own_connection(&table, client, state.port, uid) {+ return;+ }+ let Ok(stream) = connection.clone().into_async_read_write() else { return };+ let mut stream = BufReader::new(stream);+ let Some(head) = read_head(&mut stream).await else { return };+ let Some(target) = head.line.strip_prefix("CONNECT ").and_then(|rest| rest.split(' ').next()).map(str::to_string) else { return };+ let host = target.rsplit_once(':').map_or(target.as_str(), |(host, _)| host).to_ascii_lowercase();+ let output = connection.output_stream();+ let is_subdomain = |site: &str| host.strip_suffix(site).is_some_and(|rest| rest.ends_with('.'));+ if !is_subdomain(HOST_SITE) && !is_subdomain(RESOURCE_AUTHORITY) {+ let Ok(upstream) = gio::SocketClient::new().connect_to_host_future(&target, 443).await else {+ let _ = output.write_all_future(b"HTTP/1.1 502 Bad Gateway\r\n\r\n", glib::Priority::DEFAULT).await;+ return;+ };+ if output.write_all_future(b"HTTP/1.1 200 Connection Established\r\n\r\n", glib::Priority::DEFAULT).await.is_err() {+ return;+ }+ let flags = gio::OutputStreamSpliceFlags::CLOSE_SOURCE | gio::OutputStreamSpliceFlags::CLOSE_TARGET;+ let up = upstream.output_stream().splice_future(&connection.input_stream(), flags, glib::Priority::DEFAULT);+ let down = output.splice_future(&upstream.input_stream(), flags, glib::Priority::DEFAULT);+ futures::future::select(up, down).await;+ return;+ }+ if state.trusted_hosts.borrow_mut().insert(host.clone()) {+ state.context.allow_tls_certificate_for_host(&state.certificate, &host);+ }+ if output.write_all_future(b"HTTP/1.1 200 Connection Established\r\n\r\n", glib::Priority::DEFAULT).await.is_err() {+ return;+ }+ let Ok(ssl) = Ssl::new(&state.tls) else { return };+ let Ok(mut tls) = SslStream::new(ssl, stream.into_inner()) else { return };+ if Pin::new(&mut tls).accept().await.is_err() {+ return;+ }+ let mut tls = BufReader::new(tls);+ while let Some(head) = read_head(&mut tls).await {+ let (status, headers, body) = answer(&state, &host, &head).await;+ let mut response = format!("HTTP/1.1 {status} {}\r\nContent-Length: {}\r\n", reason(status), body.len());+ for (key, value) in headers {+ response.push_str(&format!("{key}: {value}\r\n"));+ }+ response.push_str("\r\n");+ let mut bytes = response.into_bytes();+ bytes.extend(body);+ if tls.write_all(&bytes).await.is_err() {+ return;+ }+ }+}++struct Head {+ line: String,+ range: Option<String>,+}++/// A request line and its headers, of which the `Range` one is kept; `None` once the connection closed.+async fn read_head(reader: &mut (impl AsyncBufRead + Unpin)) -> Option<Head> {+ let line = read_line(reader).await?;+ let mut range = None;+ loop {+ let header = read_line(reader).await?;+ if header.is_empty() {+ return Some(Head { line, range });+ }+ if let Some((_, value)) = header.split_once(':').filter(|(name, _)| name.eq_ignore_ascii_case("range")) {+ range = Some(value.trim().to_string());+ }+ }+}++/// A line without its line break; `None` once the connection closed.+async fn read_line(reader: &mut (impl AsyncBufRead + Unpin)) -> Option<String> {+ let mut line = String::new();+ match reader.read_line(&mut line).await {+ Ok(0) | Err(_) => None,+ Ok(_) => Some(line.trim_end().to_string()),+ }+}++/// What the service worker answers upstream: the host page's files, and resources as webviewElement.ts `loadResource`+/// with resourceLoading.ts `loadLocalResource` read them, a `file` one here, another scheme's through the workbench's+/// file service, where extension file system providers answer.+async fn answer(state: &ProxyState, host: &str, head: &Head) -> (u16, Vec<(&'static str, String)>, Vec<u8>) {+ let mut parts = head.line.split(' ');+ let (Some("GET"), Some(target)) = (parts.next(), parts.next()) else { return (405, Vec::new(), Vec::new()) };+ let (path, query) = target.split_once('?').unwrap_or((target, ""));+ let path = crate::uri::percent_decode(path);+ if host.ends_with(HOST_SITE) {+ let name = path.trim_start_matches('/');+ let file = state.pre_dir.join(name);+ return match (name.contains(".."), std::fs::read(&file)) {+ (false, Ok(bytes)) => (200, vec![("Content-Type", mime_type(&file).to_string())], bytes),+ _ => (404, Vec::new(), Vec::new()),+ };+ }+ let Some(resource) = resource_uri(host, &path, &crate::uri::percent_decode(query)) else { return (404, Vec::new(), Vec::new()) };+ if !is_contained(&resource, &state.roots.borrow()) {+ return (401, Vec::new(), Vec::new());+ }+ let range = head.range.as_deref();+ if resource.scheme == "file" {+ let bytes = std::fs::read(&resource.path).ok();+ return resource_response(&resource.path, bytes, range);+ }+ let path = resource.path.clone();+ let (sender, receiver) = oneshot::channel();+ let respond = Box::new(move |bytes: Option<Vec<u8>>| {+ let _ = sender.send(bytes);+ });+ let read = ResourceRead { resource, respond };+ let _ = state.events.unbounded_send(WebviewEvent { id: state.id.clone(), channel: "load-resource".into(), data: Value::Null, read: Some(read) });+ resource_response(&path, receiver.await.ok().flatten(), range)+}++fn reason(status: u16) -> &'static str {+ match status {+ 200 => "OK",+ 206 => "Partial Content",+ 401 => "Unauthorized",+ 404 => "Not Found",+ _ => "Method Not Allowed",+ }+}++/// Whether /proc/net/tcp shows the connection from `client` to the proxy on 127.0.0.1:`proxy_port` owned by `uid`.+/// The whole addresses count: a client on 127.0.0.2 can take the proxy's port.+fn is_own_connection(table: &str, client: SocketAddrV4, proxy_port: u16, uid: u32) -> bool {+ // The kernel prints each IPv4 address as the u32 it holds in network order.+ let address = |ip: Ipv4Addr, port: u16| format!("{:08X}:{port:04X}", u32::from_ne_bytes(ip.octets()));+ let (local, remote) = (address(*client.ip(), client.port()), address(Ipv4Addr::LOCALHOST, proxy_port));+ table.lines().skip(1).any(|line| {+ let fields: Vec<&str> = line.split_whitespace().collect();+ fields.len() > 7 && fields[1] == local && fields[2] == remote && fields[7] == uid.to_string()+ })+}++#[cfg(test)]+mod tests {+ use std::net::{Ipv4Addr, SocketAddrV4};++ use super::is_own_connection;++ fn loopback(last: u8, port: u16) -> SocketAddrV4 {+ SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, last), port)+ }++ #[test]+ fn proxy_answers_only_connections_of_its_user() {+ let table = " sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode\n 0: 0100007F:D431 0100007F:A2F0 01 00000000:00000000 00:00000000 00000000 1000 0 123 1\n 1: 0100007F:D432 0100007F:A2F0 01 00000000:00000000 00:00000000 00000000 1001 0 124 1\n";+ assert!(is_own_connection(table, loopback(1, 0xD431), 0xA2F0, 1000));+ assert!(!is_own_connection(table, loopback(1, 0xD432), 0xA2F0, 1000));+ assert!(!is_own_connection(table, loopback(1, 0xD431), 0xA2F1, 1000));+ }++ /// Another user binds 127.0.0.2 on the proxy's port: the proxy's accepted socket, ours, then shows the same ports+ /// reversed.+ #[test]+ fn proxy_refuses_a_client_on_its_own_port_from_another_loopback_address() {+ let table = " sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode\n 0: 0200007F:A2F0 0100007F:A2F0 01 00000000:00000000 00:00000000 00000000 1001 0 123 1\n 1: 0100007F:A2F0 0200007F:A2F0 01 00000000:00000000 00:00000000 00000000 1000 0 124 1\n";+ assert!(!is_own_connection(table, loopback(2, 0xA2F0), 0xA2F0, 1000));+ assert!(is_own_connection(table, loopback(2, 0xA2F0), 0xA2F0, 1001));}}diff --git a/port/ledger.md b/port/ledger.mdindex 7bcecdf063c..e5a8c539cfd 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -41,7 +41,8 @@ Status: `open`, `in progress`, `waiting on Artur`, `later` (postponed), `done`,| Milestones | M23 Linux build | in progress | Branch `port-linux` (a Linux build container on the Studio). The app is macOS-only today: 24 files of `native/crates` call AppKit, Foundation, WebKit, Security or Core Foundation directly (objc2, core-foundation, security-framework); GPUI (`native/vendor/wu`) already has its Linux platform (Wayland and X11). Every macOS call goes behind `cfg(target_os = "macos")` with the Linux counterpart VS Code uses there, in the same function where the two are a few lines, in a `platform/linux.rs` beside a `platform/macos.rs` where they are not: webview (WebKitGTK through wry), file dialogs (xdg-desktop-portal, rfd), the application menu (drawn in the window: `window.titleBarStyle`, `window.menuBarVisibility`), clipboard and the find pasteboard (GPUI's), proxy (`http.proxy` and the system proxy via reqwest instead of NSURLSession), secrets (Secret Service, keyring), `code` CLI install (`~/.local/bin`), file watching (inotify, notify), the updater (a download link, as `update.mode` on a tar.gz), and the settings import paths (`~/.config/Code`, `~/.config/Cursor`, `~/.config/VSCodium`). Packaging: `port/tools/package-linux` writes `VSRustium-<version>-linux-<arch>.tar.gz` and the `linux-<arch>.json` and `linux-<arch>-prerelease.json` feed entries (port/notes.md milestone 23); deb and AppImage after it. Builds in a Linux container on the Studio (`docker`, linux/arm64) for the build and the unit tests; linux-x64 on a GitHub Actions `ubuntu` runner once arm64 is green. | `cargo build --release -p app` and the area tests pass on Linux arm64 and x64; the app opens a folder, edits, saves, runs an extension (the exthost handshake, emmet and git activate) and shows a webview under Xvfb or Wayland in the container; `v1.147.0-insider` carries `VSRustium-1.147.0-insider-linux-arm64.tar.gz` and `VSRustium-1.147.0-insider-linux-x64.tar.gz`; the macOS build is unchanged (its area tests and api-tests as before). || Milestones | M24 Windows build | later | After milestone 23, on the same seams: WebView2 (wry), the Win32 file dialogs, the in-window menu bar and custom title bar, Credential Manager (keyring), the user-setup install path and `code` on PATH, `%APPDATA%\Code` settings import, ConPTY for the terminal (alacritty_terminal has it), an x64 and arm64 zip and a user installer, no Authenticode signing (the Windows signing decision). Builds on a GitHub Actions `windows` runner. | As milestone 23, for win32-x64 and win32-arm64. || Milestones | M25 virtual workspaces | later | Artur: its own milestone after M20, not part of the gap audits. A folder of a non-file scheme (`.code-workspace` `uri` folders, `--folder-uri`, `vscode.openFolder` with an extension file system provider scheme) kept as a URI; every reader of workspace folders (173 `.folders` uses in 70 files: explorer, search, quick open, terminal cwd, tasks, git, watcher, settings layers, trust) goes through the file system providers; the workspace marked virtual, `virtualWorkspaces: false` extensions disabled with the `notSupportedInWorkspace` message (config/workspace.rs:101, port/notes.md provider entries deferred until virtual workspaces). | not started |-| M23 Linux | app/src/webview/linux.rs:14 | open | [linux L] webviews through WebKitGTK (wry): webview panels and views, editor insets, notebook outputs, extension details, release notes. Linux shows now: no webview: `supported()` is false and each webview surface stays empty. | |+| M23 Linux | app/src/webview/linux.rs:66 | done | [linux L] webviews through WebKitGTK: webview panels and views, editor insets, notebook outputs, extension details, release notes. | `FIXTURE=webview-tests port/tools/linux/smoke` on X11 (Xvfb): 8/8 ok; `cargo gc test -p app webview` on Linux: 18 passed |+| M23 Linux | app/src/webview/linux.rs:47 | open | [linux M] webviews in a Wayland session. Linux shows now: no webview under Wayland: GPUI has no X window there to hold the GTK window, so `supported()` is false and each webview surface stays empty. | || M23 Linux | exthost/src/main_thread_secret_state.rs:46 | done | [linux M] secrets in the Secret Service (libsecret). | `cargo test -p exthost secret` on Linux: `secrets_in_a_keyring` (oo7's file backend); a desktop Secret Service not run || M23 Linux | app/src/clipboard.rs:97 | open | [linux M] clipboard file lists, HTML and other custom formats, the find text. Linux shows now: text only; the other formats read empty. | || M23 Linux | app/src/workbench/themes.rs:47 | done | [linux S] host color scheme and high contrast from the xdg-desktop-portal Settings. | GPUI's `window_appearance()`, which gpui_linux reads from the portal's `color-scheme`; high contrast stays off, as Chromium on Linux |diff --git a/port/notes.md b/port/notes.mdindex b28508e2780..825074ee5bd 100644--- a/port/notes.md+++ b/port/notes.md@@ -987,6 +987,7 @@ What to do (milestone 21, in order):- Package (`port/tools/package-linux`, the app files from `port/tools/app-files.ts`): `VSRustium-linux-<arch>/` as VS Code's Linux archive lays it out, the release binary named `applicationName` (debug info stripped: `debug = "limited"` stays in the ELF on Linux, 571 MB with it) beside bun, `bin/vsrustium` from upstream's `resources/linux/bin/code.sh`, `com.rokartur.vsrustium.desktop` from upstream's `resources/linux/code.desktop` (Exec is `vsrustium` on PATH, as an archive does not know where it is unpacked; `StartupWMClass` is `product.linuxDesktopName`, which the windows set as their X11 WM_CLASS and Wayland app id) with `vsrustium.png` (`port/AppIcon.png`, ictool's 512 px render of `port/AppIcon.icon`), the app files in `resources/app` (`product::BUNDLED_APP`, which the binary takes as its root when it is there). Native modules built for another system or arch are rebuilt with node-gyp from their source; a binding.gyp that builds nothing on Linux (@vscode/fs-copyfile) leaves the module out, any other foreign binary fails the package. It writes `VSRustium-<version>-linux-<arch>.tar.gz` and the `linux-<arch>.json` and `linux-<arch>-prerelease.json` feed entries (`gallery::CURRENT_TARGET_PLATFORM` is `linux-<arch>` on Linux, for the gallery and the update feed). arm64 1.147.0: folder 412 MB, archive 131 MB; the extracted archive passes `port/tools/linux/smoke` with `APP=<folder>/vsrustium` in a container without the reference mounted. linux-x64 builds on GitHub Actions (`.github/workflows/linux.yml`, run by hand, the README's build steps with upstream's pnpm install building the native modules for Linux). The binary needs the glibc it links: GLIBC_2.39 for both (Debian 13's container, the ubuntu-24.04 runner; ubuntu-latest, 26.04, asked for 2.43 and the x64 package did not start on Debian 13).- Desktop services over D-Bus (zbus 5, the one gpui_linux's ashpd and oo7 build; blocking proxies on their own threads, each service optional): power (`power/linux.rs`) takes idle time from Mutter's IdleMonitor, else the ScreenSaver service's `GetSessionIdleTime`; the lock state from logind's session `LockedHint`; the power source from UPower's `OnBattery`; `prevent-display-sleep` is a ScreenSaver `Inhibit` cookie and `prevent-app-suspension` a logind `sleep` inhibitor fd; the events are logind's `PrepareForSleep` and `PrepareForShutdown`, as Electron has no lock, battery, thermal or speed limit events on Linux. A blocker the bus refuses still counts as started, as Electron's map of ids. Metered is NetworkManager's `Metered` (`YES` or `GUESS_YES`), the screen reader AT-SPI's `org.a11y.Status` `ScreenReaderEnabled`, reduced motion the portal's `org.gnome.desktop.interface` `enable-animations` (Chromium follows GTK's `gtk-enable-animations`). None of these ran against a desktop session yet: the container has no session or system bus.- Secrets (`exthost/src/main_thread_secret_state.rs`) are Secret Service items of the default collection through oo7 (gpui_linux's version and features), with keytar's `service` and `account` attributes; the test runs the flow on oo7's file keyring.+- Webviews (`app/src/webview/linux.rs`, the host page and its answers shared with macOS in `webview.rs`) are WebKitGTK 4.1 views, each in an undecorated GTK popup window whose X window is reparented into GPUI's; a notebook's back layer webview sits in a clip window whose X input shape passes presses through to GPUI outside the outputs. GTK runs on GPUI's main thread, iterated every 8 ms (`pump_gtk`). Keyboard focus moves with `XSetInputFocus` (a reparented window gets none from the window manager); Cut, Copy and Paste run WebKitGTK's editing commands. WebKitGTK refuses a URI scheme handler on `https`, so each view's ephemeral context sets a loopback proxy as its https proxy: `CONNECT` to `*.vscode-webview.vscode-cdn.net` and `*.vscode-resource.vscode-cdn.net` is answered over TLS with a process-local self-signed certificate the context trusts for those hosts only (the host page's files, and resources as the macOS scheme handler reads them), every other host is tunneled. OpenSSL serves that TLS: GnuTLS, glib-networking's backend, refuses a resource host's SNI (`file+.vscode-resource...`, the `+` is no DNS character). The proxy answers only connections /proc/net/tcp shows as the app user's. Wayland sessions show no webview (GPUI has no X window there; the open M23 row).- Updates follow updateService.linux.ts: a found build waits in AvailableForDownload (no metered deferral, no Squirrel read-only check) and Download opens product.json `downloadUrl`, else the update's url, and goes back to Idle. The running build counts as installed when its executable sits beside `resources/app`.- Accessibility signal sounds run `pw-play`, else `paplay` (both decode mp3 through libsndfile 1.1 or later), one process per sound file, killed when the sound replays.- The `code` shell command on Linux links `~/.local/bin/<applicationName>` to the archive's `bin/<applicationName>` without a privilege prompt (upstream has the command on macOS only; a Linux package puts it on PATH itself). Proxy `<local>` adds the request's host to `--noproxy` when it has no dot, curl has no such rule. Machine info reads `/proc/cpuinfo`, `/proc/meminfo` and the cpufreq `scaling_cur_freq`.diff --git a/port/tools/linux/smoke b/port/tools/linux/smokeindex 5854d61c6aa..213ec9407c9 100755--- a/port/tools/linux/smoke+++ b/port/tools/linux/smoke@@ -1,7 +1,8 @@#!/bin/bash# Runs the Linux release build under Xvfb in the Linux container (port/tools/linux-build port/tools/linux/smoke): opens a# git repository copy of port/fixtures/workspace and runs port/fixtures/extensions/linux-smoke-tests in it (git and emmet-# activate, an edit saves to disk). APP overrides the binary.+# activate, an edit saves to disk). APP overrides the binary; FIXTURE=webview-tests runs that fixture instead, as+# port/tools/webview-check does on macOS.set -uo pipefailREF=$(cd upstream && pwd -P)# A packaged app (APP=<folder>/vsrustium) runs its own resources/app/extensions; the dev build the reference's.@@ -16,7 +17,7 @@ export DISPLAY=:99cp -R port/fixtures/workspace "$dir/workspace"git -C "$dir/workspace" init -q && git -C "$dir/workspace" add -A && git -C "$dir/workspace" -c user.name=smoke -c user.email=smoke@localhost commit -qm fixture-tests=$PWD/port/fixtures/extensions/linux-smoke-tests+tests=$PWD/port/fixtures/extensions/${FIXTURE:-linux-smoke-tests}timeout 300 "$APP" "$dir/workspace" --user-data-dir "$dir/user-data" --skip-welcome --disable-workspace-trust \--extensionDevelopmentPath="$tests" --extensionTestsPath="$tests/tests" >"$dir/log" 2>&1code=$?