Class WebEngineClassifier
CC-DESIGN-WEBVIEW-WARNING sections 4 and 6, work order CC-WEBENGINE-CLASSIFIER; the engines of CC-WEBENGINE-STATS-V51 section (c) added for v5.1).Pure. No session, no EnvProps, no clock and no settings: the caller passes the four client values, the table, today and the grace period. The raw user agent comes from DeviceMatch.getUserAgent(env) at the call site. The work is a few regular expressions over at most 1024 characters and a few map lookups, so it is safe on a Jetty I/O thread.
Fail-open. Anything that does not parse is NOT_ASSESSED, and an engine newer than the table knows is PATCHED. The verdict drives no access decision (design D-16): a spoofed user agent can only make a device look patched or unpatched to itself.
Where each version comes from (section 4.1):
- iiziRun on Android: the engine from the user agent's
Chrome/<M>token, the OS fromizr.osversion, which wins over the user agent wheneverizr.cordovais present. - Chrome on Android: the engine from the user agent; the OS from the user agent only when it is not Chrome's reduced
Android 10; K, which every Chrome says whatever the real version. - iOS and iPadOS: the engine is the OS. iiziRun gives
izr.osversion; a Browser givesOS <a>_<b>, overridden byVersion/<n>when n is 26 or more, because the OS token is frozen from iOS 26 on (18_6,18_7). An iPad in desktop mode saysMacintosh; it is iOS only whenizr.platformsays so. - Edge (
Edg/<M>on a desktop,EdgA/<M>on Android;EdgiOSis iOS): the Edge major, against Edge's own first-stable days (WebEngineSupportTable.getEdgeFirstStable()), product "Edge". - Firefox (
Firefox/<M>, desktop and Android;FxiOSis iOS): the Firefox major, against Firefox's release days (WebEngineSupportTable.getFirefoxReleases()); a major that is a current ESR (WebEngineSupportTable.getFirefoxESR()) is PATCHED, since a release and an ESR of one major say the same token; product "Firefox". - Safari on macOS (
Macintosh,Version/<M>,Safari/, no other engine token): the Safari major, which is the OS version it ships with, against the Safari majors (WebEngineSupportTable.getSafariMajors()) as the iOS majors are read; the OS token of a macOS user agent is frozen at10_15_7and says nothing. Product "Safari". - Chrome on a desktop (
Chrome/<M>and no other Browser's token, not Android, not iOS): Chrome's major against the Chrome first-stable days of the table, which are the stable channel's release days (desktop and Android stable majors ship together); product "Chrome", platformWebEngineStatus.Platform.OTHER. - Other Chromium Browsers (
OTHER_CHROMIUM: Samsung Internet, Opera, Yandex, UC, Mi, Huawei, HeyTap, Vivo, Silk, Whale, Vivaldi, Electron), on Android or a desktop: these ship their own patches on their own days, which the table does not know, so the Chromium base major of theirChrome/<M>token is read against Chrome's days and the verdict is marked an approximation in its product text (" (Chromium, approximate)"); a Browser whose Chromium base lags Chrome by design reads BEHIND until it rebases. - Anything else: NOT_ASSESSED (design D-1): a user agent without an engine token, a bot, a headless Chrome (
HeadlessChrome/), Internet Explorer, Opera Mini, KaiOS.
The classification (section 6.1, today in UTC, the grace period in days):
- Android with a known OS that the table lists as ended, on an engine no newer than that OS's last: ENDED since the day that engine stopped being patched. A known OS older than every ended entry: ENDED, day unknown.
- Android otherwise, and every engine read against release days: the next major the table knows above the engine's (Chrome 82 was never shipped, and the table may have gaps). None: PATCHED. Its first-stable day more than the grace period ago: BEHIND since that day. Else PATCHED. An engine older than the whole table is BEHIND, day unknown. A BEHIND Chrome whose OS is hidden and whose engine is the last one of an ended Android version is marked
WebEngineStatus.possiblyEnded()(section 6.2). - iOS, and Safari on macOS: an ended major is BEHIND since its end day (every device can upgrade), with the upgrade target; a major newer than the table, or between two it knows, is PATCHED; one older than the whole table is ENDED, day unknown.
The end-user notice has texts for the Android System WebView, Chrome on Android and iOS only (design section 7.2): hasEndUserNotice(WebEngineStatus) says whether a verdict is one the client may be warned about. The other engines are counted, shown in ServerAdmin and logged, and never warned about on the client (CC-WEBENGINE-STATS-V51).
- Author:
- Christopher Mindus
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe client values the classifier reads, from the client's environment.Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringWhat the product text of an approximated verdict ends with: the Browser's own name, then this (CC-WEBENGINE-STATS-V51), e.g.static final intThe default grace period in days (design D-3): BEHIND only when the next major has been served for longer than this.static final intA user agent longer than this is truncated before matching, asBrowserGatedoes.static final StringThe product name of Chrome.static final StringThe product name of Microsoft Edge (CC-WEBENGINE-STATS-V51).static final StringThe product name of Firefox (CC-WEBENGINE-STATS-V51).static final StringThe product name of the iOS engine.static final StringThe product name of Safari on macOS (CC-WEBENGINE-STATS-V51).static final StringThe product name of the Android WebView.Method Summary
Modifier and TypeMethodDescriptionstatic WebEngineStatusclassify(WebEngineClassifier.Client client, WebEngineSupportTable table, LocalDate today, int graceDays) Classifies a client's web engine.static booleanhasEndUserNotice(WebEngineStatus status) Tests if a verdict is one the end-user notice has a text for: the Android System WebView, Chrome on Android and iOS (design section 7.2).
Field Details
DEFAULT_GRACE_DAYS
public static final int DEFAULT_GRACE_DAYSThe default grace period in days (design D-3): BEHIND only when the next major has been served for longer than this.- See Also:
MAX_USER_AGENT_LENGTH
public static final int MAX_USER_AGENT_LENGTHA user agent longer than this is truncated before matching, asBrowserGatedoes.- See Also:
PRODUCT_WEBVIEW
PRODUCT_CHROME
PRODUCT_IOS
PRODUCT_EDGE
The product name of Microsoft Edge (CC-WEBENGINE-STATS-V51).- See Also:
PRODUCT_FIREFOX
The product name of Firefox (CC-WEBENGINE-STATS-V51).- See Also:
PRODUCT_SAFARI
The product name of Safari on macOS (CC-WEBENGINE-STATS-V51).- See Also:
APPROXIMATE
What the product text of an approximated verdict ends with: the Browser's own name, then this (CC-WEBENGINE-STATS-V51), e.g. "Samsung Internet (Chromium, approximate)".- See Also:
Method Details
classify
public static WebEngineStatus classify(WebEngineClassifier.Client client, WebEngineSupportTable table, LocalDate today, int graceDays) Classifies a client's web engine.- Parameters:
client- The client values.table- The support table.today- Today, UTC.graceDays- The grace period in days; a negative value counts as 0.- Returns:
- The verdict, never null.
hasEndUserNotice
Tests if a verdict is one the end-user notice has a text for: the Android System WebView, Chrome on Android and iOS (design section 7.2). The engines CC-WEBENGINE-STATS-V51 assesses - desktop Browsers, Edge, Firefox, Safari on macOS and the Chromium approximations - have none and are never warned about on the client.- Parameters:
status- The verdict, may be null.- Returns:
- true when the client may be told.