Skip to content

Conversation

@hlascelles
Copy link
Contributor

I'm seeing an exception when trying to create a stacktrace for tracing purposes.

The actual window level error is reported as this:

Uncaught TypeError: Cannot read property '1' of null
URL: http://localhost:4000/javascripts/stacktrace.js
Line: 349

So the call "m[1]" is failing in stacktrace.js

Here is the output for the "ref" object at that time

Array[2]
0: "{anonymous}()@eval at buildTmplFn (http://localhost:4000/javascripts/jquery/jquery.tmpl.js:317:10)"
1: "eval at buildTmplFn (http://localhost:4000/javascripts/jquery/jquery.tmpl.js:317:10)"
index: 0
input: "{anonymous}()@eval at buildTmplFn (http://localhost:4000/javascripts/jquery/jquery.tmpl.js:317:10)"
length: 2
__proto__: Array[0]

The jquery file used is this one, http://cloud.github.com/downloads/SteveSanderson/knockout/jquery.tmpl.js

It's quite a dense function to look into, but suffice to say stacktrace.js fails to evaluate "m" at line 349 of stacktrace.js as anything other than null. This causes the stacktrace construction to blow out.

This simple pull request change evades the issue. It happens rarely (but reliably) under certain uses of jquery templating.

Not the best pull request summary I've ever done, sorry, but I assure you the problem and solution are genuine.

Let me know if there is any more logging you need.

H

…Fn (http://localhost:4000/javascripts/jquery/jquery.tmpl.js:317:10)"
@hlascelles
Copy link
Contributor Author

16.0.912.77 (Developer Build 118311 Linux) Ubuntu 11.10

@victor-homyakov
Copy link
Contributor

We need some unit tests. Do you can show contents of the stack object at the same time as the ref object?

@eriwen
Copy link
Member

eriwen commented Feb 20, 2012

@hlascelles Victor is right, adding a unit test for this would be appropriate.

However, this is a good case of writing JS defensively and I'm sure it's not going to break any tests, so I'm going to trust you on this one and see if I can write a test myself that exercises the case you described. Thanks for the good bug report :)

eriwen added a commit that referenced this pull request Feb 20, 2012
Fixing crash caused by unknown Chrome Error#stack
@eriwen eriwen merged commit 2b9f718 into stacktracejs:master Feb 20, 2012
eriwen added a commit that referenced this pull request Feb 20, 2012
victor-homyakov pushed a commit that referenced this pull request Feb 21, 2012
@hlascelles
Copy link
Contributor Author

Thanks very much! I was halfway through isolating it when I was drawn away to other things. I'll continue to track it down as I modularise our code and let you know as soon as I find the root cause... H

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants