defaultsetterbug.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. let threw = false
  6. try
  7. {
  8. var obj1 = {};
  9. var func0 = function () {
  10. for (var _strvar2 in Object) {
  11. Object.prototype[_strvar2] = {};
  12. }
  13. };
  14. let cnt = 0;
  15. Object.defineProperty(obj1, 'prop0', {
  16. get: function () {
  17. print("BAD!");
  18. },
  19. configurable: true
  20. });
  21. Object.prototype.prop0 = func0();
  22. Object.prototype.prop2 = func0();
  23. Object.prop2 = Object.defineProperty(Object.prototype, 'prop2', {
  24. get: function () {
  25. }});
  26. (function () {
  27. 'use strict';
  28. for (var _strvar0 in Object) {
  29. Object.prototype[_strvar0] = func0();
  30. }
  31. }());
  32. }
  33. catch(e)
  34. {
  35. threw = true;
  36. }
  37. print(threw ? "Pass" : "Fail")