24.properties.js 720 B

123456789101112131415
  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 scenario = "add property after it was deleted for non-extensible object";
  6. var a = {x:0, get y() { return 0;}}; // Force to use DictionaryTypeHandler before the property is deleted.
  7. delete a.x;
  8. Object.preventExtensions(a);
  9. try {
  10. a.x = 1;
  11. WScript.Echo("Return:", scenario);
  12. } catch (ex) {
  13. WScript.Echo("Exception:", scenario);
  14. }