var gIFrame; var gCurrentWidth = 500; var gGotEventsAt = []; var gInterval; var gFinished = false;
function run() {
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("Simulating dragging to resize a window");
gIFrame = document.getElementById("display");
var subdoc = gIFrame.contentDocument;
subdoc.open();
subdoc.write("");
subdoc.close();
setTimeout(do_a_resize, 50);
}
function do_a_resize()
{
// decrease the width by 10 until we hit 400, then stop
gCurrentWidth -= 10;
gIFrame.style.width = gCurrentWidth + "px";
if (gCurrentWidth > 400) {
setTimeout(do_a_resize, 50);
}
}
function handle_resize_event()
{
gGotEventsAt.push(gCurrentWidth);
if (gCurrentWidth == 400) {
check_resize_events();
}
}
function check_resize_events()
{
if (gFinished) {
// We can get here when the browser can't process the resizes and
// dispatch resize events as fast as we're doing the resizing. We can
// then end up with multiple resize events queued up after we set our
// final size. This return makes sure that in that case we avoid
// calling SimpleTest.finish() more than once.
return;
}
gFinished = true;
ok(gGotEventsAt.length >= 2, "We should get more than one event");
isnot(gGotEventsAt[0], 400, "The first event shouldn't be for the final size");
SimpleTest.finish();
}
</script>
</pre>
</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.