forInObjectDelete.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. //
  6. //NOTE: this may break if enumeration order policy is changed in Chakra but that doesn't mean we have a bug in TTD
  7. //
  8. var x = { a: 2, b: 3 };
  9. var o = { a: 2, b: 3 }
  10. WScript.SetTimeout(testFunction, 50);
  11. /////////////////
  12. function testFunction()
  13. {
  14. telemetryLog("Delete current element", true);
  15. for(var i in x)
  16. {
  17. if(x[i] == 2)
  18. delete x[i];
  19. else
  20. telemetryLog(`${x[i]}`, true);
  21. }
  22. telemetryLog("Delete former element", true);
  23. var n = 0;
  24. for(var i in o)
  25. {
  26. if(n++ == 1)
  27. delete o.a;
  28. telemetryLog(`${i}`, true);
  29. }
  30. emitTTDLog(ttdLogURI);
  31. }