diff --git a/eng/testing/BrowserVersions.props b/eng/testing/BrowserVersions.props index ba53f87c1a1595..898f5c773d6072 100644 --- a/eng/testing/BrowserVersions.props +++ b/eng/testing/BrowserVersions.props @@ -1,8 +1,8 @@ - 146.0.7680.80 - 1582197 - https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1582214 + 147.0.7727.55 + 1596535 + https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1596545 14.6.202 143.0.7499.40 1536371 diff --git a/src/tasks/WasmBuildTasks/UpdateChromeVersions.cs b/src/tasks/WasmBuildTasks/UpdateChromeVersions.cs index 5c0bf2c413043b..633dbe7ce7584a 100644 --- a/src/tasks/WasmBuildTasks/UpdateChromeVersions.cs +++ b/src/tasks/WasmBuildTasks/UpdateChromeVersions.cs @@ -22,6 +22,7 @@ public partial class UpdateChromeVersions : MBU.Task { private const string s_fetchReleasesUrl = "https://chromiumdash.appspot.com/fetch_releases?channel={0}&num=1"; private const string s_snapshotBaseUrl = $"https://storage.googleapis.com/chromium-browser-snapshots"; + private const string s_v8CanaryBaseUrl = "https://storage.googleapis.com/chromium-v8/official/canary"; private const int s_versionCheckThresholdDays = 1; private static readonly HttpClient s_httpClient = new(); @@ -195,6 +196,26 @@ private static void UpdateNodeValue(XmlDocument xmlDoc, string nodeName, string } string foundV8Version = await FindV8VersionFromChromeVersion(foundRelease.version).ConfigureAwait(false); + + // Validate that a prebuilt V8 binary exists on the CDN that jsvu uses for downloading. + if (!await IsV8BinaryAvailableAsync(osPrefix, foundV8Version).ConfigureAwait(false)) + { + string v8BinaryUrl = GetV8BinaryUrl(osPrefix, foundV8Version); + Log.LogWarning($"V8 binary not available at {v8BinaryUrl} — keeping the existing V8 version for {osIdentifier}."); + + // Fall back to the existing V8 version from BrowserVersions.props + XmlDocument existingDoc = new XmlDocument(); + existingDoc.Load(ChromeVersionsPath); + string existingV8VersionNodeName = string.Equals(osIdentifier, "linux", StringComparison.OrdinalIgnoreCase) + ? "linux_V8Version" + : string.Equals(osIdentifier, "windows", StringComparison.OrdinalIgnoreCase) + ? "win_V8Version" + : throw new LogAsErrorException($"Unknown OS identifier '{osIdentifier}' for V8 version fallback"); + foundV8Version = GetNodeValue(existingDoc, existingV8VersionNodeName); + if (string.IsNullOrEmpty(foundV8Version)) + throw new LogAsErrorException($"V8 binary for {osIdentifier} not available on CDN and no existing version found in {ChromeVersionsPath}"); + } + ChromeVersionSpec versionSpec = new(os: foundRelease.platform, channel: Channel, version: foundRelease.version, @@ -238,6 +259,36 @@ async Task FindV8VersionFromChromeVersion(string chromeVersion) } } + private static string GetV8BinaryUrl(string osPrefix, string v8Version) + { + string jsvuPlatform = osPrefix switch + { + "Linux_x64" => "linux64", + "Win_x64" => "win32", + _ => throw new ArgumentException($"Unknown OS prefix '{osPrefix}' for V8 binary URL") + }; + return $"{s_v8CanaryBaseUrl}/v8-{jsvuPlatform}-rel-{v8Version}.zip"; + } + + private async Task IsV8BinaryAvailableAsync(string osPrefix, string v8Version) + { + string url = GetV8BinaryUrl(osPrefix, v8Version); + Log.LogMessage(MessageImportance.Low, $"Checking if V8 binary exists at {url} ..."); + try + { + using HttpRequestMessage request = new(HttpMethod.Head, url); + using HttpResponseMessage response = await s_httpClient + .SendAsync(request, HttpCompletionOption.ResponseHeadersRead) + .ConfigureAwait(false); + return response.StatusCode == HttpStatusCode.OK; + } + catch (HttpRequestException hre) + { + Log.LogWarning($"Failed to check V8 binary availability at {url}: {hre.Message}"); + return false; + } + } + private async Task GetDownloadFileStreamAsync(string filename, string url) { string filePath = Path.Combine(IntermediateOutputPath, filename);