Skip to content

Commit

Permalink
Do FF's first run during docker *build*
Browse files Browse the repository at this point in the history
This gets around a few problems caused by the fact that Firefox's first
ever run on a new profile is quiet different from a normal startup. Note
that this only effects Browsh in Docker.
  • Loading branch information
tombh committed Feb 4, 2018
1 parent c0e51e6 commit fc5e72b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ RUN rm ./setup_firefox.sh && rm .travis.yml
# Setup Browsh
ADD ./interfacer/contrib/setup_browsh.sh .
RUN ./setup_browsh.sh
# Firefox behaves quite differently to normal on its first run, so by getting
# that over and done with here when there's no user to be dissapointed means
# that all future runs will be consistent.
RUN TERM=xterm script \
--return \
-c "/home/user/browsh" \
/dev/null \
>/dev/null & \
sleep 10
RUN rm ./setup_browsh.sh && rm manifest.json

CMD ["/home/user/browsh"]
Expand Down
6 changes: 2 additions & 4 deletions interfacer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (

"github.com/gorilla/websocket"
"github.com/shibukawa/configdir"

)

var (
Expand All @@ -42,8 +41,8 @@ var (
marionette net.Conn
ffCommandCount = 0
defaultFFPrefs = map[string]string{
"browser.startup.homepage": "'about:blank'",
"startup.homepage_welcome_url": "'about:blank'",
"browser.startup.homepage": "'https://www.google.com'",
"startup.homepage_welcome_url": "'https://www.google.com'",
"startup.homepage_welcome_url.additional": "''",
"devtools.errorconsole.enabled": "true",
"devtools.chrome.enabled": "true",
Expand Down Expand Up @@ -287,7 +286,6 @@ func getConfigFolder() string {
}

func startHeadlessFirefox() {
println("Starting...")
log("Starting Firefox in headless mode")
args := []string{"--marionette"}
if !*isFFGui {
Expand Down

0 comments on commit fc5e72b

Please sign in to comment.