IntlInternalsHiddenFromExceptionStackTest.js 915 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. // Tests that internal stack frames from Intl are hidden from the debugger when an exception is thrown.
  6. if (this.WScript) { WScript.LoadScriptFile("../UnitTestFramework/TrimStackTracePath.js"); }
  7. function testCallback() {
  8. var array =
  9. [
  10. {
  11. toString: function ()
  12. {
  13. throw new Error('Throwing...');
  14. }
  15. },
  16. 5
  17. ]
  18. var c = new Intl.Collator();
  19. array.sort(c.compare);
  20. }
  21. try {
  22. testCallback();
  23. }
  24. catch (ex) {
  25. WScript.Echo(TrimStackTracePath(ex.stack));
  26. }