Chromium Code Reviews| 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..dc59262271d7d697c1d35e8596fd4f5d81494e26 |
| --- /dev/null |
| +++ b/LayoutTests/fast/events/before-unload-return-bad-value.html |
| @@ -0,0 +1,37 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<script src="../js/resources/js-test-pre.js"></script> |
| +<script> |
| +if (window.testRunner) |
| + testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(true); |
| + |
| +window.onload = function() { |
| + window.location.href = "resources/does-not-exist.html"; |
| + setTimeout(finishJSTest, 0); |
|
arv (Not doing code reviews)
2013/09/11 13:42:19
Why is this needed? window.onerror calls finishJST
do-not-use
2013/09/11 14:12:29
I had it in case it did not throw, to avoid a time
|
| +} |
|
arv (Not doing code reviews)
2013/09/11 13:42:19
semicolons after assignment.
|
| + |
| +var nonConvertibleToString = {toString: function() { throw "Exception in toString()"; }}; |
| + |
| +var testMessage; |
| +window.onerror = function(msg) { |
| + testMessage = msg; |
| + shouldBeEqualToString("testMessage", "Uncaught Exception in toString()"); |
| + setTimeout(finishJSTest, 0); |
|
do-not-use
2013/09/11 09:00:43
I am not quite sure why this setTimeout() is neede
haraken
2013/09/11 09:08:44
Looks strange. arv, do you have any idea?
arv (Not doing code reviews)
2013/09/11 13:42:19
I'm not sure. Maybe it is related to setShouldStay
|
| + return true; |
| +} |
| + |
| +window.onbeforeunload = function(event) { |
| + return nonConvertibleToString; |
| +} |
| +</script> |
| +</head> |
| +<body> |
| +<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; |
|
arv (Not doing code reviews)
2013/09/11 13:42:19
move this to other script block, before if window.
|
| +</script> |
| +<script src="../js/resources/js-test-post.js"></script> |
| +</body> |
| +</html> |
| + |