Index: tracing/tracing/importer/find_load_expectations.html |
diff --git a/tracing/tracing/importer/find_load_expectations.html b/tracing/tracing/importer/find_load_expectations.html |
index 5a20648834f6e218ada4254bc25dbbefadc88337..c9135599c8cffebe8a38d71abc9f3d3e8e5f3fd0 100644 |
--- a/tracing/tracing/importer/find_load_expectations.html |
+++ b/tracing/tracing/importer/find_load_expectations.html |
@@ -20,16 +20,20 @@ tr.exportTo('tr.importer', function() { |
function findLoadExpectations(modelHelper) { |
var events = []; |
- modelHelper.model.iterateAllEvents(function(event) { |
+ for (var event of modelHelper.model.getDescendantEvents()) { |
if ((event.title === NAVIGATION_START) || |
(event.title === FIRST_CONTENTFUL_PAINT_TITLE)) |
events.push(event); |
- }); |
+ } |
events.sort(tr.importer.compareEvents); |
var loads = []; |
var startEvent = undefined; |
- events.forEach(function(event) { |
+ // TODO(alexandermont): What's supposed to happen if there are two |
+ // NAVIGATION_STARTs with no FIRST_CONTENTFUL_PAINT_TITLE between |
+ // them? Are you supposed to just "lose" the first NAVIGATION_START, |
+ // like what's happening now? |
+ for (var event of events) { |
if (event.title === NAVIGATION_START) { |
startEvent = event; |
} else if (event.title === FIRST_CONTENTFUL_PAINT_TITLE) { |
@@ -40,7 +44,7 @@ tr.exportTo('tr.importer', function() { |
startEvent = undefined; |
} |
} |
- }); |
+ } |
// If the trace ended between navigation start and first contentful paint, |
// then make a LoadExpectation that ends at the end of the trace. |