callee_escape.js 671 B

12345678910111213141516171819202122232425262728
  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. var glo;
  6. function test(param)
  7. {
  8. function nested()
  9. {
  10. escape();
  11. return param;
  12. }
  13. function escape()
  14. {
  15. if (!glo)
  16. glo = arguments.callee.caller;
  17. }
  18. nested();
  19. }
  20. test("test1");
  21. WScript.Echo(glo());
  22. glo = undefined;