so.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. function echo(str)
  6. {
  7. if(typeof(WScript) == "undefined")
  8. {
  9. print(str);
  10. }
  11. else
  12. {
  13. WScript.Echo(str);
  14. }
  15. }
  16. function f() { f(); }
  17. var finally_ = 0;
  18. try {
  19. try {
  20. try {
  21. f(); /* first SO */
  22. } finally {
  23. finally_++;
  24. try {
  25. f(); /* nested SO. This finally block is ignored. */
  26. } finally {
  27. finally_++;
  28. }
  29. }
  30. } catch (ex) {
  31. /* we should be able to raise 2 more SOs from here */
  32. try {
  33. f(); /* first SO */
  34. } finally {
  35. finally_++;
  36. try {
  37. f(); /* second SO. This finally block is ignored. */
  38. } finally {
  39. finally_++;
  40. }
  41. }
  42. }
  43. } catch (ex) {
  44. echo(finally_ == 4 ? "PASS" : "FAIL");
  45. }