| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- //-------------------------------------------------------------------------------------------------------
- // Copyright (C) Microsoft. All rights reserved.
- // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
- //-------------------------------------------------------------------------------------------------------
- //
- //NOTE: this may break if enumeration order policy is changed in Chakra but that doesn't mean we have a bug in TTD
- //
- var a = [11,22,33,44];
- a.x = "a.x";
- a.y = "a.y";
- a.z = "a.z";
- var d = [1];
- var counter = 0;
- WScript.SetTimeout(testFunction, 50);
- /////////////////
- function testFunction()
- {
- telemetryLog("Scenario:1 - Adding new array indexes while enumerating expandos", true);
- for(var i in a)
- {
- if(i == "y")
- {
- a[5] = 55;
- a[6] = 66;
- }
- telemetryLog(`Index:${i} Value:${a[i]}`, true);
- }
- telemetryLog("Scenario:2 - Adding new array expandos while enumerating array for second time", true);
- for(var i in a)
- {
- if(i == "z")
- {
- a[7] = 77;
- a[9] = 99;
- }
- if(i == "7")
- {
- a.xx = "a.xx";
- a.yy = "a.yy";
- }
- telemetryLog(`Index:${i} Value:${a[i]}`, true);
- }
- telemetryLog("Scenario:3 - Adding new array expandos while enumerating Object for second time", true);
- var b = [11,22,33,44];
- b.x = "b.x";
- b.y = "b.y";
- b.z = "b.z";
- for(var i in b)
- {
- if(i == "x")
- {
- b[5] = 55;
- b[7] = 77;
- }
- if(i == "7")
- {
- b.xx = "b.xx";
- b.yy = "b.yy";
- }
- if(i == "xx")
- {
- b[9] = 99;
- b[10] = 1010;
- }
- if(i == "9")
- {
- b.zz = "b.zz";
- }
- telemetryLog(`Index:${i} Value:${b[i]}`, true);
- }
- telemetryLog("Scenario:3 - Adding new array expandos while enumerating Object for second time", true);
- var b = [11,22,33,44];
- b.x = "b.x";
- b.y = "b.y";
- b.z = "b.z";
- for(var i in b)
- {
- if(i == "x")
- {
- b[5] = 55;
- b[7] = 77;
- }
- if(i == "7")
- {
- b.xx = "b.xx";
- b.yy = "b.yy";
- }
- if(i == "xx")
- {
- b[9] = 99;
- b[10] = 1010;
- }
- if(i == "9")
- {
- b.zz = "b.zz";
- }
- telemetryLog(`Index:${i} Value:${b[i]}`, true);
- }
- telemetryLog("Scenario:4 - random additions", true);
- for(var i in d)
- {
- if(counter == 25)
- {
- break;
- }
- if(counter%2 == 1)
- {
- d[counter*counter] = counter*counter;
- }
- else
- {
- d["x"+counter] = "d.x"+counter;
- }
- telemetryLog(`Index:${i} Value:${d[i]}`, true);
- counter++;
- }
- emitTTDLog(ttdLogURI);
- }
|