| OLD | NEW |
| 1 /** | 1 /** |
| 2 * @fileoverview Base JS file for pages that want to parse the results JSON | 2 * @fileoverview Base JS file for pages that want to parse the results JSON |
| 3 * from the testing bots. This deals with generic utility functions, visible | 3 * from the testing bots. This deals with generic utility functions, visible |
| 4 * history, popups and appending the script elements for the JSON files. | 4 * history, popups and appending the script elements for the JSON files. |
| 5 * | 5 * |
| 6 * The calling page is expected to implement three "abstract" functions/objects. | 6 * The calling page is expected to implement three "abstract" functions/objects. |
| 7 * generatePage, validateHashParameter and defaultStateValues. | 7 * generatePage, validateHashParameter and defaultStateValues. |
| 8 */ | 8 */ |
| 9 var pageLoadStartTime = Date.now(); | 9 var pageLoadStartTime = Date.now(); |
| 10 | 10 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 appendScript(getPathToBuilderResultsFile(builderName) + 'results.json'); | 241 appendScript(getPathToBuilderResultsFile(builderName) + 'results.json'); |
| 242 } | 242 } |
| 243 | 243 |
| 244 // Grab expectations file from any builder. | 244 // Grab expectations file from any builder. |
| 245 appendScript(getPathToBuilderResultsFile(builderName) + 'expectations.json'); | 245 appendScript(getPathToBuilderResultsFile(builderName) + 'expectations.json'); |
| 246 } | 246 } |
| 247 | 247 |
| 248 var hasDoneInitialPageGeneration = false; | 248 var hasDoneInitialPageGeneration = false; |
| 249 | 249 |
| 250 function handleResourceLoad() { | 250 function handleResourceLoad() { |
| 251 // In case we load a results.json that's not in the list of builders, |
| 252 // make sure to only call handleLocationChange once from the resource loads. |
| 251 if (!hasDoneInitialPageGeneration) | 253 if (!hasDoneInitialPageGeneration) |
| 252 handleLocationChange(); | 254 handleLocationChange(); |
| 253 } | 255 } |
| 254 | 256 |
| 255 function handleLocationChange() { | 257 function handleLocationChange() { |
| 256 if (!expectationsLoaded) | 258 if (!expectationsLoaded) |
| 257 return; | 259 return; |
| 258 | 260 |
| 259 for (var build in builders) { | 261 for (var build in builders) { |
| 260 if (!resultsByBuilder[build]) | 262 if (!resultsByBuilder[build]) |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 !(popup.compareDocumentPosition(e.target) & 16)) { | 337 !(popup.compareDocumentPosition(e.target) & 16)) { |
| 336 hidePopup(); | 338 hidePopup(); |
| 337 } | 339 } |
| 338 }, false); | 340 }, false); |
| 339 | 341 |
| 340 window.addEventListener('load', function() { | 342 window.addEventListener('load', function() { |
| 341 // This doesn't seem totally accurate as there is a race between | 343 // This doesn't seem totally accurate as there is a race between |
| 342 // onload firing and the last script tag being executed. | 344 // onload firing and the last script tag being executed. |
| 343 logTime('Time to load JS', pageLoadStartTime); | 345 logTime('Time to load JS', pageLoadStartTime); |
| 344 }, false); | 346 }, false); |
| OLD | NEW |