// We'll receive the 'message' event after everything else that's currently in
// the event queue (which is a stronger guarantee than setTimeout, because
// setTimeout events may be coalesced). This lets us ensure that we run
// aCallback *after* any asynchronous events are delivered.
window.postMessage('next', '*');
}
// The image is loaded async after the page loads
// wait for it to finish loading
function onImageLoad() {
// Use a canvas to force the image to get sync decoded. varcanvas = document.createElement('canvas'); var ctx = canvas.getContext('2d');
try {
ctx.drawImage(gImg, 0, 0);
} catch (e) {
}
// Continue after pumping the event loop.
runAfterAsyncEvents(step2);
}
function step2() {
// Only now, once the image has already been sync decoded, do we load it in
// the <img> element we're going to snapshot. That's because for some of the
// tests that use wrapper.html, an error is only detected when decoding the
// actual image data - i.e., the error isn't detected in the header. The
// precise time when we detect the error, unfortunately, affects how we draw
// the image. This will be fixed in bug 1182531, and then we can simplify this
// code.
function step3() {
// We're ready to take the snapshot, but pump the event loop first just to
// be sure that everything has settled down.
runAfterAsyncEvents(takeSnapshot);
}
function takeSnapshot() {
document.documentElement.removeAttribute("class");
}
</script>
</head>
<body> <!-- non-empty alt to avoid the broken image icon -->
<img id="image1" alt=" ">
<script>
// Use as "wrapper.html?image.png
gImg = document.createElement('img');
gImg.onload = gImg.onerror = onImageLoad;
gImg.src = document.location.search.substr(1);
</script>
</body>
</html>
Messung V0.5
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.