JsDiagGetStackProperties.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. /**exception(all):locals();**/
  6. // Tests getting "exception" from JsDiagGetStackProperties
  7. try {
  8. throw 1;
  9. } catch (ex) {}
  10. try {
  11. throw new Error('Caught Error');
  12. } catch (ex) {}
  13. // Tests getting "arguments", "locals", "scopes" and "globals" from JsDiagGetStackProperties
  14. var globalVar = {
  15. prop : 1
  16. };
  17. function FuncLevel1() {
  18. var level1Var = {
  19. prop : 1
  20. };
  21. function FuncLevel2() {
  22. var level2Var = {
  23. prop : 1
  24. };
  25. function FuncLevel3() {
  26. var localVar1 = level1Var;
  27. var localVar2 = level2Var; /**bp:locals(1);**/
  28. }
  29. FuncLevel3();
  30. }
  31. FuncLevel2();
  32. }
  33. FuncLevel1(1);
  34. // Tests getting "returnValue" and "functionCallsReturn" from JsDiagGetStackProperties
  35. function outerFunc1() {
  36. function innerFunc1() {
  37. return 1;
  38. }
  39. function innerFunc2() {
  40. return "2";
  41. }
  42. function innerFunc3() {
  43. return new Object(3);
  44. }
  45. return innerFunc1() + innerFunc2() + innerFunc3(); /**bp:resume('step_over');locals(1);**/
  46. }
  47. outerFunc1();
  48. WScript.Echo("pass");