bug602.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 write(v) { WScript.Echo(v + ""); }
  6. function fooBaz()
  7. {
  8. this.toString = function (){throw (new Error("some error"));}
  9. }
  10. function test1() {
  11. try
  12. {
  13. tempObj = new fooBaz();
  14. expString = "hi";
  15. resultString = expString + tempObj;
  16. write(resultString);
  17. }
  18. catch(e)
  19. {
  20. write(e);
  21. }
  22. write("Test1 Done");
  23. }
  24. function test2() {
  25. try
  26. {
  27. tempObj = new fooBaz();
  28. expString = "hi";
  29. resultString = tempObj + expString;
  30. write(resultString);
  31. }
  32. catch(e)
  33. {
  34. write(e);
  35. }
  36. write("Test2 Done");
  37. }
  38. test1();
  39. test2();