bug11026788.js 1002 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. async function foo( ) {
  6. var p1 = new Promise(
  7. timeout1 => {
  8. setTimeout( () => {
  9. timeout1( 1 );
  10. }, 500 );
  11. }
  12. );
  13. var p2 = new Promise(
  14. timeout2 => {
  15. setTimeout( () => {
  16. timeout2( 2 );
  17. }, 500 );
  18. }
  19. );
  20. return await p1 + await p2;
  21. }
  22. promise = foo();
  23. promise.__proto__.then = (0x41414141 - 8) >> 0;
  24. try {
  25. promise.then( function( value ){} );
  26. WScript.Echo("FAILED");
  27. } catch (e) {
  28. if (e instanceof TypeError) {
  29. WScript.Echo("PASSED");
  30. } else {
  31. WScript.Echo("FAILED");
  32. }
  33. }