--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/WebCore/manual-tests/dom/document-write-synchronous-after-page-load.html Fri Sep 17 09:02:29 2010 +0300
@@ -0,0 +1,23 @@
+<p>This test ensures that document.write after page load is synchronous.</p>
+<p>You will get a PASS or FAIL alert message after a few seconds.</p>
+<script>
+window.onload = function() {
+
+ // Build a very long string to write.
+ var LIMIT = 17;
+ var str = '<p style="display:none">x</p>';
+ for (var i=0; i<LIMIT; ++i)
+ str += str;
+
+ // Write the string and check the DOM immediately and after a small delay.
+ var doc = document.implementation.createHTMLDocument();
+ doc.write(str);
+ var immediateElementCount = doc.getElementsByTagName('*').length;
+ setTimeout(function() {
+ var delayedElementCount = doc.getElementsByTagName('*').length;
+ var passOrFail = (immediateElementCount === delayedElementCount ? "PASS" : "FAIL");
+ alert(passOrFail);
+ }, 100);
+
+}
+</script>