Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: LayoutTests/fast/events/before-unload-return-bad-value.html

Issue 23600034: Use TRYCATCH_FOR_V8STRINGRESOURCE in AbstractEventListener::invokeEventHandler() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use a frame in the test Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/events/before-unload-return-bad-value-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/events/before-unload-return-bad-value.html
diff --git a/LayoutTests/fast/events/before-unload-return-bad-value.html b/LayoutTests/fast/events/before-unload-return-bad-value.html
new file mode 100644
index 0000000000000000000000000000000000000000..dff4ea86cfb266aaf06bc6f5601ac38299352372
--- /dev/null
+++ b/LayoutTests/fast/events/before-unload-return-bad-value.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../js/resources/js-test-pre.js"></script>
+<script>
+description("Tests that an exception is thrown when the value returned in the beforeunload callback cannot be converted to a String");
+window.jsTestIsAsync = true;
+
+function test(frame) {
+ frame.contentWindow.onbeforeunload = function(event) {
+ return {toString: function() { throw "Exception in toString()"; }};
+ };
+
+ frame.contentWindow.location.href = "resources/does-not-exist.html";
+ setTimeout(finishJSTest, 0);
do-not-use 2013/09/11 15:13:33 I updated the test to use an iframe. This way, we
+}
+
+var testMessage;
+window.onerror = function(msg) {
+ testMessage = msg;
+ testPassed("Exception was thrown");
+ shouldBeEqualToString("testMessage", "Uncaught Exception in toString()");
+ setTimeout(finishJSTest, 0);
+ return true;
+};
+</script>
+</head>
+<body>
+<iframe onload="test(this)" src="resources/onclick.html"></iframe>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/events/before-unload-return-bad-value-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698