mirror of
				https://github.com/microsoft/playwright.git
				synced 2025-06-26 21:40:17 +00:00 
			
		
		
		
	chore: enhance download/install logic of branded browsers (#26806)
- Remove the check for 32 vs. 64 bit, since we only support 64 Windows since a while - Introduce `$ErrorActionPreference = 'Stop'` which is a best practice otherwise the code would have continued running even a statement/line was failing. E.g. download failed, it would still try to install - `$ms.DownloadFile` checks for the status code internally, so we are safe regarding this, it will throw otherwise. This won't fix https://github.com/microsoft/playwright/issues/26591 but makes the code more safe and might be related.
This commit is contained in:
		
							parent
							
								
									741c649d56
								
							
						
					
					
						commit
						b387249e45
					
				@ -1,8 +1,6 @@
 | 
				
			|||||||
$url = 'https://dl.google.com/tag/s/dl/chrome/install/beta/googlechromebetastandaloneenterprise.msi';
 | 
					$ErrorActionPreference = 'Stop'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ([Environment]::Is64BitProcess) {
 | 
					$url = 'https://dl.google.com/tag/s/dl/chrome/install/beta/googlechromebetastandaloneenterprise64.msi'
 | 
				
			||||||
    $url = 'https://dl.google.com/tag/s/dl/chrome/install/beta/googlechromebetastandaloneenterprise64.msi'
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
Write-Host "Downloading Google Chrome Beta"
 | 
					Write-Host "Downloading Google Chrome Beta"
 | 
				
			||||||
$wc = New-Object net.webclient
 | 
					$wc = New-Object net.webclient
 | 
				
			||||||
@ -20,6 +18,6 @@ if (Test-Path "${env:ProgramFiles(x86)}$suffix") {
 | 
				
			|||||||
} elseif (Test-Path "${env:ProgramFiles}$suffix") {
 | 
					} elseif (Test-Path "${env:ProgramFiles}$suffix") {
 | 
				
			||||||
    (Get-Item "${env:ProgramFiles}$suffix").VersionInfo
 | 
					    (Get-Item "${env:ProgramFiles}$suffix").VersionInfo
 | 
				
			||||||
} else {
 | 
					} else {
 | 
				
			||||||
    write-host "ERROR: failed to install Google Chrome Beta"
 | 
					    Write-Host "ERROR: failed to install Google Chrome Beta"
 | 
				
			||||||
    exit 1
 | 
					    exit 1
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,8 +1,5 @@
 | 
				
			|||||||
$url = 'https://dl.google.com/tag/s/dl/chrome/install/googlechromestandaloneenterprise.msi';
 | 
					$ErrorActionPreference = 'Stop'
 | 
				
			||||||
 | 
					$url = 'https://dl.google.com/tag/s/dl/chrome/install/googlechromestandaloneenterprise64.msi'
 | 
				
			||||||
if ([Environment]::Is64BitProcess) {
 | 
					 | 
				
			||||||
    $url = 'https://dl.google.com/tag/s/dl/chrome/install/googlechromestandaloneenterprise64.msi'
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
$wc = New-Object net.webclient
 | 
					$wc = New-Object net.webclient
 | 
				
			||||||
$msiInstaller = "$env:temp\google-chrome.msi"
 | 
					$msiInstaller = "$env:temp\google-chrome.msi"
 | 
				
			||||||
@ -21,6 +18,6 @@ if (Test-Path "${env:ProgramFiles(x86)}$suffix") {
 | 
				
			|||||||
} elseif (Test-Path "${env:ProgramFiles}$suffix") {
 | 
					} elseif (Test-Path "${env:ProgramFiles}$suffix") {
 | 
				
			||||||
    (Get-Item "${env:ProgramFiles}$suffix").VersionInfo
 | 
					    (Get-Item "${env:ProgramFiles}$suffix").VersionInfo
 | 
				
			||||||
} else {
 | 
					} else {
 | 
				
			||||||
    write-host "ERROR: failed to install Google Chrome"
 | 
					    Write-Host "ERROR: failed to install Google Chrome"
 | 
				
			||||||
    exit 1
 | 
					    exit 1
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					$ErrorActionPreference = 'Stop'
 | 
				
			||||||
$url = $args[0]
 | 
					$url = $args[0]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Write-Host "Downloading Microsoft Edge Beta"
 | 
					Write-Host "Downloading Microsoft Edge Beta"
 | 
				
			||||||
@ -16,6 +17,6 @@ if (Test-Path "${env:ProgramFiles(x86)}$suffix") {
 | 
				
			|||||||
} elseif (Test-Path "${env:ProgramFiles}$suffix") {
 | 
					} elseif (Test-Path "${env:ProgramFiles}$suffix") {
 | 
				
			||||||
    (Get-Item "${env:ProgramFiles}$suffix").VersionInfo
 | 
					    (Get-Item "${env:ProgramFiles}$suffix").VersionInfo
 | 
				
			||||||
} else {
 | 
					} else {
 | 
				
			||||||
    write-host "ERROR: failed to install Microsoft Edge"
 | 
					    Write-Host "ERROR: failed to install Microsoft Edge"
 | 
				
			||||||
    exit 1
 | 
					    exit 1
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					$ErrorActionPreference = 'Stop'
 | 
				
			||||||
$url = $args[0]
 | 
					$url = $args[0]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Write-Host "Downloading Microsoft Edge Dev"
 | 
					Write-Host "Downloading Microsoft Edge Dev"
 | 
				
			||||||
@ -16,6 +17,6 @@ if (Test-Path "${env:ProgramFiles(x86)}$suffix") {
 | 
				
			|||||||
} elseif (Test-Path "${env:ProgramFiles}$suffix") {
 | 
					} elseif (Test-Path "${env:ProgramFiles}$suffix") {
 | 
				
			||||||
    (Get-Item "${env:ProgramFiles}$suffix").VersionInfo
 | 
					    (Get-Item "${env:ProgramFiles}$suffix").VersionInfo
 | 
				
			||||||
} else {
 | 
					} else {
 | 
				
			||||||
    write-host "ERROR: failed to install Microsoft Edge"
 | 
					    Write-Host "ERROR: failed to install Microsoft Edge"
 | 
				
			||||||
    exit 1
 | 
					    exit 1
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,5 @@
 | 
				
			|||||||
 | 
					$ErrorActionPreference = 'Stop'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$url = $args[0]
 | 
					$url = $args[0]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Write-Host "Downloading Microsoft Edge"
 | 
					Write-Host "Downloading Microsoft Edge"
 | 
				
			||||||
@ -16,6 +18,6 @@ if (Test-Path "${env:ProgramFiles(x86)}$suffix") {
 | 
				
			|||||||
} elseif (Test-Path "${env:ProgramFiles}$suffix") {
 | 
					} elseif (Test-Path "${env:ProgramFiles}$suffix") {
 | 
				
			||||||
    (Get-Item "${env:ProgramFiles}$suffix").VersionInfo
 | 
					    (Get-Item "${env:ProgramFiles}$suffix").VersionInfo
 | 
				
			||||||
} else {
 | 
					} else {
 | 
				
			||||||
    write-host "ERROR: failed to install Microsoft Edge"
 | 
					    Write-Host "ERROR: failed to install Microsoft Edge"
 | 
				
			||||||
    exit 1
 | 
					    exit 1
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user