2011-06-13 Nate Chapin <japhet@chromium.org>
authorjaphet@chromium.org <japhet@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Jun 2011 22:22:16 +0000 (22:22 +0000)
committerjaphet@chromium.org <japhet@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Jun 2011 22:22:16 +0000 (22:22 +0000)
        Reviewed by Adam Barth.

        Rewrite a bunch of XHR-based tests to use waitUntilDone()/notifyDone().
        https://bugs.webkit.org/show_bug.cgi?id=62066

        * fast/xmlhttprequest/xmlhttprequest-gc.html:
        * fast/xmlhttprequest/xmlhttprequest-get.xhtml:
        * fast/xmlhttprequest/xmlhttprequest-html-response-encoding.html:
        * html5lib/runner.html:
        * html5lib/webkit-resumer.html:
        * http/tests/xmlhttprequest/access-control-basic-denied-preflight-cache.html:
        * http/tests/xmlhttprequest/access-control-basic-non-simple-allow-async.html:
        * http/tests/xmlhttprequest/access-control-preflight-async-header-denied.html:
        * http/tests/xmlhttprequest/access-control-preflight-async-method-denied.html:
        * http/tests/xmlhttprequest/access-control-preflight-async-not-supported.html:
        * http/tests/xmlhttprequest/cross-origin-preflight-get.html:
        * http/tests/xmlhttprequest/event-listener-gc.html:
        * http/tests/xmlhttprequest/interactive-state.html:
        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-004-iframe.html:
        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-005-iframe.html:
        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-006-iframe.html:
        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-007-iframe.html:
        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-008-iframe.html:
        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-009-iframe.html:
        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-010-iframe.html:
        * http/tests/xmlhttprequest/response-encoding.html:
        * http/tests/xmlhttprequest/simple-cross-origin-progress-events.html:
        * http/tests/xmlhttprequest/uri-resolution-opera-open-004.html:
        * http/tests/xmlhttprequest/uri-resolution-opera-open-005.html:
        * http/tests/xmlhttprequest/uri-resolution-opera-open-006.html:
        * http/tests/xmlhttprequest/uri-resolution-opera-open-007.html:
        * http/tests/xmlhttprequest/uri-resolution-opera-open-008.html:
        * http/tests/xmlhttprequest/uri-resolution-opera-open-009.html:
        * http/tests/xmlhttprequest/uri-resolution-opera-open-010.html:
        * http/tests/xmlhttprequest/web-apps/001.html:
        * http/tests/xmlhttprequest/xmlhttprequest-50ms-download-dispatch.html:
        * http/tests/xmlhttprequest/xmlhttprequest-crlf-getAllResponseHeader.html:
        * http/tests/xmlhttprequest/xmlhttprequest-unsafe-redirect.html:
        * http/tests/xmlhttprequest/zero-length-response.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@88709 268f45cc-cd09-0410-ab3c-d52691b4dbfc

35 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/xmlhttprequest/xmlhttprequest-gc.html
LayoutTests/fast/xmlhttprequest/xmlhttprequest-get.xhtml
LayoutTests/fast/xmlhttprequest/xmlhttprequest-html-response-encoding.html
LayoutTests/html5lib/runner.html
LayoutTests/html5lib/webkit-resumer.html
LayoutTests/http/tests/xmlhttprequest/access-control-basic-denied-preflight-cache.html
LayoutTests/http/tests/xmlhttprequest/access-control-basic-non-simple-allow-async.html
LayoutTests/http/tests/xmlhttprequest/access-control-preflight-async-header-denied.html
LayoutTests/http/tests/xmlhttprequest/access-control-preflight-async-method-denied.html
LayoutTests/http/tests/xmlhttprequest/access-control-preflight-async-not-supported.html
LayoutTests/http/tests/xmlhttprequest/cross-origin-preflight-get.html
LayoutTests/http/tests/xmlhttprequest/event-listener-gc.html
LayoutTests/http/tests/xmlhttprequest/interactive-state.html
LayoutTests/http/tests/xmlhttprequest/resources/uri-resolution-opera-open-004-iframe.html
LayoutTests/http/tests/xmlhttprequest/resources/uri-resolution-opera-open-005-iframe.html
LayoutTests/http/tests/xmlhttprequest/resources/uri-resolution-opera-open-006-iframe.html
LayoutTests/http/tests/xmlhttprequest/resources/uri-resolution-opera-open-007-iframe.html
LayoutTests/http/tests/xmlhttprequest/resources/uri-resolution-opera-open-008-iframe.html
LayoutTests/http/tests/xmlhttprequest/resources/uri-resolution-opera-open-009-iframe.html
LayoutTests/http/tests/xmlhttprequest/resources/uri-resolution-opera-open-010-iframe.html
LayoutTests/http/tests/xmlhttprequest/response-encoding.html
LayoutTests/http/tests/xmlhttprequest/simple-cross-origin-progress-events.html
LayoutTests/http/tests/xmlhttprequest/uri-resolution-opera-open-004.html
LayoutTests/http/tests/xmlhttprequest/uri-resolution-opera-open-005.html
LayoutTests/http/tests/xmlhttprequest/uri-resolution-opera-open-006.html
LayoutTests/http/tests/xmlhttprequest/uri-resolution-opera-open-007.html
LayoutTests/http/tests/xmlhttprequest/uri-resolution-opera-open-008.html
LayoutTests/http/tests/xmlhttprequest/uri-resolution-opera-open-009.html
LayoutTests/http/tests/xmlhttprequest/uri-resolution-opera-open-010.html
LayoutTests/http/tests/xmlhttprequest/web-apps/001.html
LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-50ms-download-dispatch.html
LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-crlf-getAllResponseHeader.html
LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-unsafe-redirect.html
LayoutTests/http/tests/xmlhttprequest/zero-length-response.html

index fbccadd..67c19b3 100644 (file)
@@ -1,3 +1,45 @@
+2011-06-13  Nate Chapin  <japhet@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Rewrite a bunch of XHR-based tests to use waitUntilDone()/notifyDone().
+        https://bugs.webkit.org/show_bug.cgi?id=62066
+
+        * fast/xmlhttprequest/xmlhttprequest-gc.html:
+        * fast/xmlhttprequest/xmlhttprequest-get.xhtml:
+        * fast/xmlhttprequest/xmlhttprequest-html-response-encoding.html:
+        * html5lib/runner.html:
+        * html5lib/webkit-resumer.html:
+        * http/tests/xmlhttprequest/access-control-basic-denied-preflight-cache.html:
+        * http/tests/xmlhttprequest/access-control-basic-non-simple-allow-async.html:
+        * http/tests/xmlhttprequest/access-control-preflight-async-header-denied.html:
+        * http/tests/xmlhttprequest/access-control-preflight-async-method-denied.html:
+        * http/tests/xmlhttprequest/access-control-preflight-async-not-supported.html:
+        * http/tests/xmlhttprequest/cross-origin-preflight-get.html:
+        * http/tests/xmlhttprequest/event-listener-gc.html:
+        * http/tests/xmlhttprequest/interactive-state.html:
+        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-004-iframe.html:
+        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-005-iframe.html:
+        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-006-iframe.html:
+        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-007-iframe.html:
+        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-008-iframe.html:
+        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-009-iframe.html:
+        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-010-iframe.html:
+        * http/tests/xmlhttprequest/response-encoding.html:
+        * http/tests/xmlhttprequest/simple-cross-origin-progress-events.html:
+        * http/tests/xmlhttprequest/uri-resolution-opera-open-004.html:
+        * http/tests/xmlhttprequest/uri-resolution-opera-open-005.html:
+        * http/tests/xmlhttprequest/uri-resolution-opera-open-006.html:
+        * http/tests/xmlhttprequest/uri-resolution-opera-open-007.html:
+        * http/tests/xmlhttprequest/uri-resolution-opera-open-008.html:
+        * http/tests/xmlhttprequest/uri-resolution-opera-open-009.html:
+        * http/tests/xmlhttprequest/uri-resolution-opera-open-010.html:
+        * http/tests/xmlhttprequest/web-apps/001.html:
+        * http/tests/xmlhttprequest/xmlhttprequest-50ms-download-dispatch.html:
+        * http/tests/xmlhttprequest/xmlhttprequest-crlf-getAllResponseHeader.html:
+        * http/tests/xmlhttprequest/xmlhttprequest-unsafe-redirect.html:
+        * http/tests/xmlhttprequest/zero-length-response.html:
+
 2011-06-13  Mark Pilgrim  <pilgrim@chromium.org>
 
         Reviewed by Eric Seidel.
index ea02b2d..1e1a91b 100644 (file)
@@ -2,6 +2,10 @@
 <script>
 function stateChange() {
     document.write(this.foo + '<br>');
+    if (this.readyState == 4) {
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    }
 }
 
 function collectGarbage() {
@@ -29,9 +33,6 @@ function runTest() {
 
     xhr = null;
     collectGarbage();
-
-    if (window.layoutTestController)
-        layoutTestController.notifyDone();
 }
 
 </script>
index e91706e..c81049a 100644 (file)
@@ -39,8 +39,10 @@ pre {
 <script type="text/javascript">
 var p = new XMLHttpRequest();
 
-if (window.layoutTestController)
+if (window.layoutTestController) {
   layoutTestController.dumpAsText();
+  layoutTestController.waitUntilDone();
+}
 
 function myfunc(e)
 {
@@ -71,6 +73,9 @@ function myfunc(e)
   document.getElementById("id7").firstChild.nodeValue = 
     "Event object: " + e + "\n" +
     "Event properties:\n" + eventProperties;
+
+  if (window.layoutTestController)
+    layoutTestController.notifyDone();
 }
 
 p.onload = myfunc;
index 4c6c92d..bfd1dc3 100644 (file)
@@ -7,8 +7,10 @@
 XMLHttpRequest doesn't use a correct content type for file:// URLs.</p>
 <script>
 
-    if (window.layoutTestController)
+    if (window.layoutTestController) {
         layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
 
     var console_messages = document.createElement("ol");
     document.body.appendChild(console_messages);
@@ -44,8 +46,11 @@ XMLHttpRequest doesn't use a correct content type for file:// URLs.</p>
     }
 
     function processStateChange(){
-      if (req.readyState == 4)
-        log("Async: HTML, charset determined by a META: " + req.responseText.replace(/\s/g, "").replace(/.*<body>(.*)<\/body>.*/, "$1"));
+        if (req.readyState == 4) {
+            log("Async: HTML, charset determined by a META: " + req.responseText.replace(/\s/g, "").replace(/.*<body>(.*)<\/body>.*/, "$1"));
+            if (window.layoutTestController)
+                layoutTestController.notifyDone();
+        }
     }
 
     try {
index 256b775..a90cd73 100644 (file)
@@ -33,6 +33,8 @@ display: none;
 <p>Script did not run</p>
 <iframe></iframe>
 <script>
+if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
 Markup.noAutoDump();
 Markup.useHTML5libOutputFormat();
 
@@ -123,6 +125,9 @@ function run()
             }
         }
         xhr.send(null);
+    } else {
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
     }
 }
 
index 5b4510b..fb73e2d 100644 (file)
@@ -32,6 +32,8 @@ display: none;
 <p>Script did not run</p>
 <iframe></iframe>
 <script>
+if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
 Markup.noAutoDump();
 Markup.useHTML5libOutputFormat();
 
@@ -98,6 +100,9 @@ function run()
             }
         }
         xhr.send(null);
+    } else {
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
     }
 }
 
index b35e317..ce5b4ef 100644 (file)
@@ -27,8 +27,9 @@
     }
 
     function processStateChange() {
-        if (xhr.readyState == 1) {
+        if (xhr.readyState == 1)
             log("PASS");
+        else if (xhr.readyState == 4) {
             if (window.layoutTestController)
                 layoutTestController.notifyDone();
         }
index dea4718..bb16d6d 100644 (file)
@@ -7,8 +7,10 @@ function log(message)
     document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
 }
 
-if (window.layoutTestController)
+if (window.layoutTestController) {
     layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
 
 function processStateChange()
 {
index b53cffe..77721ca 100644 (file)
@@ -7,8 +7,10 @@ function log(message)
     document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
 }
 
-if (window.layoutTestController)
+if (window.layoutTestController) {
     layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
 
 (function() {
     var xhr = new XMLHttpRequest();
@@ -46,6 +48,8 @@ if (window.layoutTestController)
         }
 
         log(xhr.responseText);
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
     }
     
     xhr.onreadystatechange = function() {
index 71d5d63..2f89845 100644 (file)
@@ -7,8 +7,10 @@ function log(message)
     document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
 }
 
-if (window.layoutTestController)
+if (window.layoutTestController) {
     layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
 
 (function() {
     var xhr = new XMLHttpRequest();
@@ -45,6 +47,8 @@ if (window.layoutTestController)
         }
 
         log(xhr.responseText);
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
     }
 
     xhr.onreadystatechange = function() {
index a8f0ebd..b2e953a 100644 (file)
@@ -7,8 +7,10 @@ function log(message)
     document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
 }
 
-if (window.layoutTestController)
+if (window.layoutTestController) {
     layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
 
 (function() {
     var xhr = new XMLHttpRequest();
@@ -45,6 +47,8 @@ if (window.layoutTestController)
         }
 
         log(xhr.responseText);
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
     }
 
     xhr.onreadystatechange = function() {
index 7f81f08..5f775ff 100644 (file)
@@ -5,6 +5,7 @@
 <script>
 if (window.layoutTestController) {
     layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
 }
 
 function log(message)
@@ -22,6 +23,8 @@ function test()
     xhr.onerror = function() { log("onerror") }
     xhr.onload = function() {
         log(xhr.responseText);
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
     }
     xhr.send(null);
 }
index 2acf0d3..ee77152 100644 (file)
@@ -17,16 +17,22 @@ function collect()
             new String("");
 }
 
-function processStateChange()
+function processStateChange(e)
 {
     if (didCollect)
         write("PASS: event handler fired after garbage collection.\n");
+    if (e.target.readyState == 4) {
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    }
 }
 
 function test() 
 {
-    if (window.layoutTestController)
+    if (window.layoutTestController) {
         layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
         
     var request = new XMLHttpRequest();
     request.onreadystatechange = processStateChange;
index ec8fcba..c752300 100644 (file)
@@ -6,8 +6,10 @@
 GMAIL: XMLHttpRequest does not correctly report "Interactive" state on receipt of load data.</p>
 <script>
 
-    if (window.layoutTestController)
+    if (window.layoutTestController) {
         layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
 
     var console_messages = document.createElement("ol");
     document.body.appendChild(console_messages);
@@ -45,10 +47,13 @@ GMAIL: XMLHttpRequest does not correctly report "Interactive" state on receipt o
     }
     
     function processStateChange(){
-      if (req.readyState == 3)
-        ++count;
-      else if (req.readyState == 4)
-        log((count > 1) ? "SUCCESS" : "FAILURE (count = " + count + ")");
+        if (req.readyState == 3)
+            ++count;
+        else if (req.readyState == 4) {
+            log((count > 1) ? "SUCCESS" : "FAILURE (count = " + count + ")");
+            if (window.layoutTestController)
+                layoutTestController.notifyDone();
+        }
     }
     
     // start async steps
index 0947081..f14c267 100644 (file)
         function test(client)
         {
             client.onreadystatechange = function() {
-            if (client.readyState == 4)
-                p.firstChild.data = client.responseText;
+                if (client.readyState == 4) {
+                    p.firstChild.data = client.responseText;
+                    if (window.layoutTestController)
+                        layoutTestController.notifyDone();
+                }
             }
-        client.send("");
+            client.send("");
         }
         </script>
     </body>
index e79c3c5..10e9572 100644 (file)
         function test(client)
         {
             client.onreadystatechange = function() {
-            if (client.readyState == 4)
-                p.firstChild.data = client.responseText;
+                if (client.readyState == 4) {
+                    p.firstChild.data = client.responseText;
+                    if (window.layoutTestController)
+                        layoutTestController.notifyDone();
+                }
             }
-        client.open("GET", "test-uri-resolution.txt");
-        client.send("");
+            client.open("GET", "test-uri-resolution.txt");
+            client.send("");
         }
         </script>
     </body>
index f158485..956e96f 100644 (file)
         function test(client)
         {
             client.onreadystatechange = function() {
-            if (client.readyState == 4)
-                p.firstChild.data = client.responseText;
+                if (client.readyState == 4) {
+                    p.firstChild.data = client.responseText;
+                    if (window.layoutTestController)
+                        layoutTestController.notifyDone();
+                }
             }
         }
         </script>
index 882453f..de49ff2 100644 (file)
         function test(client)
         {
             client.onreadystatechange = function() {
-            if (client.readyState == 4)
-                p.firstChild.data = client.responseText;
+                if (client.readyState == 4) {
+                    p.firstChild.data = client.responseText;
+                    if (window.layoutTestController)
+                        layoutTestController.notifyDone();
+                }
             }
             client.open("GET", "test-uri-resolution.txt");
             parent.send(client);
index 54b5674..e43d8ce 100644 (file)
@@ -16,6 +16,8 @@
         function test(client)
         {
             p.firstChild.data = client.responseText;
+            if (window.layoutTestController)
+                layoutTestController.notifyDone();
         }
         </script>
     </body>
index 8e195eb..a706ff3 100644 (file)
         function client()
         {
             var client = new XMLHttpRequest();
-            client.onreadystatechange = function()
-            {
-                if (client.readyState == 4)
+            client.onreadystatechange = function() {
+                if (client.readyState == 4) {
                     p.firstChild.data = client.responseText;
+                    if (window.layoutTestController)
+                        layoutTestController.notifyDone();
+                }
             }
             client.open("GET", "test-uri-resolution.txt");
             return client;
index 29710a9..f0a8b09 100644 (file)
         function client()
         {
             var client = new XMLHttpRequest();
-            client.onreadystatechange = function()
-            {
-                if (client.readyState == 4)
+            client.onreadystatechange = function() {
+                if (client.readyState == 4) {
                     p.firstChild.data = client.responseText;
+                    if (window.layoutTestController)
+                        layoutTestController.notifyDone();
+                }
             }
             client.open("GET", "test-uri-resolution.txt");
             client.send("");
index 3050905..e2e90a8 100644 (file)
@@ -7,8 +7,10 @@
 - correctly determine the encoding of XMLHttpRequest responses.</p>
 <script>
 
-    if (window.layoutTestController)
+    if (window.layoutTestController) {
         layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
 
     var console_messages = document.createElement("ol");
     document.body.appendChild(console_messages);
              get('resources/utf-8-no-charset.html', true);
            } else if (asyncStep == 11) {
              log("Async: HTML, UTF-8 as default: " + req.responseText.replace(/\s/g, "").replace(/.*<body>(.*)<\/body>.*/, "$1"));
+             if (window.layoutTestController)
+                 layoutTestController.notifyDone();
            }
         } else {
            log("Error loading URL: status " + req.status);
index ae7b80e..506a29d 100644 (file)
@@ -101,12 +101,14 @@ function test3()
     xhr.send(stringToSend);
     xhr.upload.onprogress = uploadProgress;
     xhr.upload.onload = function() { log("FAIL: upload.onload") }
-    xhr.upload.onerror = function() { log("upload.onerror (expected)") }
+    xhr.upload.onerror = function() { 
+        log("upload.onerror (expected)")
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    }
     xhr.onerror = function() {
         log("onerror (expected)");
         log("Response length: " + xhr.responseText.length);
-        if (window.layoutTestController)
-            layoutTestController.notifyDone();
     }
     xhr.onload = function() {
         log("onload");
index e870054..22b12cd 100644 (file)
@@ -7,6 +7,7 @@
         if (window.layoutTestController) {
             layoutTestController.dumpAsText();
             layoutTestController.dumpChildFramesAsText();
+            layoutTestController.waitUntilDone();
         }
         var client = new frame.contentWindow.XMLHttpRequest();
         client.open("GET", "test-uri-resolution.txt");
index 35aeabb..071f0a4 100644 (file)
@@ -7,6 +7,7 @@
         if (window.layoutTestController) {
             layoutTestController.dumpAsText();
             layoutTestController.dumpChildFramesAsText();
+            layoutTestController.waitUntilDone();
         }
         var client = new frame.contentWindow.XMLHttpRequest();
         frame.contentWindow.test(client);
index ec7f64f..faf6f10 100644 (file)
@@ -7,6 +7,7 @@
         if (window.layoutTestController) {
             layoutTestController.dumpAsText();
             layoutTestController.dumpChildFramesAsText();
+            layoutTestController.waitUntilDone();
         }
         var client = new frame.contentWindow.XMLHttpRequest();
         frame.contentWindow.test(client);
index e4a3697..9f1c8b9 100644 (file)
@@ -7,6 +7,7 @@
         if (window.layoutTestController) {
             layoutTestController.dumpAsText();
             layoutTestController.dumpChildFramesAsText();
+            layoutTestController.waitUntilDone();
         }
         var client = new frame.contentWindow.XMLHttpRequest();
         frame.contentWindow.test(client);
index 2f3ebea..d9d45a3 100644 (file)
@@ -7,6 +7,7 @@
         if (window.layoutTestController) {
             layoutTestController.dumpAsText();
             layoutTestController.dumpChildFramesAsText();
+            layoutTestController.waitUntilDone();
         }
         var client = frame.contentWindow.client();
         client.onreadystatechange = function()
index 5d12d1e..b647dcc 100644 (file)
@@ -7,6 +7,7 @@
         if (window.layoutTestController) {
             layoutTestController.dumpAsText();
             layoutTestController.dumpChildFramesAsText();
+            layoutTestController.waitUntilDone();
         }
         var client = frame.contentWindow.client();
         client.send("");
index 6aeb20f..16230cc 100644 (file)
@@ -7,6 +7,7 @@
             if (window.layoutTestController) {
                 layoutTestController.dumpAsText();
                 layoutTestController.dumpChildFramesAsText();
+                layoutTestController.waitUntilDone();
             }
         </script>
         <p><iframe src="resources/uri-resolution-opera-open-010-iframe.html" onload="this.contentWindow.client()"></iframe></p>
index 1fbb1e3..708bfa7 100644 (file)
@@ -6,8 +6,10 @@
  <body>
   <p>Script did not run.</p>
   <script type="text/javascript">
-   if (window.layoutTestController)
+   if (window.layoutTestController) {
      layoutTestController.dumpAsText();
+     layoutTestController.waitUntilDone();
+   }
 
    var p = document.getElementsByTagName('p')[0];
    p.firstChild.data = 'Test script started.';
    // window.XMLHttpRequest = function () { return new ActiveXObject("Microsoft.XMLHTTP"); }
    var r = new XMLHttpRequest();
    r.onreadystatechange = function () {
-     if (r.readyState == 4)
+     if (r.readyState == 4) {
        p.firstChild.data = r.responseText;
-     else
+       if (window.layoutTestController)
+         layoutTestController.notifyDone();
+     } else
        p.firstChild.data = 'Test in progress (' + r.readyState + '/4)';
    };
    r.open('GET', '001-test.cgi', true);
index 966460f..a6e4f86 100644 (file)
@@ -11,8 +11,10 @@ every 50ms or for every byte received, whichever is least frequent".</p>
 <p id="console"></p>
 
 <script type="text/javascript">
-if (window.layoutTestController)
+if (window.layoutTestController) {
     layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
 
 function log(message)
 {
@@ -20,6 +22,8 @@ function log(message)
     document.getElementById("console").appendChild(document.createElement("br"));
 }
 
+var testsCompleted = 0;
+
 function test(iteration, delay, compare, testDescription)
 {
     var count = 0;
@@ -35,6 +39,11 @@ function test(iteration, delay, compare, testDescription)
             sawReadyStateDONE = true;
             var passed =  compare(count, iteration);
             log(passed ? "PASSED" : "FAILED (count was " + count + ") for " + testDescription);
+            ++testsCompleted;
+            if (testsCompleted == 5) {
+                if (window.layoutTestController)
+                    layoutTestController.notifyDone();
+            }
         }
     }
 
index d4aac1d..ae82136 100644 (file)
@@ -6,8 +6,10 @@
 <p>Test page for the <a href="http://bugs.webkit.org/show_bug.cgi?id=14898">bug 14898</a> : XMLHttpRequest.getAllResponseHeaders should separate headers with CRLF</p>
 <script type="text/javascript">
 
-if (window.layoutTestController)
+if (window.layoutTestController) {
     layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
 
 var xhr = new XMLHttpRequest();
 xhr.onreadystatechange = function() {
@@ -22,6 +24,9 @@ xhr.onreadystatechange = function() {
         } else {
             document.body.appendChild(document.createTextNode("PASS"));
         }
+
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
     }
 }
 xhr.open("GET", "testPage.html", true);
index afc8b56..93cb0fa 100644 (file)
@@ -18,8 +18,6 @@ function log(message)
 function onReqreadystatechange()
 {
     log('readyState change ' +  req.readyState);
-    if (req.readyState == 4)
-        didReadFile();
 }
 
 function onReqAbort()
@@ -66,6 +64,7 @@ function runTest() {
     log ('Async XHR started.');
     req = new XMLHttpRequest();
     req.onreadystatechange = onReqreadystatechange;
+    req.onload = didReadFile;
     req.onerror = onReqError;
     req.onabort = onReqAbort;
     req.open('GET', '/xmlhttprequest/resources/redirect.php?url=http://localhost:8080/xmlhttprequest/resources/forbidden.txt');
index bccf365..803f920 100644 (file)
@@ -7,8 +7,10 @@
 - zero-length responses to XMLHTTPRequest mishandled.</p>
 <script>
 
-    if (window.layoutTestController)
+    if (window.layoutTestController) {
         layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
 
     var console_messages = document.createElement("ul");
     document.body.appendChild(console_messages);
     function processStateChange() {
        log("onreadystatechange: " + stateName(req.readyState));
        dumpResponse();
+       if (req.readyState == 4) {
+           if (window.layoutTestController)
+               layoutTestController.notifyDone();
+       }
     }
     
     // start async steps