loadscript_after_detach.js 671 B

1234567891011121314151617
  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 count = 0;
  6. function foo() {
  7. count++;
  8. if (count == 3) {
  9. WScript.LoadScript("", "samethread"); // ScriptContext should be created in sourcerundown mode instead of debugging mode
  10. }
  11. }
  12. foo();
  13. WScript.Attach(foo);
  14. WScript.Detach(foo);
  15. WScript.Attach(foo);
  16. WScript.Echo("pass");