bugVSO_OS_1015467.js 968 B

12345678910111213141516171819202122
  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. // VSO OS Bug 1015467
  6. // SimpleTypeHandler::ConvertToTypeHandler incorrectly assumed that all
  7. // property slot values would be proper non-null Var values. This is
  8. // not true for InternalPropertyId values -- they can be anything, Var
  9. // and non-Var. Test this code path by utilizing WeakMap, which adds
  10. // an InternalPropertyId to an object. Then convert the object by
  11. // adding another property.
  12. function f() {
  13. var o = Object.create(Object.prototype);
  14. var w = new WeakMap();
  15. w.set(o, {});
  16. Object.keys(o);
  17. o.aaa = "bbb";
  18. WScript.Echo("Pass");
  19. }
  20. f();