push3.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 test0() {
  6. var GiantPrintArray = [];
  7. var obj1 = {};
  8. function v9870() {
  9. try {
  10. var arr = [];
  11. var v9872 = [];
  12. Object.defineProperty(Array.prototype, "0", { configurable: true, get: function () { return 30; } });
  13. GiantPrintArray.push(v9872.indexOf(30));
  14. }
  15. catch(ex) {
  16. WScript.Echo(ex.message);
  17. }
  18. }
  19. v9870();
  20. WScript.Echo(GiantPrintArray[0]);
  21. };
  22. test0();
  23. test0();
  24. function test1() {
  25. try {
  26. var arr = [];
  27. Object.preventExtensions(arr);
  28. arr.push(0);
  29. }
  30. catch(ex) {
  31. WScript.Echo(ex.message);
  32. }
  33. }
  34. test1();
  35. test1();
  36. Object.defineProperty(Object.prototype,"a",{get:function(){return 8 }});
  37. function test2() {
  38. var GiantPrintArray = [];
  39. var obj1 = {};
  40. var func1 = function(){
  41. try {
  42. GiantPrintArray.push(obj1.a);
  43. }
  44. catch(ex) {
  45. WScript.Echo(ex.message);
  46. }
  47. }
  48. func1();
  49. function v31079()
  50. {
  51. Object.defineProperty(Array.prototype, "4", {configurable : true, get: function(){return 15;}});
  52. try {
  53. GiantPrintArray.push(1);
  54. GiantPrintArray.push(1);
  55. }
  56. catch(ex) {
  57. WScript.Echo(ex.message);
  58. }
  59. }
  60. v31079();
  61. v31079();
  62. for(var i =0;i<GiantPrintArray.length;i++){
  63. WScript.Echo(GiantPrintArray[i]);
  64. };
  65. }
  66. test2();
  67. test2();