Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(juggler): Roll Firefox to 120450a2 (#3842)
This patch: - rebaselines C++ patchset atop of [Global Firefox Reformat](https://bugzilla.mozilla.org/show_bug.cgi?id=1511181) - rolls firefox to [120450a2](mozilla/gecko-dev@120450a) - splits out preference installation step from Puppeteer-Firefox's `install.js` into a separate `puppeteer-firefox/misc/install-preferences.js`. This script is re-used to install preferences when run with a custom executable path. - fixes issue with ScrollbarManager that was re-injecting the same stylesheet multiple times
- Loading branch information
1 parent
1a79955
commit cd678fb
Showing
8 changed files
with
126 additions
and
110 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
663997bb1dd09a5d93135b1707feb59024eb9db4 | ||
120450a2c56c25e7c410a909192b5b9ad7b0dff2 |
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
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
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
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
57 changes: 57 additions & 0 deletions
57
experimental/puppeteer-firefox/misc/install-preferences.js
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
const os = require('os'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
// Install browser preferences after downloading and unpacking | ||
// firefox instances. | ||
// Based on: https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Enterprise_deployment_before_60#Configuration | ||
async function installFirefoxPreferences(executablePath) { | ||
const firefoxFolder = path.dirname(executablePath); | ||
const {helper} = require('../lib/firefox/helper'); | ||
const mkdirAsync = helper.promisify(fs.mkdir.bind(fs)); | ||
|
||
let prefPath = ''; | ||
let configPath = ''; | ||
if (os.platform() === 'darwin') { | ||
prefPath = path.join(firefoxFolder, '..', 'Resources', 'defaults', 'pref'); | ||
configPath = path.join(firefoxFolder, '..', 'Resources'); | ||
} else if (os.platform() === 'linux') { | ||
await mkdirAsync(path.join(firefoxFolder, 'browser', 'defaults')); | ||
await mkdirAsync(path.join(firefoxFolder, 'browser', 'defaults', 'preferences')); | ||
prefPath = path.join(firefoxFolder, 'browser', 'defaults', 'preferences'); | ||
configPath = firefoxFolder; | ||
} else if (os.platform() === 'win32') { | ||
prefPath = path.join(firefoxFolder, 'defaults', 'pref'); | ||
configPath = firefoxFolder; | ||
} else { | ||
throw new Error('Unsupported platform: ' + os.platform()); | ||
} | ||
|
||
await Promise.all([ | ||
copyFile({ | ||
from: path.join(__dirname, '00-puppeteer-prefs.js'), | ||
to: path.join(prefPath, '00-puppeteer-prefs.js'), | ||
}), | ||
copyFile({ | ||
from: path.join(__dirname, 'puppeteer.cfg'), | ||
to: path.join(configPath, 'puppeteer.cfg'), | ||
}), | ||
]); | ||
} | ||
|
||
function copyFile({from, to}) { | ||
var rd = fs.createReadStream(from); | ||
var wr = fs.createWriteStream(to); | ||
return new Promise(function(resolve, reject) { | ||
rd.on('error', reject); | ||
wr.on('error', reject); | ||
wr.on('finish', resolve); | ||
rd.pipe(wr); | ||
}).catch(function(error) { | ||
rd.destroy(); | ||
wr.end(); | ||
throw error; | ||
}); | ||
} | ||
|
||
module.exports = installFirefoxPreferences; |
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
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