choose kind of headless backend #559
This commit is contained in:
parent
6a4833dcbe
commit
adef8802d1
|
|
@ -1,5 +1,11 @@
|
|||
# CHANGELOG - sitespeed.io
|
||||
|
||||
version 3.1
|
||||
------------------------
|
||||
* Support for SlimerJS. Note: Choose which "headless" analyzer to use by
|
||||
using --headless [slimerjs|phantomjs].
|
||||
Also fetch timings using your choice by configure -b headless
|
||||
|
||||
version 3.0.5
|
||||
------------------------
|
||||
* Changed deprecated phantom.args to be compatible to PhantomJS 2 #558
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
var defaultConfig = {
|
||||
supportedBrowsers: ['chrome', 'firefox', 'phantomjs', 'ie', 'safari'],
|
||||
supportedBrowsers: ['chrome', 'firefox', 'headless', 'ie', 'safari'],
|
||||
connection: ['mobile3g', 'mobile3gfast', 'cable', 'native'],
|
||||
deep: 1,
|
||||
threads: 5,
|
||||
memory: 1024,
|
||||
headless: 'phantomjs',
|
||||
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36',
|
||||
yslow: 'headless/yslow-3.1.8-sitespeed.js',
|
||||
ruleSet: 'sitespeed.io-desktop',
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ Analyzer.prototype.analyze = function(urls, collector, config, downloadErrors, a
|
|||
if (config.runYslow) {
|
||||
analyzers.push(yslow);
|
||||
}
|
||||
if (config.headless) {
|
||||
if (config.headlessTimings) {
|
||||
analyzers.push(headless);
|
||||
}
|
||||
if (config.gpsiKey) {
|
||||
|
|
|
|||
|
|
@ -78,13 +78,13 @@ function runHeadless(args, asyncDoneCallback) {
|
|||
var binPath = config.phantomjsPath || phantomPath;
|
||||
var childArgs = generateArgs();
|
||||
|
||||
log.info('Fetching data using ' + (config.slimerjs ? 'SlimerJS' : 'PhantomJS') + ' for %s', url);
|
||||
log.info('Fetching timing data using ' + config.headless + ' for %s', url);
|
||||
|
||||
childProcess.execFile(binPath, childArgs, { timeout: 60000 }, handleResult);
|
||||
|
||||
function generateArgs() {
|
||||
var childArgs = [];
|
||||
if (config.slimerjs) {
|
||||
if (config.headless === 'slimerjs') {
|
||||
binPath = slimerPath;
|
||||
} else {
|
||||
childArgs.push('--ssl-protocol=any', '--ignore-ssl-errors=yes');
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ function screenshot(args, asyncDoneCallback) {
|
|||
|
||||
function generatePhantomArgs() {
|
||||
var childArgs = [];
|
||||
if (config.slimerjs) {
|
||||
if (config.headless === 'slimerjs') {
|
||||
binPath = slimerPath;
|
||||
} else {
|
||||
childArgs.push('--ssl-protocol=any', '--ignore-ssl-errors=yes');
|
||||
|
|
|
|||
|
|
@ -69,13 +69,13 @@ function analyzeUrl(args, asyncDoneCallback) {
|
|||
var binPath = config.phantomjsPath || phantomPath;
|
||||
var childArgs = generatePhantomArgs();
|
||||
|
||||
log.info('Running YSlow for %s', url);
|
||||
log.info('Running YSlow for %s [' + config.headless + ']', url);
|
||||
|
||||
childProcess.execFile(binPath, childArgs, {timeout: 240000}, handlePhantomResult);
|
||||
|
||||
function generatePhantomArgs() {
|
||||
var childArgs = [];
|
||||
if (config.slimerjs) {
|
||||
if (config.headless === 'slimerjs') {
|
||||
binPath = slimerPath;
|
||||
} else {
|
||||
childArgs.push('--ssl-protocol=any', '--ignore-ssl-errors=yes');
|
||||
|
|
|
|||
|
|
@ -151,9 +151,9 @@ var fs = require('fs-extra'),
|
|||
}
|
||||
}
|
||||
},
|
||||
slimerjs: {
|
||||
flag: true,
|
||||
help: 'Use Slimerjs instead of Phantomjs for YSlow processing (Experimental).'
|
||||
headless: {
|
||||
default: defaultConfig.headless,
|
||||
help: 'Choose which backend to use for headless [phantomjs|slimerjs]'
|
||||
},
|
||||
ruleSet: {
|
||||
metavar: '<RULE-SET>',
|
||||
|
|
@ -171,7 +171,7 @@ var fs = require('fs-extra'),
|
|||
browser: {
|
||||
abbr: 'b',
|
||||
metavar: '<BROWSER>',
|
||||
help: 'Choose which browser to use to collect timing data. Use multiple browsers in a comma separated list (firefox|chrome|phantomjs|slimerjs)',
|
||||
help: 'Choose which browser to use to collect timing data. Use multiple browsers in a comma separated list (firefox|chrome|headless)',
|
||||
callback: function(browsers) {
|
||||
var b = browsers.split(','),
|
||||
invalidBrowsers = b.filter(function(browser) {
|
||||
|
|
|
|||
|
|
@ -21,19 +21,18 @@ exports.setupDefaultValues = function(config) {
|
|||
});
|
||||
|
||||
// to make it easy later on, we add:
|
||||
// config.browertime = the browser(s) that will be run in browsertime (not phantomjs)
|
||||
// config.phantomjs - boolean to run phantomjs for timings or not
|
||||
// config.browertime = the browser(s) that will be run in browsertime (not phantomjs/slimerjs)
|
||||
// config.headlessTimings - boolean to run headless timings or not
|
||||
if (config.browser) {
|
||||
var b = config.browser.split(','),
|
||||
configuredBrowsers = b.filter(function(browser) {
|
||||
return defaultConfig.supportedBrowsers.indexOf(browser.toLowerCase()) > -1;
|
||||
});
|
||||
|
||||
// TODO Include slimer
|
||||
if (configuredBrowsers.indexOf('phantomjs') > -1) {
|
||||
config.headless = true;
|
||||
if (configuredBrowsers.indexOf('headless') > -1) {
|
||||
config.headlessTimings = true;
|
||||
if (configuredBrowsers.length > 1) {
|
||||
var i = configuredBrowsers.indexOf('phantomjs');
|
||||
var i = configuredBrowsers.indexOf('headless');
|
||||
configuredBrowsers.splice(i, 1);
|
||||
config.browsertime = configuredBrowsers;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue