Seeing which line can be debugged in firefox - javascript

I have a script with around 30 lines, and I'm trying to to debug it in firefox, but when I get the error it doesn't tell me what line is getting the error? It says 4:370, does it mean at line 370, but I only have 30 lines?
ERROR: Execution of script 'test' failed! sessionStorage.getItem(...) is null userscript.html:4:370

That output means the error occurred on column 370 of line 4 in userscript.html. You can trace the error by clicking the userscript.html:4:370 on the right of the console and it should show you script and the line/command that caused the error.

Related

1 Uncaught SyntaxError: Unexpected end of JSON input

I have a site that randomly throws this JavaScript error. If you refresh the site it almost always occurs and it prevents the site from loading. Instead, you just see a blank white page.
The console states there is an "Uncaught SyntaxError: Unexpected end of JSON input" in require.js on line 8. The line reads:
html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
Is there something wrong with this line that I'm not seeing?
The site
Chrome console output
Firefox console output
define("lib/config", [], function() {
"use strict";
var e = document.getElementById("app-config");
return e ? JSON.parse(e.innerHTML) : {}
})
That's the problematic section of code. the app-config element isn't always loaded before this part is being executed. If possible, hard code your app-config into your html

node js script crashes: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

My script crashes and debugger is unable to catch the error. I even tried to try catch some functions but it didnt work.
Any suggestion how to narrow down where the problem could be?
The script is a testing script for a game. It works good for previous games, but for new game there are some new cases. Unfortunately I cannot know where is the error. Probably when unique case object is received from server.
The script is testing against the server and writing output to either console or file. In both cases error happens.
Error: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
edit:
here is SegfaultHandler output:
PID 2645 received SIGSEGV for address: 0x0
0 segfault-handler.node 0x00000001034ae1c8 _ZL16segfault_handleriP9__siginfoPv + 280
1 libsystem_platform.dylib 0x00007fff9364b52a _sigtramp + 26
2 ??? 0x0000000000000010 0x0 + 16
3 node 0x000000010067bbdc _ZN2v88internal23Runtime_GetFrameDetailsEiPPNS0_6ObjectEPNS0_7IsolateE + 2364
4 ??? 0x00000a107710961b 0x0 + 11065833330203
5 ??? 0x00000a107795c134 0x0 + 11065842057524
The exit code (139) means a segmentation fault occurred (128 + 11 (for segfault)).
You can use the segfault-handler module to debug the segmentation fault. You can use it like so:
var SegfaultHandler = require('segfault-handler');
SegfaultHandler.registerHandler("crash.log"); // With no argument, SegfaultHandler will generate a generic log file name
// Write the cause that causes the segmentation fault here
You should see a stack trace that you can now debug using tools like objdump -dS module.node.
objdump displays information about one or more object files.

console.log shows nothing in FF add-on builder

I have following problem: No log pessage shows me in every console (builder's console absolutely useless - nothing happened at all when I click, built-in FF console shows every info about installing, uninstalling etc, Firebug shows nothing).
I used console.log(), console.error() without success.
On about:config page is every logLevel's set to 'all' and devtools.errorconsole.enabled is also true.
Please help me, I'm desperate :-(
Thank you.
Kamil
PS: log window is bellow. There are 3 css errors (by default 'cause I don't include any css file - it's something about expected declarations and skipped to next declaration). Program code is simple console.log('test') or console.error('test') inside or outside exports.main = function().
17:34:52.086 GET https://builder.addons.mozilla.org/get_latest_revision_number/1127553/ [HTTP/1.1 200 OK 207ms]
17:34:52.086 GET https://builder.addons.mozilla.org/package/check_latest_dependencies/1835317/ [HTTP/1.1 200 OK 215ms]
17:34:52.088 POST https://builder.addons.mozilla.org/xpi/prepare_test/1835317/ [HTTP/1.1 200 OK 805ms]
17:34:52.862 "XPI delayed ... try to load every 2 seconds" ide-min.js:1
17:34:53.919 GET https://builder.addons.mozilla.org/xpi/test/2dnzeahpy6adc/ [HTTP/1.1 200 OK 1494ms]
17:34:53.865 "installing from /xpi/test/2dnzeahpy6adc/" ide-min.js:1
17:34:54.863 "request is running" ide-min.js:1
17:34:56.308 Očakávaná deklarácia, ale bolo nájdené '['. Preskočené na ďalšiu deklaráciu. latest
17:34:56.309 "Add-on installed" ide-min.js:1
17:34:56.326 Chyba pri spracovaní hodnoty pre 'opacity'. Deklarácia vynechaná. latest
17:35:00.337 Chyba pri spracovaní hodnoty pre 'top'. Deklarácia vynechaná.
You have to change the logging level, which by default is error, either globally or for specific extensions.
See the related documentation.

Pb to detect random JS error, window.onerror doesn't show line number in a UIWebView (phonegap) - undefined

I have some user complaining about a bug I can't reproduce. I want to send the error to my server each time they get a JS error. So I use the gobal onerror event, but unfortunately, the line number is not specified in phonegap (it's working correctly in safari) :
window.onerror=function(msg, url, line){
alert('An error has occurred: '+msg+'line: '+line);//the line number and url are "undefined"
return true;
}
How do you do to handle JS Runtime errors ?

Cuffon is undefined. Javascript error on IE7 and IE8

I am getting this error 'Cufon' is undefined on my blog http://microreviews.org The error comes on Line 20, char1.
I also get the error 'dtsv' is undefined on Line 57 and character 3.
The errors comes only on IE7 and IE6 and no other browser. I donot really care for IE6 but the error on IE 7 is a major source of concern. What can be done to get rid of these errors?
The problem is happening in other browsers too -- check your error console.
For "Cufon is undefined", it's line 20 - that line is:
"Cufon.replace('h1, h2, h3, h4 ,h5', { fontfamily: 'Museo Sans 500' });
So .. whatever "Cufon" is supposed to be - it's not defined.
I notice that there's a link just prior to this:
http://microreviews.org/wp-content/themes/kreativ/js/cufon-yui.js
Which is resolving to a 404 error (not found) -- so that's probably your problem.
The "dtsv is undefined" problem is the same thing. Line 57:
dtsv.root = 'http://microreviews.org/wp....'
At that point, dtsv hasn't been initialized, so you can't set a property on it.
cause your Cufon file is not found, check the url to your file. And what is dstv ???

Categories