DeleteAndReAddNonExtensible.js 751 B

1234567891011121314151617181920
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft Corporation and contributors. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. var kNumProperties = 32;
  6. var o = {};
  7. for (var i = 0; i < kNumProperties; ++i)
  8. o['a' + i] = i;
  9. Object.preventExtensions(o); // IsNotExtensibleSupported && !this->VerifyIsExtensible
  10. for (var i = 0; i < kNumProperties; ++i)
  11. delete o['a' + i];
  12. for (var i = 0; i < 0x21; ++i)
  13. o['a0'] = 1; // calling TryUndeleteProperty again again
  14. WScript.Echo('pass');