1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/plugins/test/reftest/update-1.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,57 @@ 1.4 +<!DOCTYPE html> 1.5 +<html class="reftest-wait"> 1.6 +<head> 1.7 + <title>Test for bugs 807728 and 810426</title> 1.8 + <script> 1.9 +function start() 1.10 +{ 1.11 + document.removeEventListener("MozReftestInvalidate", start, false); 1.12 + 1.13 + var plugin = document.getElementById("plugin"); 1.14 + var color = "FF000000"; 1.15 + var color_count = 0; 1.16 + var last_paint_count = 0; 1.17 + // Enough paints to test reusing a surface after it has been 1.18 + // moved from front to back buffer. 1.19 + var final_paint_count = window.mozPaintCount + 10; 1.20 + var final_color = "FFFF0000"; 1.21 + 1.22 + // Using mozPaintCount to track when content has been updated as an 1.23 + // indication that the browser has received updates, instead of 1.24 + // plugin.getPaintCount() which tracks when the plugin sends updates or 1.25 + // MozAfterPaint events which track OS paints. Not using 1.26 + // MozPaintWaitFinished because invalidation causes no geometry changes. 1.27 + function wait_for_paints() { 1.28 + var paint_count = window.mozPaintCount; 1.29 + if (paint_count >= final_paint_count && color == final_color) { 1.30 + document.documentElement.removeAttribute("class"); 1.31 + return; 1.32 + } 1.33 + if (paint_count != last_paint_count) { 1.34 + last_paint_count = paint_count; 1.35 + if (paint_count + 1 >= final_paint_count) { 1.36 + color = final_color; 1.37 + // Wait for the paint with the final color 1.38 + final_paint_count = paint_count + 1; 1.39 + } else { 1.40 + ++color_count; 1.41 + color = "FF00000" + color_count; 1.42 + } 1.43 + plugin.setColor(color); 1.44 + } 1.45 + setTimeout(wait_for_paints, 0); 1.46 + } 1.47 + 1.48 + wait_for_paints(); 1.49 +} 1.50 + 1.51 +// MozReftestInvalidate is delivered after initial painting has settled. 1.52 +document.addEventListener("MozReftestInvalidate", start, false); 1.53 + </script> 1.54 +</head> 1.55 +<body> 1.56 + <embed id="plugin" type="application/x-test" 1.57 + drawmode="solid" color="FF000000" width="30" height="50"> 1.58 + </embed> 1.59 +</body> 1.60 +</html>