diff --git a/front/src/views/timeline.html b/front/src/views/timeline.html
index e0bc1e0..b774c9a 100644
--- a/front/src/views/timeline.html
+++ b/front/src/views/timeline.html
@@ -16,14 +16,14 @@
diff --git a/lib/tools/jsExecutionTransformer.js b/lib/tools/jsExecutionTransformer.js
index 595a913..1015a09 100644
--- a/lib/tools/jsExecutionTransformer.js
+++ b/lib/tools/jsExecutionTransformer.js
@@ -10,6 +10,11 @@ var jsExecutionTransformer = function() {
var jQueryFunctionsCollection = new Collection();
var metrics = {
+ domInteractive: 0,
+ domContentLoaded: 0,
+ domContentLoadedEnd: 0,
+ domComplete: 0,
+
DOMaccesses: 0,
DOMaccessesOnScroll: 0,
queriesWithoutResults: 0
@@ -68,22 +73,22 @@ var jsExecutionTransformer = function() {
// Mark a performance flag
if (['domInteractive', 'domContentLoaded', 'domContentLoadedEnd', 'domComplete'].indexOf(node.data.type) >= 0) {
node.windowPerformance = true;
- }
- // Read the execution tree and adjust the navigation timings (cause their not very well synchronised)
- switch(node.data.type) {
- case 'domInteractive':
- data.toolsResults.phantomas.metrics.domInteractive = node.data.timestamp;
- break;
- case 'domContentLoaded':
- data.toolsResults.phantomas.metrics.domContentLoaded = node.data.timestamp;
- break;
- case 'domContentLoadedEnd':
- data.toolsResults.phantomas.metrics.domContentLoadedEnd = node.data.timestamp;
- break;
- case 'domComplete':
- data.toolsResults.phantomas.metrics.domComplete = node.data.timestamp;
- break;
+ // Adjust the navigation timings (cause their not very well synchronised)
+ switch(node.data.type) {
+ case 'domInteractive':
+ javascriptExecutionTree.data.domInteractive = node.data.timestamp;
+ break;
+ case 'domContentLoaded':
+ javascriptExecutionTree.data.domContentLoaded = node.data.timestamp;
+ break;
+ case 'domContentLoadedEnd':
+ javascriptExecutionTree.data.domContentLoadedEnd = node.data.timestamp;
+ break;
+ case 'domComplete':
+ javascriptExecutionTree.data.domComplete = node.data.timestamp;
+ break;
+ }
}
// Transform domPaths into objects
diff --git a/test/core/indexTest.js b/test/core/indexTest.js
index 757c1aa..66d9a07 100644
--- a/test/core/indexTest.js
+++ b/test/core/indexTest.js
@@ -53,8 +53,9 @@ describe('index.js', function() {
data.toolsResults.phantomas.metrics.should.have.a.property('requests').that.equals(1);
data.toolsResults.phantomas.should.have.a.property('offenders').that.is.an('object');
data.toolsResults.phantomas.offenders.should.have.a.property('DOMelementMaxDepth');
- data.toolsResults.phantomas.offenders.DOMelementMaxDepth.should.have.length(1);
+ data.toolsResults.phantomas.offenders.DOMelementMaxDepth.should.have.length(2);
data.toolsResults.phantomas.offenders.DOMelementMaxDepth[0].should.equal('body > h1[0]');
+ data.toolsResults.phantomas.offenders.DOMelementMaxDepth[1].should.equal('body > script[1]');
// Test rules
data.should.have.a.property('rules').that.is.an('object');
@@ -76,10 +77,11 @@ describe('index.js', function() {
"score": 100,
"abnormalityScore": 0,
"offendersObj": {
- "count": 1,
+ "count": 2,
"tree": {
"body": {
- "h1[0]": 1
+ "h1[0]": 1,
+ "script[1]": 1
}
}
}
@@ -91,6 +93,10 @@ describe('index.js', function() {
data.should.have.a.property('javascriptExecutionTree').that.is.an('object');
data.javascriptExecutionTree.should.have.a.property('data');
data.javascriptExecutionTree.data.should.have.a.property('type').that.equals('main');
+ data.javascriptExecutionTree.data.should.have.a.property('domInteractive').that.is.a('number');
+ data.javascriptExecutionTree.data.should.have.a.property('domContentLoaded').that.is.a('number');
+ data.javascriptExecutionTree.data.should.have.a.property('domContentLoadedEnd').that.is.a('number');
+ data.javascriptExecutionTree.data.should.have.a.property('domComplete').that.is.a('number');
/*jshint expr: true*/
console.log.should.not.have.been.called;
diff --git a/test/www/simple-page.html b/test/www/simple-page.html
index 83c658d..b7090c1 100644
--- a/test/www/simple-page.html
+++ b/test/www/simple-page.html
@@ -4,5 +4,9 @@
Simple page
+
+