param([string]$ArtifactPath)
$ErrorActionPreference = 'Stop'
$taskRoot = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../..'))
$snapshot = Join-Path $taskRoot ('build/BrowserProbe/Input-' + [DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds())
[void][IO.Directory]::CreateDirectory($snapshot)
$names = @('JavaScriptRuntime.cs','BrowserLimits.cs','BoundedText.cs',
'BrowserHostObject.cs','JavaScriptResult.cs','BrowserDomBootstrap.cs','BrowserDomHost.cs','BrowserEventLoop.cs',
'BrowserDisplayList.cs','CssComputedStyle.cs','BrowserCanvasSurface.cs','BrowserPerformance.cs')
$names += @(Get-ChildItem -LiteralPath (Join-Path $taskRoot 'Source/XFESystem.Browser') -Filter 'DomBridge*.cs' | Select-Object -ExpandProperty Name)
$files = @()
foreach ($name in $names) {
$source = Join-Path $taskRoot ('Source/XFESystem.Browser/' + $name)
$destination = Join-Path $snapshot $name
Copy-Item -LiteralPath $source -Destination $destination
$files += [ordered]@{Name=$name;SourcePath=$source;Sha256=(Get-FileHash -LiteralPath $destination -Algorithm SHA256).Hash.ToLowerInvariant()}
}
foreach ($file in $files) {
if ((Get-FileHash -LiteralPath $file.SourcePath -Algorithm SHA256).Hash.ToLowerInvariant() -ne $file.Sha256) { throw 'The DOM source changed during capture; retry after the owner completes its edit.' }
}
[ordered]@{Kind='BrowserProbeSourceSnapshot';Files=$files;SourceUnchangedDuringCapture=$true} |
ConvertTo-Json -Depth 5 | Set-Content -LiteralPath (Join-Path $snapshot 'SourceSnapshot.json') -Encoding UTF8
if (!$ArtifactPath) { $ArtifactPath = Join-Path $taskRoot 'build/BrowserProbe/CurrentArtifacts' }
$ArtifactPath = [IO.Path]::GetFullPath($ArtifactPath)
& dotnet run --project (Join-Path $PSScriptRoot 'CurrentDomProbe.csproj') --artifacts-path $ArtifactPath -c Release ('--property:CurrentSource=' + $snapshot) -- $taskRoot $snapshot
if ($LASTEXITCODE -ne 0) { throw ('The isolated probe failed to compile or execute: ' + $LASTEXITCODE) }
param([string]$ArtifactPath)
$ErrorActionPreference = 'Stop'
$taskRoot = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../..'))
$snapshot = Join-Path $taskRoot ('build/BrowserProbe/Input-' + [DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds())
[void][IO.Directory]::CreateDirectory($snapshot)
$names = @('JavaScriptRuntime.cs','BrowserLimits.cs','BoundedText.cs',
'BrowserHostObject.cs','JavaScriptResult.cs','BrowserDomBootstrap.cs','BrowserDomHost.cs','BrowserEventLoop.cs',
'BrowserDisplayList.cs','CssComputedStyle.cs','BrowserCanvasSurface.cs','BrowserPerformance.cs')
$names += @(Get-ChildItem -LiteralPath (Join-Path $taskRoot 'Source/XFESystem.Browser') -Filter 'DomBridge*.cs' | Select-Object -ExpandProperty Name)
$files = @()
foreach ($name in $names) {
$source = Join-Path $taskRoot ('Source/XFESystem.Browser/' + $name)
$destination = Join-Path $snapshot $name
Copy-Item -LiteralPath $source -Destination $destination
$files += [ordered]@{Name=$name;SourcePath=$source;Sha256=(Get-FileHash -LiteralPath $destination -Algorithm SHA256).Hash.ToLowerInvariant()}
}
foreach ($file in $files) {
if ((Get-FileHash -LiteralPath $file.SourcePath -Algorithm SHA256).Hash.ToLowerInvariant() -ne $file.Sha256) { throw 'The DOM source changed during capture; retry after the owner completes its edit.' }
}
[ordered]@{Kind='BrowserProbeSourceSnapshot';Files=$files;SourceUnchangedDuringCapture=$true} |
ConvertTo-Json -Depth 5 | Set-Content -LiteralPath (Join-Path $snapshot 'SourceSnapshot.json') -Encoding UTF8
if (!$ArtifactPath) { $ArtifactPath = Join-Path $taskRoot 'build/BrowserProbe/CurrentArtifacts' }
$ArtifactPath = [IO.Path]::GetFullPath($ArtifactPath)
& dotnet run --project (Join-Path $PSScriptRoot 'CurrentDomProbe.csproj') --artifacts-path $ArtifactPath -c Release ('--property:CurrentSource=' + $snapshot) -- $taskRoot $snapshot
if ($LASTEXITCODE -ne 0) { throw ('The isolated probe failed to compile or execute: ' + $LASTEXITCODE) }