Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions eng/testing/BrowserVersions.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project>
<PropertyGroup>
<linux_ChromeVersion>146.0.7680.80</linux_ChromeVersion>
<linux_ChromeRevision>1582197</linux_ChromeRevision>
<linux_ChromeBaseSnapshotUrl>https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1582214</linux_ChromeBaseSnapshotUrl>
<linux_ChromeVersion>147.0.7727.55</linux_ChromeVersion>
<linux_ChromeRevision>1596535</linux_ChromeRevision>
<linux_ChromeBaseSnapshotUrl>https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1596545</linux_ChromeBaseSnapshotUrl>
<linux_V8Version>14.6.202</linux_V8Version>
<macos_ChromeVersion>143.0.7499.40</macos_ChromeVersion>
<macos_ChromeRevision>1536371</macos_ChromeRevision>
Expand Down
51 changes: 51 additions & 0 deletions src/tasks/WasmBuildTasks/UpdateChromeVersions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -238,6 +259,36 @@ async Task<string> 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<bool> 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<Stream> GetDownloadFileStreamAsync(string filename, string url)
{
string filePath = Path.Combine(IntermediateOutputPath, filename);
Expand Down
Loading