Class WebEngineSupportTable

java.lang.Object
com.iizix.server.webengine.WebEngineSupportTable

public final class WebEngineSupportTable extends Object
The web-engine support table: which Android versions no longer receive a patched engine, the day each Chrome major was first served, and which iOS majors are still patched (design CC-DESIGN-WEBVIEW-WARNING sections 5.1 and 5.2, work order CC-WEBENGINE-CLASSIFIER). Immutable once built.

Only data, never text. The table carries versions, dates and source notes; nothing in it is ever shown to an end user, so a table from an override file or an online refresh cannot put a URL or a sentence in front of anyone.

Bounds on load (section 5.1). A table is rejected WHOLE, with one WARNING, when: its format is not 1; a Chrome major (a firstStable key or an Android lastMajor) is outside 50..999; a date is before 2008-09-02 (Chrome's first release) or more than 60 days after today; it has more than 500 entries in all; the first-stable dates go backwards as the major grows; an iOS status is unknown; a required member is missing or has the wrong type; or the file is larger than 262144 bytes. Members not named here are ignored.

Sources, in precedence (section 5.2, load(Path,Path,LocalDate)):

  1. the admin override file, the whole table;
  2. the online cache, for chromium.firstStable only, over the bundled Android and iOS facts, unless its asOf day is before the bundled table's: a cache older than the table the server was built with is skipped with one INFO line (CC-WEBENGINE-REFRESH);
  3. the bundled resource "webengine-support.json" of this package.
A source that is absent is skipped; one that fails to load or to pass the bounds is skipped with one WARNING. With no usable source at all the table is EMPTY, and the classifier then calls every engine PATCHED or NOT_ASSESSED (fail-open).

"Today" is a parameter everywhere: nothing here reads a clock.

Author:
Christopher Mindus
  • Field Details

    • FORMAT

      public static final int FORMAT
      The table format this class reads.
      See Also:
    • RESOURCE

      public static final String RESOURCE
      The bundled table, a resource beside this class.
      See Also:
    • MIN_MAJOR

      public static final int MIN_MAJOR
      The smallest Chrome major accepted.
      See Also:
    • MAX_MAJOR

      public static final int MAX_MAJOR
      The largest Chrome major accepted.
      See Also:
    • MAX_ENTRIES

      public static final int MAX_ENTRIES
      The most entries accepted, all sections together.
      See Also:
    • MAX_FUTURE_DAYS

      public static final int MAX_FUTURE_DAYS
      How many days after today a date may lie.
      See Also:
    • MAX_BYTES

      public static final int MAX_BYTES
      The largest table file read, in bytes.
      See Also:
    • MIN_DATE

      public static final LocalDate MIN_DATE
      The earliest date accepted: Chrome's first release.
    • EMPTY

      public static final WebEngineSupportTable EMPTY
      The table with no data at all.
  • Method Details

    • getSource

      public String getSource()
      Gets where the table came from.
      Returns:
      "bundled", "override <file>", "bundled + cache <file>" or "none".
    • getAsOf

      public LocalDate getAsOf()
      Gets the table's asOf day, so that a stale table is visible.
      Returns:
      The day, or null for EMPTY.
    • getMinSupportedAndroid

      public String getMinSupportedAndroid()
      Gets the oldest Android version still given new engines.
      Returns:
      E.g. "10", or null when not known.
    • getAndroidEnded

      Gets the ended Android versions.
      Returns:
      The read-only map by Android major.
    • getFirstStable

      public NavigableMap<Integer, LocalDate> getFirstStable()
      Gets the first-stable days of the Chrome majors.
      Returns:
      The read-only map by major.
    • getIOSMajors

      Gets the iOS majors.
      Returns:
      The read-only map by iOS major.
    • toString

      public String toString()
      The source, the asOf day and the entry counts.
      Overrides:
      toString in class Object
    • load

      public static WebEngineSupportTable load(Path overrideFile, Path cacheFile, LocalDate today)
      Loads the table from its sources in precedence (section 5.2): the override file whole, else the bundled table with the Chromium dates of the cache file when that loads and is not older than the bundled table, else the bundled table alone, else EMPTY. Never throws: every failure is one WARNING and the next source; an older cache is one INFO line.
      Parameters:
      overrideFile - The admin override file ($webEngine.dataFile), or null for none.
      cacheFile - The online cache file, or null for none. An absent file is not an error: no refresh has run yet.
      today - Today, for the date bound.
      Returns:
      The table, never null.
    • loadBundled

      public static WebEngineSupportTable loadBundled(LocalDate today)
      Loads the bundled table, the resource "webengine-support.json" beside this class.
      Parameters:
      today - Today, for the date bound.
      Returns:
      The table, or EMPTY with one WARNING when the resource is missing or fails its bounds.
    • parse

      public static WebEngineSupportTable parse(String json, LocalDate today, String source)
      Parses a whole table and applies every bound.
      Parameters:
      json - The table text.
      today - Today, for the date bound.
      source - Where it came from, for getSource().
      Returns:
      The table.
      Throws:
      IllegalArgumentException - If the text is not a table in format 1 or fails a bound; the message says which.