@@ -132,28 +132,6 @@ function installNoFocusLibs(profileDir) {
132
132
}
133
133
134
134
135
- /**
136
- * Silently runs Firefox to install a profile directory (which is assumed to be
137
- * defined in the given environment variables).
138
- * @param {string } firefox Path to the Firefox executable.
139
- * @param {!Object.<string, string> } env The environment variables to use.
140
- * @return {!promise.Promise } A promise for when the profile has been installed.
141
- */
142
- function installProfile ( firefox , env ) {
143
- var installed = promise . defer ( ) ;
144
- child . exec ( firefox + ' -silent' , { env : env , timeout : 180 * 1000 } ,
145
- function ( err ) {
146
- if ( err ) {
147
- installed . reject ( new Error (
148
- 'Failed to install Firefox profile: ' + err ) ) ;
149
- return ;
150
- }
151
- installed . fulfill ( ) ;
152
- } ) ;
153
- return installed . promise ;
154
- }
155
-
156
-
157
135
/**
158
136
* Manages a Firefox subprocess configured for use with WebDriver.
159
137
*
@@ -222,25 +200,13 @@ Binary.prototype.launch = function(profile) {
222
200
223
201
var args = [ '-foreground' ] . concat ( this . args_ ) ;
224
202
225
- var self = this ;
226
-
227
203
this . command_ = promise . when ( this . exe_ || findFirefox ( ) , function ( firefox ) {
228
204
if ( process . platform === 'win32' || process . platform === 'darwin' ) {
229
- return firefox ;
205
+ return exec ( firefox , { args : args , env : env } ) ;
230
206
}
231
207
return installNoFocusLibs ( profile ) . then ( function ( ldLibraryPath ) {
232
208
env [ 'LD_LIBRARY_PATH' ] = ldLibraryPath + ':' + env [ 'LD_LIBRARY_PATH' ] ;
233
209
env [ 'LD_PRELOAD' ] = X_IGNORE_NO_FOCUS_LIB ;
234
- return firefox ;
235
- } ) ;
236
- } ) . then ( function ( firefox ) {
237
- var install = exec ( firefox , { args : [ '-silent' ] , env : env } ) ;
238
- return install . result ( ) . then ( function ( result ) {
239
- if ( result . code !== 0 ) {
240
- throw Error (
241
- 'Failed to install profile; firefox terminated with ' + result ) ;
242
- }
243
-
244
210
return exec ( firefox , { args : args , env : env } ) ;
245
211
} ) ;
246
212
} ) ;
0 commit comments