@@ -158,9 +158,7 @@ function downloadFirefoxNightly() {
158
158
} ) ;
159
159
}
160
160
161
- // Download Firefox Release
162
-
163
- function downloadFirefoxRelease ( ) {
161
+ function downloadFirefoxFromDMO ( product , destDir ) {
164
162
return new Promise ( function ( resolve , reject ) {
165
163
var firefoxPlatform ;
166
164
if ( process . platform === 'linux' ) {
@@ -173,63 +171,37 @@ function downloadFirefoxRelease() {
173
171
}
174
172
175
173
function getFile ( ) {
176
- var files = fs . readdirSync ( stableDestDir ) ;
174
+ var files = fs . readdirSync ( destDir ) ;
177
175
return files . find ( function ( file ) {
178
176
return file . indexOf ( 'index.html?' ) === 0 ;
179
177
} ) ;
180
178
}
181
179
182
- var fileName = 'index.html?product=firefox-latest &lang=en-US&os=' + firefoxPlatform ;
180
+ var fileName = 'index.html?product=' + product + ' &lang=en-US&os=' + firefoxPlatform ;
183
181
184
- wget ( stableDestDir , 'https://download.mozilla.org/?product=firefox-latest &lang=en-US&os=' + firefoxPlatform )
182
+ wget ( destDir , 'https://download.mozilla.org/?product=' + product + ' &lang=en-US&os=' + firefoxPlatform )
185
183
. then ( function ( ) {
186
184
if ( process . platform === 'linux' ) {
187
- untar ( stableDestDir , path . join ( stableDestDir , fileName ) )
185
+ untar ( destDir , path . join ( destDir , fileName ) )
188
186
. then ( resolve ) ;
189
187
} else if ( process . platform === 'darwin' ) {
190
- dmg . mount ( path . join ( stableDestDir , fileName ) , function ( err , extractedPath ) {
191
- fse . copySync ( path . join ( extractedPath , 'Firefox.app' ) , path . join ( stableDestDir , 'Firefox.app' ) ) ;
188
+ dmg . mount ( path . join ( destDir , fileName ) , function ( err , extractedPath ) {
189
+ fse . copySync ( path . join ( extractedPath , 'Firefox.app' ) , path . join ( destDir , 'Firefox.app' ) ) ;
192
190
dmg . unmount ( extractedPath , resolve ) ;
193
191
} ) ;
194
192
}
195
193
} ) ;
196
194
} ) ;
197
195
}
198
196
199
- function downloadFirefoxBeta ( ) {
200
- return new Promise ( function ( resolve , reject ) {
201
- var firefoxPlatform ;
202
- if ( process . platform === 'linux' ) {
203
- firefoxPlatform = 'linux' ;
204
- if ( process . arch === 'x64' ) {
205
- firefoxPlatform += '64' ;
206
- }
207
- } else if ( process . platform === 'darwin' ) {
208
- firefoxPlatform = 'osx' ;
209
- }
210
-
211
- function getFile ( ) {
212
- var files = fs . readdirSync ( betaDestDir ) ;
213
- return files . find ( function ( file ) {
214
- return file . indexOf ( 'index.html?' ) === 0 ;
215
- } ) ;
216
- }
197
+ // Download Firefox Release
217
198
218
- var fileName = 'index.html?product=firefox-beta-latest&lang=en-US&os=' + firefoxPlatform ;
199
+ function downloadFirefoxRelease ( ) {
200
+ return downloadFirefoxFromDMO ( 'firefox-latest' , stableDestDir ) ;
201
+ }
219
202
220
- wget ( betaDestDir , 'https://download.mozilla.org/?product=firefox-beta-latest&lang=en-US&os=' + firefoxPlatform )
221
- . then ( function ( ) {
222
- if ( process . platform === 'linux' ) {
223
- untar ( betaDestDir , path . join ( betaDestDir , fileName ) )
224
- . then ( resolve ) ;
225
- } else if ( process . platform === 'darwin' ) {
226
- dmg . mount ( path . join ( betaDestDir , fileName ) , function ( err , extractedPath ) {
227
- fse . copySync ( path . join ( extractedPath , 'Firefox.app' ) , path . join ( betaDestDir , 'Firefox.app' ) ) ;
228
- dmg . unmount ( extractedPath , resolve ) ;
229
- } ) ;
230
- }
231
- } ) ;
232
- } ) ;
203
+ function downloadFirefoxBeta ( ) {
204
+ return downloadFirefoxFromDMO ( 'firefox-beta-latest' , betaDestDir ) ;
233
205
}
234
206
235
207
// Download Chrome Canary
0 commit comments