vso_os_1091425.js 1.2 KB

1234567891011121314151617181920212223242526272829303132
  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 assertPropertyExists(o, p, v) {
  6. if (!o.hasOwnProperty(p)) {
  7. throw new Error("Object does not have expected property '" + p + "'");
  8. }
  9. if (o[p] !== v) {
  10. throw new Error("Object has property '" + p + "' but its value does not match the expected value");
  11. }
  12. }
  13. function assertPropertyDoesNotExist(o, p) {
  14. if (o.hasOwnProperty(p)) {
  15. throw new Error("Object has unexpected property '" + p + "'");
  16. }
  17. }
  18. WScript.LoadScriptFile("vso_os_1091425_1.js");
  19. WScript.LoadScriptFile("vso_os_1091425_2.js");
  20. try {
  21. eval('function nonConfigurableFoo() { /* try to override non-configurable global accessor property with a function definition */ }');
  22. } catch (e) {
  23. if (e.message === "Cannot redefine non-configurable property 'nonConfigurableFoo'") {
  24. print("Pass");
  25. }
  26. else {
  27. print("Fail");
  28. }
  29. }