MyBB Internal: One or more warnings occured. Please contact your administrator for assistance.
WebPagetest Forums - JS error in the filmstrip comparison

WebPagetest Forums

Full Version: JS error in the filmstrip comparison
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I noticed a parse error in some filmstrip comparison :
http://www.webpagetest.org/video/compare...be8eb358d9

In this page, one of the test seems to have an empty value, so the JS generating the graphs is failing.

Code:
dataTimes.setValue(0, 0, 'Visually Complete');
dataTimes.setValue(0, 1, 7400);
dataTimes.setValue(0, 2, 11000);
dataTimes.setValue(0, 3, 13000);
dataTimes.setValue(0, 4, 6600);
dataTimes.setValue(0, 5, );



Here is a simple fix, in video/compare.php :

PHP Code:
foreach($timeMetrics as $metric => $label) {
                echo 
"dataTimes.setValue($row, 0, '$label');\n";
                
$column 1;
                foreach(
$tests as &$test) {
                    
$val $test['pageData'][$test['run']][$test['cached']][$metric];
                    if(!empty(
$val))
                        echo 
'dataTimes.setValue('.$row.', '.$column.', '$val .');'.PHP_EOL;
                    
$column++;
                }
                
$row++;
            }
            echo 
"dataRequests.setValue(0, 0, 'Total');\n";
            echo 
"dataBytes.setValue(0, 0, 'Total');\n";
            
$column 1;
            foreach(
$tests as &$test) {
                
$val $test['pageData'][$test['run']][$test['cached']]['requests'];
                if(!empty(
$val))
                    echo 
"dataRequests.setValue(0, $column, ".$val.');'.PHP_EOL;
                
$val $test['pageData'][$test['run']][$test['cached']]['bytesIn'];
                if(!empty(
$val))
                    echo 
"dataBytes.setValue(0, $column, ".$val.');'.PHP_EOL;
                
$column++;
            }
            
$row 1;
            foreach(
$mimeTypes as $mimeType) {
                echo 
"dataRequests.setValue($row, 0, '$mimeType');\n";
                echo 
"dataBytes.setValue($row, 0, '$mimeType');\n";
                
$column 1;
                foreach(
$tests as &$test) {
                    
$val $test['breakdown'][$mimeType]['requests'];
                    if(!empty(
$val))
                        echo 
"dataRequests.setValue($row$column, ".$val.');'.PHP_EOL;
                    
$val $test['breakdown'][$mimeType]['bytes'];
                    if(!empty(
$val))
                        echo 
"dataBytes.setValue($row$column, ".$val.');'.PHP_EOL;
                    
$column++;
                }
                
$row++;
            } 

A better fix would be to know why for some tests data is missing Smile
Excellent find, thank you. The sometimes-missing graphs has been on my list to look at for a while. Should be fixed now (well, patched - haven't looked into the root cause yet).
Reference URL's