Comments (8)
Ahh...
I now know that I need to run this in http method, so the stack trace seems a little changed, but still not accurate.
I run the second case in http method, and got:
In IE:
{anonymous}(null)
printStackTrace()
{anonymous}("Object expected","http://localhost/javascriptStackTrace/testcase1.html",17)
bar(1)
bar(1)
bar(1)
bar(1)
bar(1)
bar(1)
bar(1)
In FF:
(?)()@http://localhost/javascriptStackTrace/stacktrace.js:74
run(null)@http://localhost/javascriptStackTrace/stacktrace.js:72
printStackTrace()@http://localhost/javascriptStackTrace/stacktrace.js:58
onerror("abc is not defined","http://localhost/javascriptStackTrace/testcase1.html",17)@http://localhost/javascriptStackTrace/testcase1.html:8
Both of the results are not expected, is there any missing in using your library?
Thanks!
from stacktrace.js.
Joe: I'm looking at this.
Note that there is a bug in the IE implementation when we lose the stack if you use recursion. This is because a construct that I need is overwritten and I cannot get it back.
Regardless, this is not your fault. Your Firefox results for the test are definitely wrong using window.onerror. Stay tuned!
from stacktrace.js.
Hi, I implemented this script, used in IE9 and I found some error (maybe I did something wrong). This is the ex:
<script> var errorHandler = function(msg, file, line) { alert('error'); var trace = printStackTrace(); console.log(trace.join('\n\n')); }; window.onerror = errorHandler; function clicked() { var inputData = document.getElementById('daisa').value; alert(inputData2); } </script>So, when the clicked function is called (by an anchor or w/e), the error occurs, the window.error is triggered and the handler is called.
So, printStrackTrace is called and the magic of the script happens, but there is an issue, some how in this part:
while (curr && stack.length < maxStackSize) {
fn = fnRE.test(curr.toString()) ? RegExp.$1 || ANON : ANON;
args = Array.prototype.slice.call(curr['arguments']);
stack[j++] = fn + '(' + this.stringifyArguments(args) + ')';
curr = curr.caller;
}
the curr['arguments'] is null so the Array.prototype.slice.call() fails and everything else stop working.
I managed to fix this by updating this the condition: while (curr && curr['arguments'] && stack.length < maxStackSize)
but I am not an expert on JS, so I wouldn't know if this condition it's good enough or not.
I found that the issue only happens in IE9. In IE 6/7/8 everything works fine, but in IE9 the force error of the script is not getting into the stack (unlike other browsers). Any thoughts? Any advice so I can hack the code a little bit to make it work in all browsers again (sadly I need IE9)
Thanks
from stacktrace.js.
@lpena Yep, that would be good way to fix the error you are seeing.
I would recommend that you do not use printStackTrace() within window.onerror until we have implemented a better way to handle it. Follow this issue and #26 for updates.
from stacktrace.js.
subscribe
from stacktrace.js.
Subscribe
from stacktrace.js.
subscribe
from stacktrace.js.
Closing in favor of #96.
from stacktrace.js.
Related Issues (20)
- Arguments not getting populated in trace HOT 1
- Am not able to convert in to non minified response from minified in componentDidCatch
- Still active? HOT 2
- Promise rejection: Cannot parse given Error HOT 2
- Provide a simple API to interact with window.onerror
- Way to convert StackFrames back into a traditional Error stack
- getSync() available but no fromErrorSync() available
- Cert for https://www.stacktracejs.com/ expired HOT 3
- inside of object, get class name
- Extremely high memory usage HOT 5
- define cannot be used indirect stacktrace-gps
- Angular 10 build warning - CommonJS or AMD dependencies HOT 2
- Add defensive code HOT 1
- Missing documentation!
- ESM Support HOT 2
- runtime loading of source maps? HOT 1
- stacktrace-gps opitonal? HOT 1
- How can I see original functions names/files names with Nexj.js HOT 4
- Explanation needed: Why is parsed stack different when using StackTrace.fromError with option offline=true and offline=false?
- Official Website Down
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stacktrace.js.