HasOnlyWritableDataProperties-cross-context.js 738 B

123456789101112131415161718
  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. function f() {
  6. var obj0 = {};
  7. obj1 = Object.create(obj0);
  8. var sc = WScript.LoadScript('function setUp(obj0, obj1) { obj1.foo0 = 1; Object.setPrototypeOf(obj0, {}); Object.defineProperty(Object.getPrototypeOf(obj0), "foo1", {writable: false, value: "bar"}); }', 'samethread');
  9. sc.setUp(obj0, obj1);
  10. obj1.foo2 = 'bar';
  11. }
  12. f();
  13. WScript.Echo('Pass');