Skip to content

Commit

Permalink
Include which browser args/preferences/trace configuration where used… (
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore authored Jan 25, 2025
1 parent 8b2e65b commit 345ef58
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion lib/core/engine/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
addConnectivity,
removeConnectivity
} from '../../connectivity/index.js';
import { logResultLogLine, getProperty } from '../../support/util.js';
import { logResultLogLine, getProperty, toArray } from '../../support/util.js';
import {
getFullyLoaded,
getMainDocumentTimings,
Expand All @@ -30,6 +30,8 @@ import {
loadPageCompleteScript
} from '../../support/engineUtils.js';
import { getAvailablePort } from '../../support/getPort.js';
import { traceCategories as defaultChromeTraceCategories } from '../../chrome/settings/traceCategories.js';

const log = getLogger('browsertime');
const defaults = {
scripts: [],
Expand Down Expand Up @@ -369,6 +371,43 @@ export class Engine {
for (let result of totalResult) {
result.info.browser.name = extras.har.log.browser.name;
result.info.browser.version = extras.har.log.browser.version;
if (options.browser === 'firefox' && options.firefox) {
result.info.browser.args = options.firefox.args;
if (options.firefox.geckoProfiler === true) {
result.info.browser.geckProfilerFeatures =
options.firefox.geckoProfilerParams.features;
}
result.info.browser.preference = options.firefox.preference;
} else if (options.browser === 'chrome') {
if (options.chrome) {
result.info.browser.args = options.chrome.args;
}
if (
options.chrome &&
(options.cpu || options.chrome.timeline || options.chrome.trace)
) {
// get correct trace categories
let chromeTraceCategories = options.chrome.traceCategories
? options.chrome.traceCategories.split(',')
: [...defaultChromeTraceCategories];

if (options.chrome.enableTraceScreenshots) {
chromeTraceCategories.push(
'disabled-by-default-devtools.screenshot'
);
}

if (options.chrome && options.chrome.traceCategory) {
const extraCategories = toArray(options.chrome.traceCategory);
Array.prototype.push.apply(
chromeTraceCategories,
extraCategories
);
}

result.info.browser.traceCategories = chromeTraceCategories;
}
}
}
} else if (options.browser === 'safari') {
for (let result of totalResult) {
Expand Down

0 comments on commit 345ef58

Please sign in to comment.