Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

long-stack-trace throws error in InternetExplorer #698

Closed
Eddman opened this issue Mar 24, 2017 · 16 comments · Fixed by #704
Closed

long-stack-trace throws error in InternetExplorer #698

Eddman opened this issue Mar 24, 2017 · 16 comments · Fixed by #704

Comments

@Eddman
Copy link

Eddman commented Mar 24, 2017

Error.stack is sometimes undefined in IE. Therefor Zone fails to call trim method on it:

var longTrace = [stack.trim()];

@JiaLiPassion
Copy link
Collaborator

@Eddman , do you have a reproduce repo? thank you.

@Eddman
Copy link
Author

Eddman commented Mar 24, 2017

Well not exactly easy to reproduce. I have 260+ Karma tests and it fails after few minutes. The exception seems to break the whole Karma run. So I'm even not able to detect what test it is.

When I remove node_modules/zone.js/dist/long-stack-trace-zone.js from Karma config the tests run without issues....

The application itself seems to work correctly. The only problem is the one test.

@JiaLiPassion
Copy link
Collaborator

@Eddman , could you help to debug the error.originalStack property when the error occurs?

@Eddman
Copy link
Author

Eddman commented Mar 24, 2017

Just put there console.error(error.originalStack); and the result is:
ERROR: undefined

@Eddman
Copy link
Author

Eddman commented Mar 24, 2017

One more: The error that is causing it is:
TypeError{description: 'Unable to get property 'draw' of undefined or null reference', number: -2146823281}

@JiaLiPassion
Copy link
Collaborator

JiaLiPassion commented Mar 25, 2017

@Eddman, Thank you for the information, if you can provide the error test case code snippet will help, and you are using IE11? And can you post your polyfill file (core-js)?

@Eddman
Copy link
Author

Eddman commented Mar 27, 2017

You can use the commit linked above. I'm not able to make a smaller scenario. It only fails when all tests are executed.

I'm using IE 11 + Win 7. Please run npm install + grunt testIE. You need to install grunt and typescript globally. You also need to uncomment the long-stack-trace-zone.js in karma.conf.js.

Chrome and FF are running fine.

As polyfill I use node_modules/core-js/client/shim.js from [email protected].

@JiaLiPassion
Copy link
Collaborator

@Eddman , thank you, I will test it.

@JiaLiPassion
Copy link
Collaborator

@Eddman , I tried your repo, but I don't know how to reproduce.

  • I confirmed the long-stack-trace is in the karma.conf.js (I didn't uncomment ,because in your repo, the line is not commented)
  • I run grunt testIE

this is the result.

2017-03-29 16 20 25

@vicb
Copy link
Contributor

vicb commented Mar 29, 2017

We see the same issue in Angular tests (IE9): https://travis-ci.org/angular/angular/jobs/216434920#L565

@mhevery
Copy link
Contributor

mhevery commented Mar 29, 2017

@JiaLiPassion Could you have a look?

@JiaLiPassion
Copy link
Collaborator

@mhevery, sure, I will check it.

@Eddman
Copy link
Author

Eddman commented Mar 30, 2017

@JiaLiPassion
Copy link
Collaborator

JiaLiPassion commented Mar 30, 2017

@Eddman, thank you, I can reproduce now, I will debug it.

@JiaLiPassion
Copy link
Collaborator

@Eddman, I have found the reason, this is a trick one, the reason is because Error.stackTraceLimit is set to 0 in karma-test-shim, I will make a PR to fix it, thank you for your great help.

JiaLiPassion added a commit to JiaLiPassion/zone.js that referenced this issue Mar 30, 2017
…rror.stackTraceLimit = 0, add null check
JiaLiPassion added a commit to JiaLiPassion/zone.js that referenced this issue Mar 30, 2017
…rror.stackTraceLimit = 0, add null check
JiaLiPassion added a commit to JiaLiPassion/zone.js that referenced this issue Mar 30, 2017
…rror.stackTraceLimit = 0, add null check
JiaLiPassion added a commit to JiaLiPassion/zone.js that referenced this issue Mar 30, 2017
…rror.stackTraceLimit = 0, add null check
@JiaLiPassion
Copy link
Collaborator

@vicb, the issue has been fixed in PR #704, in IE9 ,the error.stack is undefined, so with the PR, it will be ok

mhevery pushed a commit that referenced this issue Apr 10, 2017
…in IE11 (#704)

* fix(error): remove throw in Error constructor to improve performance in IE

* fix(error): fix #698, don not generate long stack trace when Error.stackTraceLimit = 0, add null check
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants