随着双方互飙版本号,Chrome 和 Firefox 的开发人员均表达出对 100 以上的三位数版本号的担忧。

Chrome and Firefox developers have both expressed concerns about three-digit version numbers above 100 as the two sides compete for version numbers.

Twelve years ago, when the then-popular browser first reached version 10, many issues were found in the User-Agent parsing library as the major version number changed from one digit to two digits. In the absence of a specification to follow, different browsers have different formats for User-Agent strings and site-specific User-Agent parsing,

Also, some UA parsing libraries may have coding logic errors by not taking into account the three-digit major version number. However, when the browser version number changed from one digit to two digits, many UA parsing libraries improved the parsing logic, so there should be no problem with the three-digit version number in the UA parsing library.

Mike Taylor, an engineer on the Chrome team, investigated common UA ​​parsing libraries and found no issues. A few issues were discovered while running Chrome experiments in the field, which are in the process of being resolved.

coping plan

Both Firefox and Chrome are experimenting with setting the major version number of the current version of the browser to 100 to detect possible problems with websites. This type of experiment found some possible issues, some of which have been fixed, and the experiment will continue to run until version 100 is released.

In addition, each browser manufacturer has developed a backup mitigation strategy for the 100 version number, in order to prevent the 100 version from being released to the stable channel suddenly and causing irreversible damage to some websites.

Firefox mitigation

In Firefox, mitigation strategies will depend on the severity of the damage.

Firefox has a site intervention mechanism that the Mozilla webcompat team can use to hotfix broken websites in Firefox. Type about:compat into the Firefox URL bar to see what's currently being fixed.

If a site breaks when the major version is 100 on a particular domain, it can be fixed by sending version 99. If the damage is widespread and the intervention of individual sites becomes unmanageable, Mozilla can temporarily freeze the major version of Firefox at 99 and then test other options.

Chrome mitigation

User-Agent strings reported in Chrome versions follow this pattern: <major_version>.<minor_version>.<build_number>.<patch_number> (major_minor_build_patch).

The current alternative in Chrome is to directly freeze the major version number in the User-Agent string at 99, and then report the real major version number in the minor version section (the relevant code has already landed). If using a backup plan, the User-Agent string for Chrome 101 will look like this: 99.101.4988.0 , 99

Since the minor version number in the Chrome UA string has been 0 for a long time, Chrome is still experimenting to ensure that writing a three-digit value in the minor version number part doesn't cause bugs.

The Chrome team will decide whether to use the backup option based on the number and severity of reported issues.

Users can participate in the test

In Chrome and Firefox Nightly, users can also manually change the version number of the browser to 100, and then test whether there is any problem in daily use.

Firefox Nightly

Open Firefox Nightly's settings menu.
Search for "Firefox 100" and check the "Firefox 100 User-Agent String" option.

Chrome

Enter chrome://flags/#force-major-version-to-100 in the URL bar
Set the option to "Enabled".
If you're a site maintainer, test your site with Chrome and Firefox 100, check the User-Agent parsing code and libraries, and make sure they can handle three-digit version numbers, see the site patterns that are currently being affected here. https://www.otsukare.info/2022/01/14/broken-ua-detection

If you develop a User-Agent parsing library, add tests to resolve version numbers greater than or equal to 100. Early testing by browser vendors has shown that the latest versions of the UA parsing library handle it correctly. But if you have an older version of the parsing library, it's time to check and upgrade.
If you are a browser user and notice any issues with major version 100 while browsing the web, please file a report on webcompat.com. https://webcompat.com/issues/new?label=version100

12 年前,当时流行的浏览器在首次达到版本 10 时,由于主要版本号从一位数变为两位数,在 User-Agent 解析库中发现了许多问题。在没有规范可遵循的情况下,不同的浏览器对 User-Agent 字符串和特定于站点的 User-Agent 解析具有不同的格式,

此外,由于没有考虑到三位主要版本号,一些 UA 解析库可能有编码逻辑上的错误。不过当年浏览器版本号从一位数变成两位数时,许多 UA 解析库都改进了解析逻辑,因此,三位数的版本号在 UA 解析库中应该不会出什么问题。

Chrome 团队的工程师 Mike Taylor 对常见的 UA 解析库进行了调查,但没有发现任何问题。在现场运行 Chrome 实验时发现了一些问题,这些问题正在解决中。

应对方案

Firefox 和 Chrome 都在进行实验,尝试把当前版本的浏览器的主要版本号设置成 100,以检测网站可能出现的问题。这类实验找到了一些可能出现的问题,其中一部分已经修复,实验将继续运行,直到版本 100 发布。

除此之外,每个浏览器厂商都对 100 版本号制定了备份的缓解策略,以防止 100 版发布到稳定渠道后突发恶疾,对一些网站造成不可逆的伤害。

Firefox 缓解

在 Firefox 中,缓解策略将取决于损坏的重要性。

Firefox 有一个站点干预机制,Mozilla webcompat 团队可以使用这种机制在 Firefox 中热修复损坏的网站。在 Firefox URL 栏中输入内容 about:compat就可以看到当前正在修复的内容。

如果站点在特定域上的主要版本为 100 时中断,则可以通过发送 版本 99 来修复它。如果破坏范围很广,并且个别站点的干预变得难以管理,Mozilla 可以将 Firefox 的主要版本暂时冻结在 99,然后测试其他选项。

Chrome 缓解

Chrome 版本中报告的 User-Agent 字符串遵循该模式: <major_version>.<minor_version>.<build_number>.<patch_number>(主要版本号_次要版本号_构建号_补丁号)。

目前在 Chrome  中的备用方案是直接将 User-Agent 字符串中的主要版本号冻结在 99,然后在次要版本部分报告真正的主要版本号(相关代码已经登陆)。如果使用备份计划,则 Chrome 101 版本 的 User-Agent 字符串将如下所示:99.101.4988.0 ,99

由于 Chrome UA 字符串中的次要版本号很长一段时间都是 0,所以 Chrome 还在进行实验,以确保次要版本号部分写三位数的值不会导致 Bug。

Chrome 团队将根据报告的问题的数量和严重程度决定是否使用备份选项。

用户可参与测试

在 Chrome 和 Firefox Nightly 中,用户也可以手动把浏览器的版本号改成 100 ,然后测试日常使用有没有问题。

Firefox Nightly

  1. 打开 Firefox Nightly 的设置菜单。
  2. 搜索“Firefox 100”,然后选中“Firefox 100 User-Agent String”选项。

Chrome 

  1. URL 栏输入 chrome://flags/#force-major-version-to-100
  2. 将选项设置为“启用”。
  • 如果你是网站维护者,请使用 Chrome 和 Firefox 100 测试网站,检查 User-Agent 解析代码和库,并确保它们能够处理三位数的版本号,在此可查看目前正在受影响的网站模式。 https://www.otsukare.info/2022/01/14/broken-ua-detection
  • 如果你开发一个 User-Agent 解析库,添加测试来解析大于等于 100 的版本号。浏览器厂商早期的测试表明,最新版本的 UA 解析库都可以正确处理它。但如果你有旧版本的解析库,是时候检查并升级了。
  • 如果你是浏览器用户,在浏览网页时发现主要版本 100 有任何问题,请在 webcompat.com 上提交报告。https://webcompat.com/issues/new?label=version100
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。