applyBugs.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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. if (this.WScript && this.WScript.LoadScriptFile) { // Check for running in ch
  6. this.WScript.LoadScriptFile("..\\UnitTestFramework\\UnitTestFramework.js");
  7. }
  8. // BLUE 535258
  9. var test = function()
  10. {
  11. };
  12. test.prototype.B = function(a,b,c,d){return a+b+c;};
  13. var A = new test();
  14. function F()
  15. {
  16. this.init.apply(this,arguments);
  17. }
  18. F.prototype.init = function()
  19. {
  20. A.B.call(this, arguments);
  21. }
  22. function bar()
  23. {
  24. return new F(10,30,40,50);
  25. }
  26. bar();
  27. bar();
  28. bar();
  29. // BLUE 537264
  30. function test0(){
  31. var arrObj0 = {};
  32. Object.prototype.method0 = 1;
  33. arrObj0.method0.apply(this, arguments);
  34. };
  35. try
  36. {
  37. test0();
  38. }
  39. catch(e){}
  40. // BLUE 525135
  41. try
  42. {
  43. var FloatArr0 = new __og169.Array(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
  44. var FloatArr1 = __og169();
  45. }
  46. catch(e){}
  47. WScript.Echo("PASSED\n");
  48. // BLUE 608045
  49. function baz() {
  50. this.initialize.apply(this.x, arguments);
  51. }
  52. var object = baz;
  53. object.prototype = {
  54. initialize : function() {
  55. }
  56. }
  57. function foo()
  58. {
  59. new object();
  60. }
  61. foo();
  62. foo();
  63. foo();
  64. WScript.Echo("PASSED\n");
  65. function test1(){
  66. var arrObj0 = {};
  67. arrObj0[0] = 1;
  68. function v16037() {
  69. for(var _strvar0 in arrObj0 ) {
  70. var v16039 = {
  71. v16041: function() {
  72. return function bar() {
  73. this.method0.apply(this, arguments);
  74. }
  75. }
  76. };
  77. var v16042 = arrObj0;
  78. v16042.v16043 = v16039.v16041();
  79. v16042.v16046 = v16039.v16041();
  80. v16042.v16046.prototype = {
  81. method0 : function() {
  82. this.v16052 = new v16042.v16043();
  83. }
  84. };
  85. var v16067 = new v16042.v16046(0,0);
  86. }
  87. }
  88. try {
  89. v16037();
  90. } catch(e) {}
  91. };
  92. test1();
  93. test1();
  94. WScript.Echo("PASSED\n");
  95. // OS 101439
  96. function test2() {
  97. var protoObj0 = {};
  98. var obj1 = {};
  99. var func1 = function () {
  100. var v12673 = {
  101. v12675: function () {
  102. return function bar() {
  103. f /= arguments[(1 >= 0 ? 1 : 0) & 15];
  104. this.method0.apply(protoObj0, arguments);
  105. };
  106. }
  107. };
  108. var v12676 = protoObj1;
  109. v12676.prototype = {};
  110. v12676.v12677 = v12673.v12675();
  111. v12676.v12677.prototype = {
  112. method0: function (v12681) {
  113. }
  114. };
  115. v12676.v12679 = v12673.v12675();
  116. v12676.v12679.prototype = {
  117. method0: function (v12685) {
  118. this.v12684 = new v12676.v12677(v12685);
  119. }
  120. };
  121. var v12690 = new v12676.v12677();
  122. var v12696 = new v12676.v12679();
  123. var v12697 = new v12676.v12679();
  124. };
  125. var f = 1;
  126. protoObj1 = Object.create(obj1);
  127. func1();
  128. }
  129. test2();
  130. test2();
  131. WScript.Echo("PASSED\n");
  132. // OS 265192
  133. var obj1 = {};
  134. var arrObj0 = {};
  135. var func0 = function () {
  136. func0.caller;
  137. };
  138. arrObj0.method0 = function (argArrObj2) {
  139. func0(ary.unshift(func0(), Object()));
  140. };
  141. var ary = Array();
  142. var v0 = {
  143. v1: function () {
  144. return function bar() {
  145. this.method0.apply(obj1, arguments);
  146. };
  147. }
  148. };
  149. arrObj0.method1 = v0.v1();
  150. function v17() {
  151. this.method0 = function () {
  152. var uniqobj3 = arrObj0.method1();
  153. };
  154. }
  155. function v24() {
  156. }
  157. v24.prototype = new v17();
  158. var v25 = new v24();
  159. function v26(v27) {
  160. v27.method0();
  161. }
  162. v26(v25);
  163. v26(v25);
  164. v26(v25);
  165. //OS 821230
  166. function test0() {
  167. var obj1 = {};
  168. var protoObj2 = {};
  169. var func0 = function () {
  170. };
  171. var func1 = function () {
  172. new func0(ui16[4]) ;
  173. };
  174. var func4 = function () {
  175. func1();
  176. };
  177. obj1.method1 = func4;
  178. var ui16 = new Uint16Array();
  179. var func12 = function () {
  180. // bar();
  181. obj1.method1.apply({}, arguments);
  182. };
  183. var v0 = {
  184. v1: function () {
  185. return function bar() {
  186. func12();
  187. this.method0.apply({}, arguments);
  188. };
  189. }
  190. };
  191. Object.prototype.method0 = func0;
  192. protoObj2.v3 = v0.v1();
  193. protoObj2.v5 = v0.v1();
  194. protoObj2.v5.prototype = {
  195. method0: function () {
  196. protoObj2.v3();
  197. }
  198. };
  199. var v34 = new protoObj2.v5();
  200. var v35 = new protoObj2.v5();
  201. var v36 = new protoObj2.v5();
  202. }
  203. test0();
  204. WScript.Echo("PASSED");
  205. function test3(a,b)
  206. {
  207. a = a.foo;
  208. return a.apply(b);
  209. }
  210. function test3Wrapper()
  211. {
  212. var obj1 = {foo: function(){return this.prop1;}};
  213. var obj2 = {prop1: 1};
  214. var result = [];
  215. result.push(test3(obj1, obj2));
  216. result.push(test3(obj1, obj2));
  217. result.push(test3(obj1, obj2));
  218. var expected = [1,1,1];
  219. assert.areEqual(expected, result);
  220. }
  221. test3Wrapper();
  222. WScript.Echo("PASSED");