summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-28 18:29:55 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-28 18:29:55 +0000
commitbb08f1570dd01855b7a4d71ba37b43af5dae4578 (patch)
treedf21b77f7d7e129ecb256738046719fa8c518f92 /webkit
parentbec2c9fbba00e66bf5b13c59d021a0aa4d03427b (diff)
downloadchromium_src-bb08f1570dd01855b7a4d71ba37b43af5dae4578.zip
chromium_src-bb08f1570dd01855b7a4d71ba37b43af5dae4578.tar.gz
chromium_src-bb08f1570dd01855b7a4d71ba37b43af5dae4578.tar.bz2
Enable layout tests: worker-constructor.html and worker-script-error.html.
BUG=none TEST=none Review URL: http://codereview.chromium.org/159429 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21863 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/data/layout_tests/platform/chromium-mac/LayoutTests/fast/workers/use-machine-stack-expected.txt4
-rw-r--r--webkit/data/layout_tests/platform/chromium-mac/LayoutTests/fast/workers/worker-constructor-expected.txt8
-rw-r--r--webkit/data/layout_tests/platform/chromium-mac/LayoutTests/fast/workers/worker-location-expected.txt15
-rw-r--r--webkit/data/layout_tests/platform/chromium-win/LayoutTests/fast/workers/worker-constructor-expected.txt3
-rw-r--r--webkit/data/layout_tests/platform/chromium-win/LayoutTests/fast/workers/worker-script-error-expected.txt10
-rw-r--r--webkit/glue/webworkerclient_impl.cc24
6 files changed, 31 insertions, 33 deletions
diff --git a/webkit/data/layout_tests/platform/chromium-mac/LayoutTests/fast/workers/use-machine-stack-expected.txt b/webkit/data/layout_tests/platform/chromium-mac/LayoutTests/fast/workers/use-machine-stack-expected.txt
deleted file mode 100644
index 1c344db..0000000
--- a/webkit/data/layout_tests/platform/chromium-mac/LayoutTests/fast/workers/use-machine-stack-expected.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-Test worker thread stack usage. Should not crash.
-
-PASS (RangeError: Maximum call stack size exceeded)
-
diff --git a/webkit/data/layout_tests/platform/chromium-mac/LayoutTests/fast/workers/worker-constructor-expected.txt b/webkit/data/layout_tests/platform/chromium-mac/LayoutTests/fast/workers/worker-constructor-expected.txt
deleted file mode 100644
index 15a042c..0000000
--- a/webkit/data/layout_tests/platform/chromium-mac/LayoutTests/fast/workers/worker-constructor-expected.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-Test Worker constructor functionality. Should print a series of PASS messages, followed with DONE.
-
-PASS: toString exception propagated correctly.
-PASS: trying to create workers recursively resulted in an exception (RangeError: Maximum call stack size exceeded)
-PASS: invoking Worker constructor without arguments resulted in an exception (SyntaxError: Not enough arguments)
-PASS: onerror invoked for a script that could not be loaded.
-DONE
-
diff --git a/webkit/data/layout_tests/platform/chromium-mac/LayoutTests/fast/workers/worker-location-expected.txt b/webkit/data/layout_tests/platform/chromium-mac/LayoutTests/fast/workers/worker-location-expected.txt
deleted file mode 100644
index 2596296..0000000
--- a/webkit/data/layout_tests/platform/chromium-mac/LayoutTests/fast/workers/worker-location-expected.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-Test WorkerLocation properties.
-
-WorkerLocation: function WorkerLocation() { [native code] }
-typeof location: object
-location: file:<...>/fast/workers/resources/worker-common.js
-location.href: file:<...>/fast/workers/resources/worker-common.js
-location.protocol: file:
-location.host:
-location.hostname:
-location.port:
-location.pathname: <...>/fast/workers/resources/worker-common.js
-location.search:
-location.hash:
-DONE
-
diff --git a/webkit/data/layout_tests/platform/chromium-win/LayoutTests/fast/workers/worker-constructor-expected.txt b/webkit/data/layout_tests/platform/chromium-win/LayoutTests/fast/workers/worker-constructor-expected.txt
index 15a042c..8dde63c 100644
--- a/webkit/data/layout_tests/platform/chromium-win/LayoutTests/fast/workers/worker-constructor-expected.txt
+++ b/webkit/data/layout_tests/platform/chromium-win/LayoutTests/fast/workers/worker-constructor-expected.txt
@@ -3,6 +3,9 @@ Test Worker constructor functionality. Should print a series of PASS messages, f
PASS: toString exception propagated correctly.
PASS: trying to create workers recursively resulted in an exception (RangeError: Maximum call stack size exceeded)
PASS: invoking Worker constructor without arguments resulted in an exception (SyntaxError: Not enough arguments)
+PASS: onerror invoked for an empty script URL.
+PASS: onerror invoked for an invalid script URL.
PASS: onerror invoked for a script that could not be loaded.
+PASS: Successfully created worker.
DONE
diff --git a/webkit/data/layout_tests/platform/chromium-win/LayoutTests/fast/workers/worker-script-error-expected.txt b/webkit/data/layout_tests/platform/chromium-win/LayoutTests/fast/workers/worker-script-error-expected.txt
new file mode 100644
index 0000000..42044af
--- /dev/null
+++ b/webkit/data/layout_tests/platform/chromium-win/LayoutTests/fast/workers/worker-script-error-expected.txt
@@ -0,0 +1,10 @@
+Test Worker script error handling functionality. Should print a series of PASS messages, followed with DONE.
+
+PASS: onerror invoked for a script that has invalid syntax.
+PASS: onerror invoked for a script that has script error 'Uncaught ReferenceError: foo is not defined' at line 1.
+PASS: onerror invoked for a script that has script error 'Uncaught ReferenceError: foo is not defined' at line 7.
+PASS: onerror invoked for a script that has script error 'Uncaught ReferenceError: foo is not defined' at line 7.
+PASS: onerror invoked for a script that has script error 'Uncaught ReferenceError: foo is not defined' at line 7.
+PASS: message received from WorkerGlobalScope.onerror: onerror invoked for a script that has script error 'Uncaught ReferenceError: foo is not defined' at line 7.
+DONE
+
diff --git a/webkit/glue/webworkerclient_impl.cc b/webkit/glue/webworkerclient_impl.cc
index 22b7c17..1465eda 100644
--- a/webkit/glue/webworkerclient_impl.cc
+++ b/webkit/glue/webworkerclient_impl.cc
@@ -212,10 +212,17 @@ void WebWorkerClientImpl::postExceptionToWorkerObject(
return;
}
- script_execution_context_->reportException(
- webkit_glue::WebStringToString(error_message),
- line_number,
- webkit_glue::WebStringToString(source_url));
+ bool handled = false;
+ if (worker_->onerror())
+ handled = worker_->dispatchScriptErrorEvent(
+ webkit_glue::WebStringToString(error_message),
+ webkit_glue::WebStringToString(source_url),
+ line_number);
+ if (!handled)
+ script_execution_context_->reportException(
+ webkit_glue::WebStringToString(error_message),
+ line_number,
+ webkit_glue::WebStringToString(source_url));
}
void WebWorkerClientImpl::postConsoleMessageToWorkerObject(
@@ -325,8 +332,13 @@ void WebWorkerClientImpl::PostExceptionToWorkerObjectTask(
const WebCore::String& error_message,
int line_number,
const WebCore::String& source_url) {
- this_ptr->script_execution_context_->reportException(
- error_message, line_number, source_url);
+ bool handled = false;
+ if (this_ptr->worker_ && this_ptr->worker_->onerror())
+ handled = this_ptr->worker_->dispatchScriptErrorEvent(
+ error_message, source_url, line_number);
+ if (!handled)
+ this_ptr->script_execution_context_->reportException(
+ error_message, line_number, source_url);
}
void WebWorkerClientImpl::PostConsoleMessageToWorkerObjectTask(