DavidBruant / usefulStackTrace

Firefox addon
http://davidbruant.github.io/usefulStackTrace/
MIT License
5 stars 1 forks source link

Weird exceptions in trackStack itself. #7

Closed programmin1 closed 10 years ago

programmin1 commented 10 years ago

I'm seeing exceptions like this: "uncaughtExceptionHook" [object Error] "copyArguments@resource://gre/modules/XPIProvider.jsm -> jar:file:///home/luke/.mozilla/firefox/jptc8g6g.default/extensions/jid1-5h9We5DytuZ14Q@jetpack.xpi!/bootstrap.js -> resource://gre/modules/commonjs/toolkit/loader.js -> resource://jid0-seoapaqazwftba4av7yeiunqiag-at-jetpack/useful-stack-trace/lib/trackStack.js:91 uncaughtErrorFramePopHandler@resource://gre/modules/XPIProvider.jsm -> jar:file:///home/luke/.mozilla/firefox/jptc8g6g.default/extensions/jid1-5h9We5DytuZ14Q@jetpack.xpi!/bootstrap.js -> resource://gre/modules/commonjs/toolkit/loader.js -> resource://jid0-seoapaqazwftba4av7yeiunqiag-at-jetpack/useful-stack-trace/lib/trackStack.js:170 @(url of the js file debugging)

The [object] points to problem in line 91, that is, " return Array.prototype.map.call(args, function(e){ return e;});" "can't convert null to object"

DavidBruant commented 10 years ago

Yes. I noticed it in #6. I haven't dug enough yet to make a minimum test case; it doesn't show up systematically. Do you have a minimal test case? Or at least circumstances where it reliably happens?

programmin1 commented 10 years ago

Here's an example that triggers a lot of exceptions:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" >    
    <head>
    <script type="text/javascript">
    var FOX_pagedescriptor = window.FOX_pagedescriptor = {breadcrumb:
    "", isMgmt: "false", site: "fn2" };
</script>
<script src="http://global.fncstatic.com/static/v/all/js/ag.jquery.js?201402201318"></script>
        <script src="http://global.fncstatic.com/static/v/fn2/ch/js/ag.us.js?201402201318"></script>         
        <script src="http://global.fncstatic.com/static/v/all/js/article.3.0.js?201402201318"></script>
<script> FOX.site.topInit(); </script></head>
</body>
</html>
DavidBruant commented 10 years ago

It looks like the addon error in the console happens at least when:

(maybe happens in other circumstances, but at least this is established)

Small test case:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">

    <script>
        whatever();
    </script>

    <title> Test UsefulStackTrace 7 </title>
</head>

<body>
</body>
</html>

It's possible that the problem is because the script is top-level. In such a circumstance, what the stack is made of is unclear to me yet. It would explain why frame.arguments is null (or undefined, but at least not the expected type)

Investigating on why and on a fix.