Removed some unused data from jsExecution in JSON

This commit is contained in:
Gaël Métais
2015-12-22 19:19:39 +01:00
parent 28f9ed64ff
commit 6f0b97e760
@@ -110,29 +110,75 @@ exports.module = function(phantomas) {
phantomas.log('Entering deep Javascript analysis mode');
}
// Add a child but don't enter his context
// Add a child but don't enter its context
function pushContext(data) {
if (depth === 0 || deepAnalysis) {
// Some data is not needed on subchildren
if (depth === 0) {
data.timestamp = Date.now() - responseEndTime;
data.loadingStep = phantomas.currentStep || '';
}
// Some data is not needed on subchildren
if (depth > 0) {
if (data.backtrace) {
delete data.backtrace;
}
if (data.resultsNumber) {
delete data.resultsNumber;
}
}
if (depth === 0 || deepAnalysis) {
currentContext.addChild(data);
}
}
// Add a child to the current context and enter his context
// Add a child to the current context and enter its context
function enterContext(data) {
if (depth === 0 || deepAnalysis) {
// Some data is not needed on subchildren
if (depth === 0) {
data.timestamp = Date.now() - responseEndTime;
data.loadingStep = phantomas.currentStep || '';
}
// Some data is not needed on subchildren
if (depth > 0) {
if (data.backtrace) {
delete data.backtrace;
}
if (data.resultsNumber) {
delete data.resultsNumber;
}
}
if (depth === 0 || deepAnalysis) {
currentContext = currentContext.addChild(data);
}
depth ++;
}
// Save given data in the current context and jump change current context to its parent
function leaveContext(moreData) {
if (depth === 1 || deepAnalysis) {
// Some data is not needed on subchildren
if (depth === 1) {
currentContext.data.time = Date.now() - currentContext.data.timestamp - responseEndTime;
}
// Some data is not needed on subchildren
if (depth > 1) {
if (moreData && moreData.backtrace) {
delete moreData.backtrace;
}
if (moreData && moreData.resultsNumber) {
delete moreData.resultsNumber;
}
}
if (depth === 1 || deepAnalysis) {
// Merge previous data with moreData (ovewrites if exists)
if (moreData) {
@@ -148,6 +194,7 @@ exports.module = function(phantomas) {
currentContext = parent;
}
}
depth --;
}
@@ -161,7 +208,6 @@ exports.module = function(phantomas) {
if (root !== currentContext) {
return null;
}
var current = currentContext;
function recusiveRead(node) {
if (node.children.length === 0) {