summaryrefslogtreecommitdiffstats
path: root/WebCore/manual-tests/dom/document-write-synchronous-after-page-load.html
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/manual-tests/dom/document-write-synchronous-after-page-load.html')
-rw-r--r--WebCore/manual-tests/dom/document-write-synchronous-after-page-load.html23
1 files changed, 23 insertions, 0 deletions
diff --git a/WebCore/manual-tests/dom/document-write-synchronous-after-page-load.html b/WebCore/manual-tests/dom/document-write-synchronous-after-page-load.html
new file mode 100644
index 0000000..f62fd68
--- /dev/null
+++ b/WebCore/manual-tests/dom/document-write-synchronous-after-page-load.html
@@ -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>