<!DOCTYPE html>
<html class="reftest-wait">
<style>
div {
  width: 500px;
  height: 500px;
  opacity: 0.5;
  background-color: lime;
}
</style>
<div id="d"></div>
<script>
function doTest() {
  document.getElementById("d").style.opacity = 1;
  document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest);
</script>