Current time: 12-07-2019, 09:05 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
JS error in the filmstrip comparison
04-27-2013, 01:30 AM
Post: #1
JS error in the filmstrip comparison
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

Jean-pierre VINCENT
braincracking.org
Fork of WPT monitor private instance : https://github.com/jpvincent/WPT-server
Find all posts by this user
Quote this message in a reply
04-27-2013, 01:43 AM
Post: #2
RE: JS error in the filmstrip comparison
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).
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)