This commit is contained in:
Lucas Gelfond 2024-12-23 17:56:15 -08:00
commit a03328545b

View File

@ -97,24 +97,39 @@ jobs:
env: env:
CHROME_HEADLESS: 1 CHROME_HEADLESS: 1
CHROME_PATH: chrome CHROME_PATH: chrome
CHROME_FLAGS: "--enable-features=SharedArrayBuffer --headless --disable-gpu --no-sandbox --enable-experimental-web-platform-features --enable-features=SharedArrayBuffer" CHROME_FLAGS: "--headless --disable-gpu --no-sandbox --enable-features=SharedArrayBuffer,CrossOriginIsolation"
HEADERS: '{"Cross-Origin-Opener-Policy": "same-origin", "Cross-Origin-Embedder-Policy": "require-corp", "Cross-Origin-Resource-Policy": "cross-origin", "Origin-Agent-Cluster": "?1"}' HEADERS: '{"Cross-Origin-Opener-Policy": "same-origin", "Cross-Origin-Embedder-Policy": "require-corp"}'
run: | run: |
# Start test server with proper headers for all tests # Start test server with proper headers for all tests
npm run serve -- --headers "$HEADERS" & npm run serve -- --headers "$HEADERS" &
# Wait for server to start and ensure headers are properly set # Increase wait time to ensure server is ready
sleep 10 sleep 15
# Verify headers are set correctly # Verify headers and isolation status
echo "Checking security headers..." echo "Checking security headers and isolation status..."
curl -I http://localhost:3000/tests/ffmpeg-core-st.test.html curl -v http://localhost:3000/tests/ffmpeg-core-st.test.html 2>&1 | grep -i "cross-origin"
# Check if cross-origin isolation is working # Run verification script first
echo "Adding debug script to test files to check crossOriginIsolated status..." echo "Verifying browser environment..."
for test_file in tests/ffmpeg-*.test.html; do cat << EOF > verify-browser.html
sed -i '/<\/head>/ i\<script>console.log("crossOriginIsolated status:", crossOriginIsolated);</script>' $test_file <!DOCTYPE html>
done <html>
<head>
<meta http-equiv="Cross-Origin-Opener-Policy" content="same-origin">
<meta http-equiv="Cross-Origin-Embedder-Policy" content="require-corp">
</head>
<body>
<script>
console.log('SharedArrayBuffer available:', typeof SharedArrayBuffer !== 'undefined');
console.log('crossOriginIsolated:', window.crossOriginIsolated);
if (!window.crossOriginIsolated || typeof SharedArrayBuffer === 'undefined') {
throw new Error('Browser environment not properly configured for SharedArrayBuffer');
}
</script>
</body>
</html>
EOF
# Run single-threaded tests first # Run single-threaded tests first
echo "Running single-threaded tests..." echo "Running single-threaded tests..."