PartInitStackFrame.js 998 B

123456789101112131415161718192021222324252627282930
  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. // -nonative -InjectExceptionAtPartiallyInitializedInterpreterFrame:3 -InjectPartiallyInitializedInterpreterFrameErrorType:1
  6. // We only check interpreter frame which ret addr matches one from frames pushed to scriptContext.
  7. // Thus use same function body (causes same interpreter thunk).
  8. function createFoo()
  9. {
  10. var foo = function(another)
  11. {
  12. if (another) another();
  13. }
  14. return foo;
  15. }
  16. try
  17. {
  18. var foo1 = createFoo();
  19. var foo2 = createFoo();
  20. foo1(foo2);
  21. }
  22. catch (ex)
  23. {
  24. var stackAfterTrimDirectoryName = ex.stack.replace(/\(.*\\/g, "(");
  25. WScript.Echo(stackAfterTrimDirectoryName);
  26. }