Skip to content
This repository has been archived by the owner on Apr 27, 2021. It is now read-only.

Commit

Permalink
Merge pull request #15 from paulirish/multipletabs-frommaster
Browse files Browse the repository at this point in the history
use last tab if multiple tabs found
  • Loading branch information
paullewis committed Feb 10, 2016
2 parents 780a6c1 + f9d59a9 commit 0230188
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions bigrig.js
Expand Up @@ -94,6 +94,8 @@ try {
strict: argv.strict
});
});

throw e;
}

function processContents (contents) {
Expand Down
9 changes: 6 additions & 3 deletions lib/processor.js
Expand Up @@ -59,6 +59,7 @@ function analyzeTrace (contents, opts) {

for (var p = 0; p < processes.length; p++) {
var candidate = processes[p];

if (typeof candidate.labels !== 'undefined' &&
candidate.labels.length > 0 &&
candidate.labels[0] !== 'chrome://tracing' &&
Expand All @@ -82,14 +83,16 @@ function analyzeTrace (contents, opts) {
}

if (summarizable.length > 1) {
throw 'Multiple processes (tabs) found.';
var bullet = '\n * ';
var tabs = summarizable.map( pr => pr.labels[0] ).map( l => l.trim() ).join(bullet);
console.warn('Multiple processes (tabs) found:' + bullet, tabs);
summarizable = summarizable.reverse().filter( p => !!p.labels[0] ).slice(0, 1);
console.log('\nProceeding using the last named tab:' + bullet, summarizable[0].labels[0]);
}

traceProcess = summarizable.pop();

// Reset all the globals we had to define for window etc.
globalConfig.disable();

return processTrace(model, traceProcess, opts);
}

Expand Down

0 comments on commit 0230188

Please sign in to comment.