This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: browser profiler use headless=new for linux with devtools
- Loading branch information
1 parent
d32f1aa
commit 913f073
Showing
3 changed files
with
46 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 39 additions & 21 deletions
60
browser-profiler/main/chrome-docker/Dockerstart.sh
100644 → 100755
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,46 @@ | ||
#!/bin/bash | ||
|
||
chromeArgs=$1 | ||
chrome_args=$1 | ||
url=$2 | ||
|
||
#_kill_procs() { | ||
# kill -TERM $browserProcess | ||
# wait $browserProcess | ||
# kill -TERM $xvfb | ||
#} | ||
# | ||
## Setup a trap to catch SIGTERM and relay it to child processes | ||
#trap _kill_procs SIGTERM | ||
# | ||
#XVFB_WHD=${XVFB_WHD:-1280x720x16} | ||
# | ||
## Start Xvfb | ||
#Xvfb :99 -ac -screen 0 $XVFB_WHD -nolisten tcp & | ||
#xvfb=$! | ||
# | ||
#export DISPLAY=:99 | ||
USE_XVFB=false | ||
XVFB_WHD=${XVFB_WHD:-1280x720x16} | ||
|
||
_kill_procs() { | ||
kill -TERM $browser_proc | ||
wait $browser_proc | ||
|
||
kill -TERM $soc_proc | ||
wait $soc_proc | ||
|
||
if [[ -n "$xvfb" ]]; then | ||
kill -TERM $xvfb_proc | ||
wait $xvfb_proc | ||
fi | ||
} | ||
|
||
# Setup a trap to catch SIGTERM and relay it to child processes | ||
trap _kill_procs SIGTERM | ||
|
||
xvfb_proc="" | ||
if $USE_XVFB; then | ||
Xvfb :99 -ac -screen 0 $XVFB_WHD -nolisten tcp & | ||
xvfb_proc=$! | ||
export DISPLAY=:99 | ||
fi | ||
|
||
# Chrome remote debugging port only binds to 127.0.0.1 when running in | ||
# headless=new or headfull mode, even when you try to configure it otherwise. | ||
# So this is our way of making sure this still works. | ||
|
||
socat TCP4-LISTEN:9222,fork TCP4:127.0.0.1:19222 & | ||
soc_proc=$! | ||
|
||
chrome_args="${chrome_args//9222/19222}" | ||
echo "Launching: chrome $chrome_args $url " | ||
|
||
chrome --version | ||
chrome $chromeArgs $url & | ||
browserProcess=$! | ||
chrome $chrome_args $url & | ||
browser_proc=$! | ||
|
||
wait $browserProcess | ||
#wait $xvfb | ||
wait $browser_proc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters