24.properties_sm.js 737 B

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