popArrayImplicitCall.js 924 B

1234567891011121314151617181920212223242526272829303132333435
  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. var obj = {};
  6. Object.prototype.push = Array.prototype.push;
  7. Object.prototype.pop = Array.prototype.pop;
  8. var x;
  9. Object.defineProperty(obj, "length", {get: function() {x = true; return 5;}});
  10. x = false;
  11. WScript.SetTimeout(testFunction, 50);
  12. /////////////////
  13. function testFunction()
  14. {
  15. try
  16. {
  17. var len = obj.pop();
  18. }
  19. catch (e)
  20. {
  21. telemetryLog('caught exception calling pop', true);
  22. }
  23. telemetryLog(`${x}`, true);
  24. telemetryLog(`${len}`, true);
  25. emitTTDLog(ttdLogURI);
  26. }