Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude artifacts from result handed to extension/devtools. #1400

Merged
merged 2 commits into from
Jan 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lighthouse-core/report/report-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

const Formatter = require('../formatters/formatter');
const Handlebars = require('handlebars');
const stringify = require('json-stringify-safe');
const fs = require('fs');
const path = require('path');
const marked = require('marked');
Expand Down Expand Up @@ -251,7 +252,7 @@ class ReportGenerator {
errMessage: err.message,
errStack: err.stack,
css: this.getReportCSS(),
results: JSON.stringify(results, null, 2)
results: stringify(results, null, 2)
});
}

Expand Down
10 changes: 10 additions & 0 deletions lighthouse-extension/app/src/lighthouse-background.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ function updateBadgeUI(optUrl) {
}
}

/**
* Removes artifacts from the result object for portability
* @param {!Object} results Lighthouse results object
*/
function filterOutArtifacts(result) {
// strip them out, as the networkRecords artifact has circular structures
result.artifacts = undefined;
}

/**
* @param {!Connection} connection
* @param {string} url
Expand All @@ -120,6 +129,7 @@ window.runLighthouseForConnection = function(connection, url, options, requested
.then(result => {
lighthouseIsRunning = false;
updateBadgeUI();
filterOutArtifacts(result);
return result;
})
.catch(err => {
Expand Down