try6.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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 foo(i)
  6. {
  7. try
  8. {
  9. WScript.Echo("\t\tInner foo " + i);
  10. throw "thrown";
  11. }
  12. finally
  13. {
  14. WScript.Echo("\t\tFinally foo " + i);
  15. if (i == 0)
  16. return;
  17. else if (i == 1)
  18. throw 7;
  19. }
  20. }
  21. function bar(i)
  22. {
  23. try
  24. {
  25. WScript.Echo("\tInner bar " + i);
  26. foo(i);
  27. }
  28. finally
  29. {
  30. WScript.Echo("\tFinally bar " + i);
  31. }
  32. }
  33. function foobaz(i)
  34. {
  35. try
  36. {
  37. WScript.Echo("Inner foobaz " + i);
  38. bar(i);
  39. }
  40. catch(e)
  41. {
  42. WScript.Echo("Except foobaz " + i + " " + e);
  43. }
  44. }
  45. foobaz(0);
  46. foobaz(1);
  47. foobaz(2);
  48. function testThrowInlining() {
  49. var y = function () {};
  50. Object.prototype["qfxhma"] = function qfxhma() {
  51. throw false;
  52. };
  53. function shapeyConstructor(waquaz) {
  54. qfxhma('');
  55. Object.defineProperty(this, "x", ({
  56. set :
  57. (function () {
  58. var jqanki = y;
  59. })()
  60. }));
  61. }
  62. for (var a in[]) {
  63. try {
  64. shapeyConstructor(a);
  65. } catch (e) {
  66. }
  67. }
  68. qfxhma = y;
  69. };
  70. testThrowInlining();
  71. testThrowInlining();
  72. //Blue Bug 216103
  73. function bar216103(a)
  74. {
  75. var b=this.foo216103(a);
  76. return b;
  77. }
  78. function foo216103(a)
  79. {
  80. switch(a)
  81. {
  82. case "en":
  83. return "english (passed)";
  84. break;
  85. case "de":
  86. return "german (passed)";
  87. break;
  88. default:
  89. throw "blah (passed)";
  90. break;
  91. }
  92. }
  93. try
  94. {
  95. WScript.Echo(bar216103("en"));
  96. }
  97. catch(err)
  98. {
  99. WScript.Echo(err);
  100. }
  101. function test() {
  102. var print = function () {
  103. };
  104. print(function a_indexing(fsznpi, kfoevo) {
  105. if (fsznpi.length == kfoevo) {
  106. return [eval("''++")];
  107. }
  108. var iewhao = a_indexing(fsznpi, kfoevo + 1);
  109. return 4;
  110. }([1], 0));
  111. }
  112. try{
  113. test();
  114. }
  115. catch(err){
  116. WScript.Echo(err)
  117. };