Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: quote all bash variables when used (#8066)
Andrey Lushnikovb1b4d7b81907
diff --git a/browser_patches/checkout_build_archive_upload.sh b/browser_patches/checkout_build_archive_upload.shindex 3227302a17..df42b840f2 100755--- a/browser_patches/checkout_build_archive_upload.sh+++ b/browser_patches/checkout_build_archive_upload.sh@@ -4,7 +4,7 @@ set +xset -o pipefailif [[ ($1 == '--help') || ($1 == '-h') ]]; then- echo "usage: $(basename $0) [firefox-linux|firefox-win32|firefox-win64|webkit-gtk|webkit-wpe|webkit-gtk-wpe|webkit-win64|webkit-mac-10.14|webkit-mac-10.15] [-f|--force]"+ echo "usage: $(basename "$0") [firefox-linux|firefox-win32|firefox-win64|webkit-gtk|webkit-wpe|webkit-gtk-wpe|webkit-win64|webkit-mac-10.14|webkit-mac-10.15] [-f|--force]"echoecho "Prepares checkout under browser folder, applies patches, builds, archives, and uploads if build is missing."echo "Script will bail out early if the build for the browser version is already present."@@ -17,7 +17,7 @@ fiif [[ $# == 0 ]]; thenecho "missing build flavor!"- echo "try './$(basename $0) --help' for more information"+ echo "try './$(basename "$0") --help' for more information"exit 1fi@@ -354,7 +354,7 @@ elseLOG_PATH="/tmp/log-$BROWSER_NAME.zip"fi-if [[ -f $ZIP_PATH ]]; then+if [[ -f "$ZIP_PATH" ]]; thenecho "Archive $ZIP_PATH already exists - remove and re-run the script."exit 1fi@@ -392,12 +392,12 @@ function generate_and_upload_browser_build {fiecho "-- archiving to $ZIP_PATH"- if ! ./$BROWSER_NAME/archive.sh $ZIP_PATH "$EXTRA_ARCHIVE_ARGS"; then+ if ! ./$BROWSER_NAME/archive.sh "$ZIP_PATH" "$EXTRA_ARCHIVE_ARGS"; thenreturn 23fiecho "-- uploading"- if ! ./upload.sh $BUILD_BLOB_PATH $ZIP_PATH; then+ if ! ./upload.sh "$BUILD_BLOB_PATH" "$ZIP_PATH"; thenreturn 24fireturn 0@@ -419,7 +419,7 @@ if generate_and_upload_browser_build 2>&1 | ./sanitize_and_compress_log.js $LOG_(for i in $(cat "${BROWSER_NAME}/${BUILDS_LIST}"); doURL="https://playwright2.blob.core.windows.net/builds/${BROWSER_NAME}/${BUILD_NUMBER}/$i"- if ! [[ $(curl -s -L -I $URL | head -1 | cut -f2 -d' ') == 200 ]]; then+ if ! [[ $(curl -s -L -I "$URL" | head -1 | cut -f2 -d' ') == 200 ]]; then# Exit subshellecho "Missing build at ${URL}"exit@@ -448,7 +448,7 @@ elseFAILED_STEP="<unknown step>"fi# Upload logs only in case of failure and report failure.- ./upload.sh ${LOG_BLOB_PATH} ${LOG_PATH} || true+ ./upload.sh "${LOG_BLOB_PATH}" ${LOG_PATH} || truesend_telegram_message "$BUILD_ALIAS -- ${FAILED_STEP} failed! ❌ <a href='https://playwright.azureedge.net/builds/${LOG_BLOB_PATH}'>${LOG_BLOB_NAME}</a>"exit 1fidiff --git a/browser_patches/chromium/archive.sh b/browser_patches/chromium/archive.shindex bc858ba05e..6728a6a0cc 100755--- a/browser_patches/chromium/archive.sh+++ b/browser_patches/chromium/archive.sh@@ -3,12 +3,12 @@ set -eset +xtrap "cd $(pwd -P)" EXIT-cd "$(dirname $0)"+cd "$(dirname "$0")"SCRIPT_PATH=$(pwd -P)main() {if [[ ("$1" == "-h") || ("$1" == "--help") ]]; then- echo "usage: $(basename $0) [output-absolute-path]"+ echo "usage: $(basename "$0") [output-absolute-path]"echoecho "Generate distributable .zip archive from ./output folder that was previously downloaded."echo@@ -29,7 +29,7 @@ main() {echo "ERROR: path $ZIP_PATH exists; can't do anything."exit 1fi- if ! [[ -d $(dirname $ZIP_PATH) ]]; then+ if ! [[ -d $(dirname "$ZIP_PATH") ]]; thenecho "ERROR: folder for path $($ZIP_PATH) does not exist."exit 1fi@@ -45,7 +45,7 @@ main() {ficd "${SCRIPT_PATH}"- cp output/build.zip $ZIP_PATH+ cp output/build.zip "$ZIP_PATH"}function archive_compiled_chromium() {diff --git a/browser_patches/chromium/build.sh b/browser_patches/chromium/build.shindex fa5c123aa5..21dd4051ce 100755--- a/browser_patches/chromium/build.sh+++ b/browser_patches/chromium/build.sh@@ -3,10 +3,10 @@ set -eset +xtrap "cd $(pwd -P)" EXIT-cd "$(dirname $0)"+cd "$(dirname "$0")"USAGE=$(cat<<EOF- usage: $(basename $0) [--mirror|--mirror-linux|--mirror-win32|--mirror-win64|--mirror-mac|--compile-mac-arm64|--compile-linux|--compile-win32|--compile-win64|--compile-mac]+ usage: $(basename "$0") [--mirror|--mirror-linux|--mirror-win32|--mirror-win64|--mirror-mac|--compile-mac-arm64|--compile-linux|--compile-win32|--compile-win64|--compile-mac]Either compiles chromium or mirrors it from Chromium Continuous Builds CDN.EOF@@ -20,9 +20,9 @@ main() {echo "$USAGE"exit 0elif [[ $1 == "--mirror"* ]]; then- mirror_chromium $1+ mirror_chromium "$1"elif [[ $1 == "--compile"* ]]; then- compile_chromium $1+ compile_chromium "$1"elseecho "ERROR: unknown first argument. Use --help for details."exit 1@@ -82,9 +82,9 @@ compile_chromium() {if [[ $1 == "--compile-win"* ]]; thenif [[ -z "$USE_GOMA" ]]; then- /c/Windows/System32/cmd.exe "/c $(cygpath -w ${SCRIPT_FOLDER}/buildwin.bat)"+ /c/Windows/System32/cmd.exe "/c $(cygpath -w "${SCRIPT_FOLDER}"/buildwin.bat)"else- /c/Windows/System32/cmd.exe "/c $(cygpath -w ${SCRIPT_FOLDER}/buildwingoma.bat)"+ /c/Windows/System32/cmd.exe "/c $(cygpath -w "${SCRIPT_FOLDER}"/buildwingoma.bat)"fielsegn gen out/Default@@ -144,4 +144,4 @@ mirror_chromium() {unzip chromium-upstream.zip}-main $1+main "$1"diff --git a/browser_patches/chromium/clean.sh b/browser_patches/chromium/clean.shindex aff22b0873..7b22fb259d 100755--- a/browser_patches/chromium/clean.sh+++ b/browser_patches/chromium/clean.sh@@ -3,7 +3,7 @@ set -eset +xtrap "cd $(pwd -P)" EXIT-cd "$(dirname $0)"+cd "$(dirname "$0")"rm -rf outputif [[ ! -z "${CR_CHECKOUT_PATH}" ]]; thendiff --git a/browser_patches/chromium/goma.sh b/browser_patches/chromium/goma.shindex 180d33255d..9a7a77cf59 100755--- a/browser_patches/chromium/goma.sh+++ b/browser_patches/chromium/goma.sh@@ -3,7 +3,7 @@ set -eset -xtrap "cd $(pwd -P)" EXIT-cd "$(dirname $0)"+cd "$(dirname "$0")"if [[ ! -d ./electron-build-tools ]]; thengit clone --single-branch --branch master https://github.com/electron/build-tools/ electron-build-tools@@ -19,7 +19,7 @@ cd electron-build-tools/third_party/gomaexport GOMA_START_COMPILER_PROXY=trueif [[ $1 == "--help" ]]; then- echo "$(basename $0) [login|start|stop|--help]"+ echo "$(basename "$0") [login|start|stop|--help]"exit 0elif [[ $1 == "login" ]]; thenif [[ $(uname) == "MINGW"* ]]; then@@ -35,7 +35,7 @@ elif [[ $1 == "start" ]]; thenfiif [[ ! -f "$HOME/.goma_oauth2_config" ]]; thenecho "ERROR: goma is not logged in!"- echo "run '$(basename $0) login'"+ echo "run '$(basename "$0") login'"exit 1fiif [[ $(uname) == "MINGW"* ]]; thendiff --git a/browser_patches/export.sh b/browser_patches/export.shindex 7b8b4ef04e..dec6c8da11 100755--- a/browser_patches/export.sh+++ b/browser_patches/export.sh@@ -110,16 +110,16 @@ elsefi# Switch to git repository.-cd $CHECKOUT_PATH+cd "$CHECKOUT_PATH"# Setting up |$REMOTE_BROWSER_UPSTREAM| remote and fetch the $BASE_BRANCHif git remote get-url $REMOTE_BROWSER_UPSTREAM >/dev/null; thenif ! [[ $(git config --get remote.$REMOTE_BROWSER_UPSTREAM.url || echo "") == "$REMOTE_URL" ]]; then- echo "ERROR: remote $REMOTE_BROWSER_UPSTREAM is not pointing to '$REMOTE_URL'! run `prepare_checkout.sh` first"+ echo "ERROR: remote $REMOTE_BROWSER_UPSTREAM is not pointing to '$REMOTE_URL'! run 'prepare_checkout.sh' first"exit 1fielse- echo "ERROR: checkout does not have $REMOTE_BROWSER_UPSTREAM; run `prepare_checkout.sh` first"+ echo "ERROR: checkout does not have $REMOTE_BROWSER_UPSTREAM; run 'prepare_checkout.sh' first"exit 1fi@@ -131,17 +131,17 @@ elseecho "-- checking $FRIENDLY_CHECKOUT_PATH is clean - OK"fi-PATCH_NAME=$(ls -1 $EXPORT_PATH/patches)+PATCH_NAME=$(ls -1 "$EXPORT_PATH"/patches)if [[ -z "$PATCH_NAME" ]]; thenPATCH_NAME="bootstrap.diff"OLD_DIFF=""else- OLD_DIFF=$(cat $EXPORT_PATH/patches/$PATCH_NAME)+ OLD_DIFF=$(cat "$EXPORT_PATH"/patches/$PATCH_NAME)fiCURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)-NEW_BASE_REVISION=$(git merge-base $REMOTE_BROWSER_UPSTREAM/$BASE_BRANCH $CURRENT_BRANCH)-NEW_DIFF=$(git diff --diff-algorithm=myers --full-index $NEW_BASE_REVISION $CURRENT_BRANCH -- . ":!${EXTRA_FOLDER_CHECKOUT_RELPATH}")+NEW_BASE_REVISION=$(git merge-base $REMOTE_BROWSER_UPSTREAM/"$BASE_BRANCH" "$CURRENT_BRANCH")+NEW_DIFF=$(git diff --diff-algorithm=myers --full-index "$NEW_BASE_REVISION" "$CURRENT_BRANCH" -- . ":!${EXTRA_FOLDER_CHECKOUT_RELPATH}")# Increment BUILD_NUMBERBUILD_NUMBER=$(curl ${BUILD_NUMBER_UPSTREAM_URL} | head -1)@@ -149,10 +149,10 @@ BUILD_NUMBER=$((BUILD_NUMBER+1))echo "REMOTE_URL=\"$REMOTE_URL\"BASE_BRANCH=\"$BASE_BRANCH\"-BASE_REVISION=\"$NEW_BASE_REVISION\"" > $EXPORT_PATH/UPSTREAM_CONFIG.sh-echo "$NEW_DIFF" > $EXPORT_PATH/patches/$PATCH_NAME-echo $BUILD_NUMBER > $EXPORT_PATH/BUILD_NUMBER-echo "Changed: $(git config user.email) $(date)" >> $EXPORT_PATH/BUILD_NUMBER+BASE_REVISION=\"$NEW_BASE_REVISION\"" > "$EXPORT_PATH"/UPSTREAM_CONFIG.sh+echo "$NEW_DIFF" > "$EXPORT_PATH"/patches/$PATCH_NAME+echo $BUILD_NUMBER > "$EXPORT_PATH"/BUILD_NUMBER+echo "Changed: $(git config user.email) $(date)" >> "$EXPORT_PATH"/BUILD_NUMBERecho "-- exporting standalone folder"rm -rf "${EXTRA_FOLDER_PW_PATH}"diff --git a/browser_patches/firefox-beta/archive.sh b/browser_patches/firefox-beta/archive.shindex c3b66c8719..c23d782e0c 100755--- a/browser_patches/firefox-beta/archive.sh+++ b/browser_patches/firefox-beta/archive.sh@@ -3,7 +3,7 @@ set -eset +xif [[ ("$1" == "-h") || ("$1" == "--help") ]]; then- echo "usage: $(basename $0) [output-absolute-path]"+ echo "usage: $(basename "$0") [output-absolute-path]"echoecho "Generate distributable .zip archive from ./checkout folder that was previously built."echo@@ -23,13 +23,13 @@ if [[ -f $ZIP_PATH ]]; thenecho "ERROR: path $ZIP_PATH exists; can't do anything."exit 1fi-if ! [[ -d $(dirname $ZIP_PATH) ]]; then+if ! [[ -d $(dirname "$ZIP_PATH") ]]; thenecho "ERROR: folder for path $($ZIP_PATH) does not exist."exit 1fitrap "cd $(pwd -P)" EXIT-cd "$(dirname $0)"+cd "$(dirname "$0")"SCRIPT_FOLDER="$(pwd -P)"if [[ ! -z "${FF_CHECKOUT_PATH}" ]]; then@@ -42,7 +42,7 @@ fiOBJ_FOLDER="obj-build-playwright"./mach package-node "${SCRIPT_FOLDER}"/install-preferences.js $PWD/$OBJ_FOLDER/dist/firefox+node "${SCRIPT_FOLDER}"/install-preferences.js "$PWD"/$OBJ_FOLDER/dist/firefoxif ! [[ -d $OBJ_FOLDER/dist/firefox ]]; thenecho "ERROR: cannot find $OBJ_FOLDER/dist/firefox folder in the checkout/. Did you build?"@@ -57,4 +57,4 @@ fi# tar resulting directory and cleanup TMP.cd $OBJ_FOLDER/dist-zip -r $ZIP_PATH firefox+zip -r "$ZIP_PATH" firefoxdiff --git a/browser_patches/firefox-beta/build.sh b/browser_patches/firefox-beta/build.shindex f3275d7dbf..98623d7b9f 100755--- a/browser_patches/firefox-beta/build.sh+++ b/browser_patches/firefox-beta/build.sh@@ -11,7 +11,7 @@ XCODE_VERSION_WITH_REQUIRED_SDK_VERSION="8.3.3"trap "cd $(pwd -P)" EXIT-cd "$(dirname $0)"+cd "$(dirname "$0")"SCRIPT_FOLDER="$(pwd -P)"source "${SCRIPT_FOLDER}/../utils.sh"@@ -118,8 +118,8 @@ if [[ $1 == "--juggler" ]]; thenfiif [[ "$(uname)" == "Darwin" ]]; then- node "${SCRIPT_FOLDER}"/install-preferences.js $PWD/${OBJ_FOLDER}/dist+ node "${SCRIPT_FOLDER}"/install-preferences.js "$PWD"/${OBJ_FOLDER}/distelse- node "${SCRIPT_FOLDER}"/install-preferences.js $PWD/${OBJ_FOLDER}/dist/bin+ node "${SCRIPT_FOLDER}"/install-preferences.js "$PWD"/${OBJ_FOLDER}/dist/binfidiff --git a/browser_patches/firefox-beta/clean.sh b/browser_patches/firefox-beta/clean.shindex bd76941453..ef80f7ea07 100755--- a/browser_patches/firefox-beta/clean.sh+++ b/browser_patches/firefox-beta/clean.sh@@ -7,7 +7,7 @@ if [[ ! -z "${FF_CHECKOUT_PATH}" ]]; thencd "${FF_CHECKOUT_PATH}"echo "WARNING: checkout path from FF_CHECKOUT_PATH env: ${FF_CHECKOUT_PATH}"else- cd "$(dirname $0)"+ cd "$(dirname "$0")"cd "../firefox/checkout"fidiff --git a/browser_patches/firefox/archive.sh b/browser_patches/firefox/archive.shindex 776891f358..a3bc22ddd6 100755--- a/browser_patches/firefox/archive.sh+++ b/browser_patches/firefox/archive.sh@@ -3,7 +3,7 @@ set -eset +xif [[ ("$1" == "-h") || ("$1" == "--help") ]]; then- echo "usage: $(basename $0) [output-absolute-path]"+ echo "usage: $(basename "$0") [output-absolute-path]"echoecho "Generate distributable .zip archive from ./checkout folder that was previously built."echo@@ -23,13 +23,13 @@ if [[ -f $ZIP_PATH ]]; thenecho "ERROR: path $ZIP_PATH exists; can't do anything."exit 1fi-if ! [[ -d $(dirname $ZIP_PATH) ]]; then+if ! [[ -d $(dirname "$ZIP_PATH") ]]; thenecho "ERROR: folder for path $($ZIP_PATH) does not exist."exit 1fitrap "cd $(pwd -P)" EXIT-cd "$(dirname $0)"+cd "$(dirname "$0")"SCRIPT_FOLDER="$(pwd -P)"if [[ ! -z "${FF_CHECKOUT_PATH}" ]]; then@@ -42,7 +42,7 @@ fiOBJ_FOLDER="obj-build-playwright"./mach package-node "${SCRIPT_FOLDER}"/install-preferences.js $PWD/$OBJ_FOLDER/dist/firefox+node "${SCRIPT_FOLDER}"/install-preferences.js "$PWD"/$OBJ_FOLDER/dist/firefoxif ! [[ -d $OBJ_FOLDER/dist/firefox ]]; thenecho "ERROR: cannot find $OBJ_FOLDER/dist/firefox folder in the checkout/. Did you build?"@@ -57,4 +57,4 @@ fi# tar resulting directory and cleanup TMP.cd $OBJ_FOLDER/dist-zip -r $ZIP_PATH firefox+zip -r "$ZIP_PATH" firefoxdiff --git a/browser_patches/firefox/build.sh b/browser_patches/firefox/build.shindex 157ddec523..8875c8f8f0 100755--- a/browser_patches/firefox/build.sh+++ b/browser_patches/firefox/build.sh@@ -11,7 +11,7 @@ XCODE_VERSION_WITH_REQUIRED_SDK_VERSION="8.3.3"trap "cd $(pwd -P)" EXIT-cd "$(dirname $0)"+cd "$(dirname "$0")"SCRIPT_FOLDER="$(pwd -P)"source "${SCRIPT_FOLDER}/../utils.sh"@@ -118,8 +118,8 @@ if [[ $1 == "--juggler" ]]; thenfiif [[ "$(uname)" == "Darwin" ]]; then- node "${SCRIPT_FOLDER}"/install-preferences.js $PWD/${OBJ_FOLDER}/dist+ node "${SCRIPT_FOLDER}"/install-preferences.js "$PWD"/${OBJ_FOLDER}/distelse- node "${SCRIPT_FOLDER}"/install-preferences.js $PWD/${OBJ_FOLDER}/dist/bin+ node "${SCRIPT_FOLDER}"/install-preferences.js "$PWD"/${OBJ_FOLDER}/dist/binfidiff --git a/browser_patches/firefox/clean.sh b/browser_patches/firefox/clean.shindex 9b3a97c380..a849343d30 100755--- a/browser_patches/firefox/clean.sh+++ b/browser_patches/firefox/clean.sh@@ -7,7 +7,7 @@ if [[ ! -z "${FF_CHECKOUT_PATH}" ]]; thencd "${FF_CHECKOUT_PATH}"echo "WARNING: checkout path from FF_CHECKOUT_PATH env: ${FF_CHECKOUT_PATH}"else- cd "$(dirname $0)"+ cd "$(dirname "$0")"cd "checkout"fidiff --git a/browser_patches/prepare_checkout.sh b/browser_patches/prepare_checkout.shindex f27a323257..e0f9cefe4d 100755--- a/browser_patches/prepare_checkout.sh+++ b/browser_patches/prepare_checkout.sh@@ -10,7 +10,7 @@ REMOTE_BROWSER_UPSTREAM="browser_upstream"BUILD_BRANCH="playwright-build"if [[ ($1 == '--help') || ($1 == '-h') ]]; then- echo "usage: $(basename $0) [firefox|firefox-beta|webkit] [custom_checkout_path]"+ echo "usage: $(basename "$0") [firefox|firefox-beta|webkit] [custom_checkout_path]"echoecho "Prepares browser checkout. The checkout is a GIT repository that:"echo "- has a '$REMOTE_BROWSER_UPSTREAM' remote pointing to a REMOTE_URL from UPSTREAM_CONFIG.sh"@@ -23,7 +23,7 @@ fiif [[ $# == 0 ]]; thenecho "missing browser: 'firefox' or 'webkit'"- echo "try './$(basename $0) --help' for more information"+ echo "try './$(basename "$0") --help' for more information"exit 1fi@@ -139,11 +139,11 @@ if ! [[ -d $CHECKOUT_PATH ]]; thenecho "-- $FRIENDLY_CHECKOUT_PATH is missing - checking out.."if [[ -n "$CI" ]]; then# In CI environment, we re-checkout constantly, so we do a shallow checkout to save time.- git clone --single-branch --depth 1 --branch $BASE_BRANCH $REMOTE_URL $CHECKOUT_PATH+ git clone --single-branch --depth 1 --branch "$BASE_BRANCH" "$REMOTE_URL" "$CHECKOUT_PATH"else# In non-CI environment, do a full checkout. This takes time,# but liberates from the `git fetch --unshallow`.- git clone --single-branch --branch $BASE_BRANCH $REMOTE_URL $CHECKOUT_PATH+ git clone --single-branch --branch "$BASE_BRANCH" "$REMOTE_URL" "$CHECKOUT_PATH"fielseecho "-- checking $FRIENDLY_CHECKOUT_PATH folder - OK"@@ -158,7 +158,7 @@ elsefi# ============== SETTING UP GIT REPOSITORY ==============-cd $CHECKOUT_PATH+cd "$CHECKOUT_PATH"# Bail out if git repo is dirty.if [[ -n $(git status -s --untracked-files=no) ]]; then@@ -169,7 +169,7 @@ fi# Setting up |$REMOTE_BROWSER_UPSTREAM| remote and fetch the $BASE_BRANCHif git remote get-url $REMOTE_BROWSER_UPSTREAM >/dev/null; thenecho "-- setting |$REMOTE_BROWSER_UPSTREAM| remote url to $REMOTE_URL"- git remote set-url $REMOTE_BROWSER_UPSTREAM $REMOTE_URL+ git remote set-url $REMOTE_BROWSER_UPSTREAM "$REMOTE_URL"elseecho "-- adding |$REMOTE_BROWSER_UPSTREAM| remote to $REMOTE_URL"git remote rename origin $REMOTE_BROWSER_UPSTREAM@@ -179,7 +179,7 @@ fi# If not, fetch from REMOTE_BROWSER_UPSTREAM and slowly fetch more and more commits# until we find $BASE_REVISION.# This technique allows us start with a shallow clone.-if ! git cat-file -e $BASE_REVISION^{commit} 2>/dev/null; then+if ! git cat-file -e "$BASE_REVISION"^{commit} 2>/dev/null; then# Detach git head so that we can fetch into branch.git checkout --detach >/dev/null 2>/dev/null@@ -188,9 +188,9 @@ if ! git cat-file -e $BASE_REVISION^{commit} 2>/dev/null; thenSUCCESS="no"while (( FETCH_DEPTH <= 8192 )); doecho "Fetching ${FETCH_DEPTH} commits to find base revision..."- git fetch --depth "${FETCH_DEPTH}" $REMOTE_BROWSER_UPSTREAM $BASE_BRANCH+ git fetch --depth "${FETCH_DEPTH}" $REMOTE_BROWSER_UPSTREAM "$BASE_BRANCH"FETCH_DEPTH=$(( FETCH_DEPTH * 2 ));- if git cat-file -e $BASE_REVISION^{commit} >/dev/null; then+ if git cat-file -e "$BASE_REVISION"^{commit} >/dev/null; thenSUCCESS="yes"break;fi@@ -204,7 +204,7 @@ fiecho "-- checking $FRIENDLY_CHECKOUT_PATH repo has BASE_REVISION (@$BASE_REVISION) commit - OK"# Check out the $BASE_REVISION-git checkout $BASE_REVISION+git checkout "$BASE_REVISION"# Create a playwright-build branch and apply all the patches to it.if git show-ref --verify --quiet refs/heads/playwright-build; then@@ -212,7 +212,7 @@ if git show-ref --verify --quiet refs/heads/playwright-build; thenfigit checkout -b playwright-buildecho "-- applying patches"-git apply --index --whitespace=nowarn $PATCHES_PATH/*+git apply --index --whitespace=nowarn "$PATCHES_PATH"/*if [[ ! -z "${WEBKIT_EXTRA_FOLDER_PATH}" ]]; thenecho "-- adding WebKit embedders"@@ -222,8 +222,8 @@ if [[ ! -z "${WEBKIT_EXTRA_FOLDER_PATH}" ]]; thenecho "ERROR: $EMBEDDER_DIR already exists! Remove it and re-run the script."exit 1fi- cp -r "${WEBKIT_EXTRA_FOLDER_PATH}" $EMBEDDER_DIR- git add $EMBEDDER_DIR+ cp -r "${WEBKIT_EXTRA_FOLDER_PATH}" "$EMBEDDER_DIR"+ git add "$EMBEDDER_DIR"elif [[ ! -z "${FIREFOX_EXTRA_FOLDER_PATH}" ]]; thenecho "-- adding juggler"EMBEDDER_DIR="$PWD/juggler"@@ -232,8 +232,8 @@ elif [[ ! -z "${FIREFOX_EXTRA_FOLDER_PATH}" ]]; thenecho "ERROR: $EMBEDDER_DIR already exists! Remove it and re-run the script."exit 1fi- cp -r "${FIREFOX_EXTRA_FOLDER_PATH}" $EMBEDDER_DIR- git add $EMBEDDER_DIR+ cp -r "${FIREFOX_EXTRA_FOLDER_PATH}" "$EMBEDDER_DIR"+ git add "$EMBEDDER_DIR"figit commit -a --author="playwright-devops <[email protected]>" -m "chore($1): bootstrap build #$BUILD_NUMBER"diff --git a/browser_patches/send_telegram_message.sh b/browser_patches/send_telegram_message.shindex 7fb4bd248c..22155a0c3d 100644--- a/browser_patches/send_telegram_message.sh+++ b/browser_patches/send_telegram_message.sh@@ -10,5 +10,5 @@ send_telegram_message() {-X POST \-H 'Content-Type: application/json' \-d '{"disable_web_page_preview": true, "chat_id": "-1001225613794", "parse_mode": "html", "text": "'"$TEXT"'", "disable_notification": false}' \- https://api.telegram.org/bot$TELEGRAM_BOT_KEY/sendMessage >/dev/null+ https://api.telegram.org/bot"$TELEGRAM_BOT_KEY"/sendMessage >/dev/null}diff --git a/browser_patches/upload.sh b/browser_patches/upload.shindex a7609efe5c..568f683029 100755--- a/browser_patches/upload.sh+++ b/browser_patches/upload.sh@@ -6,9 +6,9 @@ trap "cd $(pwd -P)" EXITcd "$(dirname "$0")"if [[ ($1 == '--help') || ($1 == '-h') ]]; then- echo "usage: $(basename $0) [BLOB-PATH] [--check|ZIP-PATH]"+ echo "usage: $(basename "$0") [BLOB-PATH] [--check|ZIP-PATH]"echo- echo "Upload ZIP-PATH to BLOB-PATH in `builds` container."+ echo "Upload ZIP-PATH to BLOB-PATH in 'builds' container."echoecho "--check pass |--check| as a second parameter instead of a zip-path to check for"echo " existance of BLOB-PATH"@@ -27,7 +27,7 @@ fiif [[ $# < 2 ]]; thenecho "not enought arguments!"- echo "try '$(basename $0) --help' for more information"+ echo "try '$(basename "$0") --help' for more information"exit 1fi@@ -35,7 +35,7 @@ BLOB_PATH="$1"ZIP_PATH="$2"if [[ ("$2" == '--check') ]]; then- EXISTS=$(az storage blob exists -c builds --account-key $AZ_ACCOUNT_KEY --account-name $AZ_ACCOUNT_NAME -n "$BLOB_PATH" --query "exists")+ EXISTS=$(az storage blob exists -c builds --account-key "$AZ_ACCOUNT_KEY" --account-name "$AZ_ACCOUNT_NAME" -n "$BLOB_PATH" --query "exists")if [[ $EXISTS == "true" ]]; thenexit 0else@@ -53,11 +53,11 @@ if [[ "${ZIP_PATH}" != *.zip && "${ZIP_PATH}" != *.gz ]]; thenfiif [[ $(uname) == MINGW* ]]; then# Convert POSIX path to MSYS- WIN_PATH=$({ cd $(dirname $ZIP_PATH) && pwd -W; } | sed 's|/|\\|g')- WIN_PATH="${WIN_PATH}\\$(basename $ZIP_PATH)"- az storage blob upload -c builds --account-key $AZ_ACCOUNT_KEY --account-name $AZ_ACCOUNT_NAME -f $WIN_PATH -n $BLOB_PATH+ WIN_PATH=$({ cd $(dirname "$ZIP_PATH") && pwd -W; } | sed 's|/|\\|g')+ WIN_PATH="${WIN_PATH}\\$(basename "$ZIP_PATH")"+ az storage blob upload -c builds --account-key "$AZ_ACCOUNT_KEY" --account-name "$AZ_ACCOUNT_NAME" -f "$WIN_PATH" -n "$BLOB_PATH"else- az storage blob upload -c builds --account-key $AZ_ACCOUNT_KEY --account-name $AZ_ACCOUNT_NAME -f $ZIP_PATH -n "$BLOB_PATH"+ az storage blob upload -c builds --account-key "$AZ_ACCOUNT_KEY" --account-name "$AZ_ACCOUNT_NAME" -f "$ZIP_PATH" -n "$BLOB_PATH"fiecho "UPLOAD SUCCESSFUL!"diff --git a/browser_patches/webkit/archive.sh b/browser_patches/webkit/archive.shindex 82668340ca..636eba7785 100755--- a/browser_patches/webkit/archive.sh+++ b/browser_patches/webkit/archive.sh@@ -3,7 +3,7 @@ set -eset +xif [[ ("$1" == "-h") || ("$1" == "--help") ]]; then- echo "usage: $(basename $0) [output-absolute-path]"+ echo "usage: $(basename "$0") [output-absolute-path]"echoecho "Generate distributable .zip archive from ./checkout folder that was previously built."echo@@ -23,7 +23,7 @@ if [[ -f $ZIP_PATH ]]; thenecho "ERROR: path $ZIP_PATH exists; can't do anything."exit 1fi-if ! [[ -d $(dirname $ZIP_PATH) ]]; then+if ! [[ -d $(dirname "$ZIP_PATH") ]]; thenecho "ERROR: folder for path $($ZIP_PATH) does not exist."exit 1fi@@ -53,27 +53,27 @@ main() {createZipForLinux() {# create a TMP directory to copy all necessary fileslocal tmpdir=$(mktemp -d -t webkit-deploy-XXXXXXXXXX)- mkdir -p $tmpdir+ mkdir -p "$tmpdir"# copy runner- cp -t $tmpdir $SCRIPTS_DIR/pw_run.sh+ cp -t "$tmpdir" "$SCRIPTS_DIR"/pw_run.sh# copy protocol- node $SCRIPTS_DIR/concat_protocol.js > $tmpdir/protocol.json+ node "$SCRIPTS_DIR"/concat_protocol.js > "$tmpdir"/protocol.json# Generate and unpack MiniBrowser bundles for each portfor port in gtk wpe; doWEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/${port^^} Tools/Scripts/generate-bundle \--bundle=MiniBrowser --release \- --platform=${port} --destination=${tmpdir}- unzip ${tmpdir}/MiniBrowser_${port}_release.zip -d ${tmpdir}/minibrowser-${port}- rm -f ${tmpdir}/MiniBrowser_${port}_release.zip+ --platform=${port} --destination="${tmpdir}"+ unzip "${tmpdir}"/MiniBrowser_${port}_release.zip -d "${tmpdir}"/minibrowser-${port}+ rm -f "${tmpdir}"/MiniBrowser_${port}_release.zipdone# tar resulting directory and cleanup TMP.- cd $tmpdir- zip --symlinks -r $ZIP_PATH ./+ cd "$tmpdir"+ zip --symlinks -r "$ZIP_PATH" ./cd -- rm -rf $tmpdir+ rm -rf "$tmpdir"}# see https://docs.microsoft.com/en-us/visualstudio/install/tools-for-managing-visual-studio-instances?view=vs-2019@@ -90,25 +90,25 @@ printMSVCRedistDir() {createZipForWindows() {# create a TMP directory to copy all necessary fileslocal tmpdir="/tmp/webkit-deploy-$(date +%s)"- mkdir -p $tmpdir+ mkdir -p "$tmpdir"- cp -t $tmpdir ./WebKitLibraries/win/bin64/*.dll+ cp -t "$tmpdir" ./WebKitLibraries/win/bin64/*.dllcd WebKitBuild/Release/bin64- cp -r -t $tmpdir WebKit.resources- cp -t $tmpdir JavaScriptCore.dll PlaywrightLib.dll WTF.dll WebKit2.dll libEGL.dll libGLESv2.dll- cp -t $tmpdir Playwright.exe WebKitNetworkProcess.exe WebKitWebProcess.exe+ cp -r -t "$tmpdir" WebKit.resources+ cp -t "$tmpdir" JavaScriptCore.dll PlaywrightLib.dll WTF.dll WebKit2.dll libEGL.dll libGLESv2.dll+ cp -t "$tmpdir" Playwright.exe WebKitNetworkProcess.exe WebKitWebProcess.execd -cd "$(printMSVCRedistDir)"- cp -t $tmpdir msvcp140.dll vcruntime140.dll vcruntime140_1.dll msvcp140_2.dll+ cp -t "$tmpdir" msvcp140.dll vcruntime140.dll vcruntime140_1.dll msvcp140_2.dllcd -# copy protocol- node $SCRIPTS_DIR/concat_protocol.js > $tmpdir/protocol.json+ node "$SCRIPTS_DIR"/concat_protocol.js > "$tmpdir"/protocol.json# tar resulting directory and cleanup TMP.- cd $tmpdir- zip -r $ZIP_PATH ./+ cd "$tmpdir"+ zip -r "$ZIP_PATH" ./cd -- rm -rf $tmpdir+ rm -rf "$tmpdir"}createZipForMac() {@@ -116,28 +116,28 @@ createZipForMac() {local tmpdir=$(mktemp -d)# copy all relevant files- ditto {./WebKitBuild/Release,$tmpdir}/com.apple.WebKit.Networking.xpc- ditto {./WebKitBuild/Release,$tmpdir}/com.apple.WebKit.Plugin.64.xpc- ditto {./WebKitBuild/Release,$tmpdir}/com.apple.WebKit.WebContent.xpc- ditto {./WebKitBuild/Release,$tmpdir}/JavaScriptCore.framework- ditto {./WebKitBuild/Release,$tmpdir}/libANGLE-shared.dylib- ditto {./WebKitBuild/Release,$tmpdir}/libwebrtc.dylib- ditto {./WebKitBuild/Release,$tmpdir}/Playwright.app- ditto {./WebKitBuild/Release,$tmpdir}/PluginProcessShim.dylib- ditto {./WebKitBuild/Release,$tmpdir}/WebCore.framework- ditto {./WebKitBuild/Release,$tmpdir}/WebInspectorUI.framework- ditto {./WebKitBuild/Release,$tmpdir}/WebKit.framework- ditto {./WebKitBuild/Release,$tmpdir}/WebKitLegacy.framework- ditto {$SCRIPTS_DIR,$tmpdir}/pw_run.sh+ ditto {./WebKitBuild/Release,"$tmpdir"}/com.apple.WebKit.Networking.xpc+ ditto {./WebKitBuild/Release,"$tmpdir"}/com.apple.WebKit.Plugin.64.xpc+ ditto {./WebKitBuild/Release,"$tmpdir"}/com.apple.WebKit.WebContent.xpc+ ditto {./WebKitBuild/Release,"$tmpdir"}/JavaScriptCore.framework+ ditto {./WebKitBuild/Release,"$tmpdir"}/libANGLE-shared.dylib+ ditto {./WebKitBuild/Release,"$tmpdir"}/libwebrtc.dylib+ ditto {./WebKitBuild/Release,"$tmpdir"}/Playwright.app+ ditto {./WebKitBuild/Release,"$tmpdir"}/PluginProcessShim.dylib+ ditto {./WebKitBuild/Release,"$tmpdir"}/WebCore.framework+ ditto {./WebKitBuild/Release,"$tmpdir"}/WebInspectorUI.framework+ ditto {./WebKitBuild/Release,"$tmpdir"}/WebKit.framework+ ditto {./WebKitBuild/Release,"$tmpdir"}/WebKitLegacy.framework+ ditto {"$SCRIPTS_DIR","$tmpdir"}/pw_run.sh# copy protocol- node $SCRIPTS_DIR/concat_protocol.js > $tmpdir/protocol.json+ node "$SCRIPTS_DIR"/concat_protocol.js > "$tmpdir"/protocol.json# Remove all broken symlinks. @see https://github.com/microsoft/playwright/issues/5472find "${tmpdir}" -type l ! -exec test -e {} \; -print | xargs rm# zip resulting directory and cleanup TMP.- ditto -c -k $tmpdir $ZIP_PATH- rm -rf $tmpdir+ ditto -c -k "$tmpdir" "$ZIP_PATH"+ rm -rf "$tmpdir"}trap "cd $(pwd -P)" EXITdiff --git a/browser_patches/webkit/build.sh b/browser_patches/webkit/build.shindex 25bd27f53f..1bcac55562 100755--- a/browser_patches/webkit/build.sh+++ b/browser_patches/webkit/build.sh@@ -3,7 +3,7 @@ set -eset +xtrap "cd $(pwd -P)" EXIT-cd "$(dirname $0)"+cd "$(dirname "$0")"SCRIPT_FOLDER="$(pwd -P)"source "${SCRIPT_FOLDER}/../utils.sh"@@ -80,7 +80,7 @@ elif [[ "$(uname)" == "Linux" ]]; thenbuild_wpefielif [[ "$(uname)" == MINGW* ]]; then- /c/Windows/System32/cmd.exe "/c $(cygpath -w ${SCRIPT_FOLDER}/buildwin.bat)"+ /c/Windows/System32/cmd.exe "/c $(cygpath -w "${SCRIPT_FOLDER}"/buildwin.bat)"elseecho "ERROR: cannot upload on this platform!" 1>&2exit 1;diff --git a/browser_patches/webkit/clean.sh b/browser_patches/webkit/clean.shindex e07f6ed152..df9e0467f3 100755--- a/browser_patches/webkit/clean.sh+++ b/browser_patches/webkit/clean.sh@@ -3,7 +3,7 @@ set -eset +xtrap "cd $(pwd -P)" EXIT-cd "$(dirname $0)"+cd "$(dirname "$0")"if [[ ! -z "${WK_CHECKOUT_PATH}" ]]; thencd "${WK_CHECKOUT_PATH}"