Title: [88579] trunk
Revision
88579
Author
[email protected]
Date
2011-06-10 17:21:23 -0700 (Fri, 10 Jun 2011)

Log Message

Web Worker fails to fire error event when a resource fetch fails.
https://bugs.webkit.org/show_bug.cgi?id=62475

Reviewed by Dmitry Titov.

Source/WebCore:

Test: http/tests/workers/worker-workerScriptNotThere.html

* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::didFinishLoading): Ensure that
the client is notified of the error when it happens during loading.

LayoutTests:

* http/tests/workers/worker-workerScriptNotThere-expected.txt: Added.
* http/tests/workers/worker-workerScriptNotThere.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (88578 => 88579)


--- trunk/LayoutTests/ChangeLog	2011-06-11 00:11:01 UTC (rev 88578)
+++ trunk/LayoutTests/ChangeLog	2011-06-11 00:21:23 UTC (rev 88579)
@@ -2,6 +2,16 @@
 
         Reviewed by Dmitry Titov.
 
+        Web Worker fails to fire error event when a resource fetch fails.
+        https://bugs.webkit.org/show_bug.cgi?id=62475
+
+        * http/tests/workers/worker-workerScriptNotThere-expected.txt: Added.
+        * http/tests/workers/worker-workerScriptNotThere.html: Added.
+
+2011-06-10  David Levin  <[email protected]>
+
+        Reviewed by Dmitry Titov.
+
         Fetching a Worker with url that isn't allowed from a file based test causes DRT to crash.
         https://bugs.webkit.org/show_bug.cgi?id=62469
 

Added: trunk/LayoutTests/http/tests/workers/worker-workerScriptNotThere-expected.txt (0 => 88579)


--- trunk/LayoutTests/http/tests/workers/worker-workerScriptNotThere-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/worker-workerScriptNotThere-expected.txt	2011-06-11 00:21:23 UTC (rev 88579)
@@ -0,0 +1,8 @@
+Test worker file does not exist error. Should print two "PASS" statements followed by "DONE".
+
+The order of the error events should be onerror and then error event, and this test should be improved to verify that when bug https://bugs.webkit.org/show_bug.cgi?id=62485 is fixed.
+
+PASS: error event.
+PASS: onerror called.
+DONE
+
Property changes on: trunk/LayoutTests/http/tests/workers/worker-workerScriptNotThere-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/http/tests/workers/worker-workerScriptNotThere.html (0 => 88579)


--- trunk/LayoutTests/http/tests/workers/worker-workerScriptNotThere.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/worker-workerScriptNotThere.html	2011-06-11 00:21:23 UTC (rev 88579)
@@ -0,0 +1,51 @@
+<html>
+<body>
+<p>Test worker file does not exist error. Should print two "PASS" statements followed by "DONE".</p>
+<p>The order of the error events should be onerror and then error event, and this test should be improved to verify that when bug https://bugs.webkit.org/show_bug.cgi?id=62485 is fixed.</p>
+<div id=result></div>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+function log(message)
+{
+    document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function done()
+{
+    log("DONE");
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+
+var eventCount = 0;
+
+function eventDone()
+{
+    eventCount++;
+    if (eventCount == 2)
+        done();
+}
+
+var worker;
+try {
+    worker = new Worker("this-file-does-should-not-exist.js");
+} catch (error) {
+    log("FAIL: Exception thrown.");
+}
+
+worker.addEventListener('error', function(error) {
+    log("PASS: error event.");
+    eventDone();
+}, false);
+
+worker._onerror_ =  function(error) {
+    log("PASS: onerror called.");
+    eventDone();
+};
+
+</script>
+</body>
+</html>
Property changes on: trunk/LayoutTests/http/tests/workers/worker-workerScriptNotThere.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (88578 => 88579)


--- trunk/Source/WebCore/ChangeLog	2011-06-11 00:11:01 UTC (rev 88578)
+++ trunk/Source/WebCore/ChangeLog	2011-06-11 00:21:23 UTC (rev 88579)
@@ -2,6 +2,19 @@
 
         Reviewed by Dmitry Titov.
 
+        Web Worker fails to fire error event when a resource fetch fails.
+        https://bugs.webkit.org/show_bug.cgi?id=62475
+
+        Test: http/tests/workers/worker-workerScriptNotThere.html
+
+        * workers/WorkerScriptLoader.cpp:
+        (WebCore::WorkerScriptLoader::didFinishLoading): Ensure that
+        the client is notified of the error when it happens during loading.
+
+2011-06-10  David Levin  <[email protected]>
+
+        Reviewed by Dmitry Titov.
+
         Fetching a Worker with url that isn't allowed from a file based test causes DRT to crash.
         https://bugs.webkit.org/show_bug.cgi?id=62469
 

Modified: trunk/Source/WebCore/workers/WorkerScriptLoader.cpp (88578 => 88579)


--- trunk/Source/WebCore/workers/WorkerScriptLoader.cpp	2011-06-11 00:11:01 UTC (rev 88578)
+++ trunk/Source/WebCore/workers/WorkerScriptLoader.cpp	2011-06-11 00:21:23 UTC (rev 88579)
@@ -146,8 +146,10 @@
 
 void WorkerScriptLoader::didFinishLoading(unsigned long identifier, double)
 {
-    if (m_failed)
+    if (m_failed) {
+        notifyError();
         return;
+    }
 
     if (m_decoder)
         m_script += m_decoder->flush();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to