缓存时间:
2026/06/30 13:38
# 五月在 Servo:用户脚本、mp4 兼容、开发者工具中的黑盒调试等更多功能! - Servo 旨在为开发者提供一种轻量级、高性能的替代方案,用于在应用中嵌入 Web 技术。来源:https://servo.org/blog/2026/06/30/may-in-servo/ **Servo 0.3.0** (https://github.com/servo/servo/releases/tag/v0.3.0) 包含了我们在五月完成的所有变更,共计 **391 次提交**(三月:534 次)。关于安全修复,请参见 **§ 安全** (https://servo.org/blog/2026/06/30/may-in-servo/#security)。 servoshell 0.3.0 展示了多个新特性:`document.execCommand()` 命令“backColor”、“createLink”、“unlink”、“superscript”、“subscript”和“removeFormat”,以及“font-kerning”和“font-variant-ligatures” (https://servo.org/img/blog/2026-06-diffie.png) 我们发布了几项新的 Web 平台特性: - **'font‑kerning: none'** (@simonwuelker (https://github.com/simonwuelker), #44634 (https://github.com/servo/servo/pull/44634)) - **'font‑variant‑east‑asian'** (@simonwuelker (https://github.com/simonwuelker), #44989 (https://github.com/servo/servo/pull/44989)) - **'font‑variant‑ligatures'** (@simonwuelker (https://github.com/simonwuelker), #44903 (https://github.com/servo/servo/pull/44903)) - **'font‑variant‑numeric'** (@simonwuelker (https://github.com/simonwuelker), #44950 (https://github.com/servo/servo/pull/44950)) - **'font‑variant‑position'** (@simonwuelker (https://github.com/simonwuelker), #45142 (https://github.com/servo/servo/pull/45142)) - **mp4 文件**(不含 fast start)在 **WebCodecs 中** (@calvaris (https://github.com/calvaris), #45084 (https://github.com/servo/servo/pull/45084)) - **`text‑decoration‑thickness`** (@yezhizhen (https://github.com/yezhizhen), #45028 (https://github.com/servo/servo/pull/45028)) - **`text‑underline‑offset`** (@yezhizhen (https://github.com/yezhizhen), #45111 (https://github.com/servo/servo/pull/45111)) - **`<![CDATA[]]>` 布局** (@mrobinson (https://github.com/mrobinson), #44791 (https://github.com/servo/servo/pull/44791)) 此外还新增了一批 DOM API: - **ShadowRoot 上的 onslotchange 属性** (@jdm (https://github.com/jdm), #44688 (https://github.com/servo/servo/pull/44688)) - **Window 上的 screenLeft 和 screenTop** (@TG199 (https://github.com/TG199), #45128 (https://github.com/servo/servo/pull/45128)) - **new Blob() 支持 `{endings: "native"}`** (@yezhizhen (https://github.com/yezhizhen), #44803 (https://github.com/servo/servo/pull/44803)) - **new PerformanceMark()** (@shubhamg13 (https://github.com/shubhamg13), #44702 (https://github.com/servo/servo/pull/44702)) - **Document 上的 parseHTML()** (@kkoyung (https://github.com/kkoyung), #44952 (https://github.com/servo/servo/pull/44952)) - **FileReader 上的 readAsBinaryString()** (@yezhizhen (https://github.com/yezhizhen), #44858 (https://github.com/servo/servo/pull/44858), #44921 (https://github.com/servo/servo/pull/44921)) - **performance.measure() 支持标记值 'redirectStart'、'redirectEnd'、'secureConnectionStart' 和 'responseEnd'** (@shubhamg13 (https://github.com/shubhamg13), #44673 (https://github.com/servo/servo/pull/44673), #44624 (https://github.com/servo/servo/pull/44624), #44850 (https://github.com/servo/servo/pull/44850), #44739 (https://github.com/servo/servo/pull/44739)) 我们还修复了 Windows (@mukilan (https://github.com/mukilan), #45079 (https://github.com/servo/servo/pull/45079))、FreeBSD (@delan (https://github.com/delan), @mrobinson (https://github.com/mrobinson), @mukilan (https://github.com/mukilan), #44600 (https://github.com/servo/servo/pull/44600)) 以及在使用 NixOS 或 Nix 构建 Servo 时 (@freyacodes (https://github.com/freyacodes), #45051 (https://github.com/servo/servo/pull/45051), #45135 (https://github.com/servo/servo/pull/45135)) 的一些构建问题。 这是一次大更新,以下是概要: - **安全** (https://servo.org/blog/2026/06/30/may-in-servo/#security) – 内存安全修复 - **进行中的工作** (https://servo.org/blog/2026/06/30/may-in-servo/#work-in-progress) – execCommand()、Sanitizer、IndexedDB、无障碍、Worker - **嵌入 API** (https://servo.org/blog/2026/06/30/may-in-servo/#embedding-api) – MSRV、Cookie、偏好设置、诊断 - **面向用户和开发者** (https://servo.org/blog/2026/06/30/may-in-servo/#for-users-and-developers) – `--host-file`、`--userscripts`、DevTools 调试器 - **更多 Web 平台相关内容** (https://servo.org/blog/2026/06/30/may-in-servo/#more-on-the-web-platform) – 焦点、表单、导航、SubtleCrypto、WebGPU - **性能** (https://servo.org/blog/2026/06/30/may-in-servo/#performance) – about:memory、线程、布局、DOM、构建时间 - **稳定性** (https://servo.org/blog/2026/06/30/may-in-servo/#stability) – 崩溃、挂起、静态分析 ## 安全https://servo.org/blog/2026/06/30/may-in-servo/#security Servo 的 JS 运行时 **SpiderMonkey 140.10.0** 中存在若干 **内存安全错误**,已在 Servo 0.3.0 中通过更新至 SpiderMonkey 140.10.1 修复(@jschwe (https://github.com/jschwe), #44755 (https://github.com/servo/servo/pull/44755))。更多详情请参阅 CVE-2026-7322 (https://nvd.nist.gov/vuln/detail/CVE-2026-7322)、CVE-2026-7323 (https://nvd.nist.gov/vuln/detail/CVE-2026-7323) 和 MFSA 2026-36 (https://www.mozilla.org/en-US/security/advisories/mfsa2026-36/)。 ## 进行中的工作https://servo.org/blog/2026/06/30/may-in-servo/#work-in-progress 我们继续在 **document.execCommand()** 实现 **富文本编辑**,通过 `--pref dom_exec_command_enabled` 启用(@TimvdLippe (https://github.com/TimvdLippe), #44735 (https://github.com/servo/servo/pull/44735), #44973 (https://github.com/servo/servo/pull/44973), #44887 (https://github.com/servo/servo/pull/44887))。此版本新增了对 **'backColor'**、**'foreColor'**、**'createLink'**、**'unlink'**、**'superscript'**、**'subscript'** 和 **'removeFormat'** 命令的支持(@TimvdLippe (https://github.com/TimvdLippe), #44644 (https://github.com/servo/servo/pull/44644), #44682 (https://github.com/servo/servo/pull/44682), #44657 (https://github.com/servo/servo/pull/44657), #44710 (https://github.com/servo/servo/pull/44710), #44677 (https://github.com/servo/servo/pull/44677)),以及对 **'insertParagraph'** 命令的部分支持(@TimvdLippe (https://github.com/TimvdLippe), #44909 (https://github.com/servo/servo/pull/44909))。 我们还在开发 **Sanitizer** API,通过 `--pref dom_sanitizer_enabled` 启用。随着该特性在 servoshell 的实验模式下启用(@kkoyung (https://github.com/kkoyung), #44701 (https://github.com/servo/servo/pull/44701)),此版本新增了对 **setComments()**、**setDataAttributes()**、**allowProcessingInstruction()**、**removeProcessingInstruction()** 和 **removeUnsafe()** 在 **Sanitizer** 上的支持(@kkoyung (https://github.com/kkoyung), #44734 (https://github.com/servo/servo/pull/44734), #44983 (https://github.com/servo/servo/pull/44983))。 **IndexedDB** 持续改进,通过 `--pref dom_indexeddb_enabled` 启用。此版本带来了更符合标准的 **IDBTransaction 上的 abort()**(@Taym95 (https://github.com/Taym95), #43950 (https://github.com/servo/servo/pull/43950))。 上述所有特性均在 servoshell 的实验模式下启用。 我们在 **无障碍** 支持方面取得了更多进展,包括 **name from contents** (https://w3c.github.io/aria/#namefromcontent) 算法(@alice (https://github.com/alice), @delan (https://github.com/delan), @mrobinson (https://github.com/mrobinson), #44439 (https://github.com/servo/servo/pull/44439))以及若干朝着 **增量构建无障碍树** 方向的更改(@alice (https://github.com/alice), @delan (https://github.com/delan), @mrobinson (https://github.com/mrobinson), #44766 (https://github.com/servo/servo/pull/44766), #45035 (https://github.com/servo/servo/pull/45035), #45207 (https://github.com/servo/servo/pull/45207), #44768 (https://github.com/servo/servo/pull/44768), #44785 (https://github.com/servo/servo/pull/44785), #44801 (https://github.com/servo/servo/pull/44801), #44767 (https://github.com/servo/servo/pull/44767), #45029 (https://github.com/servo/servo/pull/45029))。后者对于真实 Web 内容的性能至关重要。 我们现在正在开发 **SharedWorker** 和 **ServiceWorker**,分别通过 `--pref dom_sharedworker_enabled` 和 `--pref dom_serviceworker_enabled` 启用。此版本新增了对 **new SharedWorker()** 的支持(@Taym95 (https://github.com/Taym95), #44761 (https://github.com/servo/servo/pull/44761)),以及 ServiceWorker API 的部分内容(@gterzian (https://github.com/gterzian), @arihant2math (https://github.com/arihant2math), #45082 (https://github.com/servo/servo/pull/45082), #44787 (https://github.com/servo/servo/pull/44787))。 ## 嵌入 APIhttps://servo.org/blog/2026/06/30/may-in-servo/#embedding-api Servo 现在需要 **Rust 1.88.0 或更高版本**,之前的 MSRV 为 1.86.0(@sagudev (https://github.com/sagudev), #44815 (https://github.com/servo/servo/pull/44815))。我们使用 MSRV 运行编译测试,但大部分测试现在使用 Rust 1.95.0 进行(@simonwuelker (https://github.com/simonwuelker), #44632 (https://github.com/servo/servo/pull/44632))。 **破坏性变更**:对 **SiteDataManager** (https://doc.servo.org/servo/struct.SiteDataManager.html) API 中的 **cookies** 方法(@longvatrong111 (https://github.com/longvatrong111), #44708 (https://github.com/servo/servo/pull/44708)): - `SiteDataManager` (https://doc.servo.org/servo/struct.SiteDataManager.html)::`clear_cookies` (https://doc.servo.org/servo/struct.SiteDataManager.html#method.clear_cookies) 现在增加了一个 `callback` 参数,支持异步调用 – 若继续同步调用,请传递 `None` 作为 `callback` - `SiteDataManager` (https://doc.servo.org/servo/struct.SiteDataManager.html)::`clear_session_cookies` (https://doc.servo.org/servo/struct.SiteDataManager.html#method.clear_session_cookies) 现在增加了一个 `callback` 参数,支持异步调用 – 若继续同步调用,请传递 `None` 作为 `callback` - `SiteDataManager` (https://doc.servo.org/servo/struct.SiteDataManager.html)::`set_cookie_for_url` (https://doc.servo.org/servo/struct.SiteDataManager.html#method.set_cookie_for_url) 现在增加了一个 `callback` 参数,支持异步调用 – 若继续同步调用,请传递 `None` 作为 `callback` - `SiteDataManager` (https://doc.servo.org/servo/struct.SiteDataManager.html)::`set_cookie_for_url_async` 已被移除,请改用 `set_cookie_for_url` (https://doc.servo.org/servo/struct.SiteDataManager.html#method.set_cookie_for_url) – 迁移时,将 `set_cookie_for_url_async(callback)` 替换为 `set_cookie_for_url(Some(Box::new(callback)))` **破坏性变更**:对 **Preferences** (https://doc.servo.org/servo/struct.Preferences.html) API(@Narfinger (https://github.com/Narfinger), @mrobinson (https://github.com/mrobinson), #44307 (https://github.com/servo/servo/pull/44307)): - `threadpools_image_cache_workers_max`、`threadpools_indexeddb_workers_max` 和 `threadpools_webstorage_workers_max` 已被 **移除**,改为使用组合选项 `thread_pool_workers_max` (https://doc.servo.org/servo/struct.Preferences.html#structfield.thread_pool_workers_max) - `threadpools_fallback_worker_num` 已被 **重命名** 为 `thread_pool_fallback_workers` (https://doc.servo.org/servo/struct.Preferences.html#structfield.thread_pool_fallback_workers) - `threadpools_async_runtime_workers_max` 已被 **重命名** 为 `thread_pool_async_runtime_workers_max` (https://doc.servo.org/servo/struct.Preferences.html#structfield.thread_pool_async_runtime_workers_max) - `threadpools_webrender_workers_max` 已被 **重命名** 为 `thread_pool_webrender_workers_max` (https://doc.servo.org/servo/struct.Preferences.html#structfield.thread_pool_webrender_workers_max) 我们还重新设计了 **DiagnosticsLogging** (https://doc.servo.org/servo/struct.DiagnosticsLogging.html) API(@mukilan (https://github.com/mukilan), #44703 (https://github.com/servo/servo/pull/44703)): - 现在可以使用 `DiagnosticsLogging` (https://doc.servo.org/servo/struct.DiagnosticsLogging.html)::`toggle_option` (https://doc.servo.org/servo/struct.DiagnosticsLogging.html#method.toggle_option) 设置选项,并通过 `DiagnosticsLogging` (https://doc.servo.org/servo/struct.DiagnosticsLogging.html)::`is_enabled` (https://doc.servo.org/servo/struct.DiagnosticsLogging.html#method.is_enabled) 检查是否已启用 - 每个选项是 `DiagnosticsLoggingOption` (https://doc.servo.org/servo/enum.DiagnosticsLoggingOption.html) 的一个变体,这是一个新类型,还提供了在嵌入器 UI 中公开这些选项的有用方法 - **(破坏性变更)** `DiagnosticsLogging` (https://doc.servo.org/servo/struct.DiagnosticsLogging.html) 不再有表示每个选项的 `pub` 字段 – 迁移时,请分别将字段写入和字段读取替换为 `toggle_option` (https://doc.servo.org/servo/struct.DiagnosticsLogging.html#method.toggle_option) 和 `is_enabled` (https://doc.servo.org/servo/struct.DiagnosticsLogging.html#method.is_enabled) - **(破坏性变更)** `DiagnosticsLogging` (https://doc.servo.org/servo/struct.DiagnosticsLogging.html)::`extend_from_string` (https://doc.servo.org/servo/struct.DiagnosticsLogging.html#method.extend_from_string) 不再接受 `help` 选项 – 此选项仅用于支持 servoshell 的 `-Z help` / `--debug=help` 选项,因此实现它的代码已移至 servoshell ## 面向用户和开发者https://servo.org/blog/2026/06/30/may-in-servo/#for-users-and-developers **servoshell** 新增了两个选项: - 现在可以使用 **--host-file=**(单数)配置 **hosts 文件** (https://en.wikipedia.org/w/index.php?title=Hosts_(file)&oldid=1360805760) 的路径,作为 **HOST_FILE**(单数)环境变量的替代(@jschwe (https://github.com/jschwe), #44880 (https://github.com/servo/servo/pull/44880))。 - 现在可以使用 **--userscripts=** 提供一个包含 **用户脚本** 的目录,这些脚本将在每个文档中运行(@jdm (https://github.com/jdm), #44754 (https://github.com/servo/servo/pull/44754))。 使用 Firefox **DevTools** 中的 **Debugger** 选项卡时: - 现在可以通过点击 **Ignore source** 来“黑盒” (https://antongunnarsson.com/devtools-blackbox/) 一个脚本(@freyacodes (https://github.com/freyacodes), #44359 (https://github.com/servo/servo/pull/44359))。这可以防止断点在该脚本内被触发,并且应该还允许你在调试器中逐步执行而不在该脚本内暂停。 - **Scopes** 面板现在更加准确(@atbrakhi (https://github.com/atbrakhi), @eerii (https://github.com/eerii), #44765 (https://github.com/servo/servo/pull/44765))。 对于 Servo 本身的开发者,请注意,根据项目政策 (https://book.servo.org/contributing/getting-started.html#ai-contributions),你 **不得** 在你的贡献中使用 **大语言模型** 或其他 **生成式 AI 工具** 的输出。为了帮助我们执行此规定,我们现在有 CI 检查来拒绝将 AI 代理列为共同作者(@SimonSapin (https://github.com/SimonSapin), @delan (https://github.com/delan), #44723 (https://github.com/servo/servo/pull/44723))。 我们还修复了使用 `--features vello` 时的构建问题(@Gae24 (https://github.com/Gae24), @yezhizhen (https://github.com/yezhizhen), #44875 (https://github.com/servo/servo/pull/44875), #45036 (https://github.com/servo/servo/pull/45036))。 ## 更多 Web 平台相关内容https://servo.org/blog/2026/06/30/may-in-servo/#more-on-the-web-platform 我们改进了以下元素的默认外观:**`<input type="checkbox">`**、**`<input type="radio">`**、**`<input type="range">`**、**`<input type="search">`**、**`<input type="color">`**、**`<textarea>`**、**`<button>`**、**`<select>`**、**`<progress>`**、**`<meter>`**、**`<details>`** 和 **`<summary>`**(@avis137 (https://github.com/avis137), #44837 (https://github.com/servo/servo/pull/44837), #44920 (https://github.com/servo/servo/pull/44920))。