JavaScript Debugging tools - javascript

I'm working with a project that came from other developer. I have a problem when it comes to some pages with a plugin that uses js/jquery. The problem is that there is an error when I look to chrome dev tools.
ncaught TypeError: $(...).retina is not a function
I am sure that this problem arises because the script didn't continue until it loaded the JQuery function. My question is how can I figure out which script contains the error and where the stop is. There are so many script to check. Is there a easy way? A tools or what so ever.

Related

Strange angular js error

I am facing a strange angular js error. I am building an angular app. I am not very much proficient in angular. However I have successfully created some complex app. Now I am having a error in the browser console.
I can't understand the error a bit. The error shows stackFrame.js. But in my project there is no such js and I have searched web about it and I could not find any thing and the error is very fragile also. Once the error appears all angular activities are not working any more.
I can only attach the screen shot and the 'question_set.js (line 249)' is my code and on that line I have used $scope.$apply().
One more thing I would like to say that I used jquery ajax instead of angular http service. Because In yii2 the angular http does not populate the post data properly. I only can provide the screen shot.
Thanks in advance. If anyone and kindly give any clue. Specially the angular masters.
The error "href is null" seems to be a bug in Firebug according to this SO-post: AngularJS doesn't show specific errors in the Firebug console anymore .
The error is hiding an actual error in your code, but you can't see it because of the bug in Firebug. Try the default developer tools in Firefox or try another browser to find out what your actual error is.

How does one diagnose errors in a controller?

I'm trying to get up to speed with AngularJS, coming from a Java background, not Javascript. I'm used to stepping into a debugger with Eclipse, MSDEV, etc, but not so much used to Google Chrome's dev tools or WebStorm (which I intend to use). Occasionally, I've made a mistake that apparently is detected upon startup. I'm guessing it's logged someplace (I hope!), and then silently continues. Then when I go to the page that would use the controller, I get the
Argument 'MyController' is not a function, got undefined
error. Of course, the attached stack trace isn't very helpful. So the big question is: how do you step into this mess when it actually finds the problem inside the controller, not later when it actually tries to use the controller?
I could post today's issue, but I'd rather have the tools to diagnose this myself than just solve the problem for today.
Install angularJS batarang chrome extension.
Go through github repository of angularJS-batarang
This extension is nice and we can easily debug the angularJS applications
About your error : possible duplicate of AngularJS/Jade Error: Argument 'MyController' is not a function, got undefined (MEAN)

Firebug causes Firefox to be unresponsive

I'm a beginner web developer. I often use Firebug to debug my JavaScript.
Problem is that there are some script files from my page's UI that have a lot of code and this causes my web browser to be unresponsive, i.e. I get a dialog saying the script is unresponsive. Basically this happens when I am within Firebug's Script panel.
How can I deal with this?
I tried finding solution to this problem and nothing.
As for the answer I think the best was posted by #Pablo(can't assign answer to comment unfortunately) and it is simply trying out Google Chrome console. None of the problems I mentioned exists here.
Cheers guys!
I have had the same problem debugging some of our older scripts that make extensive use of the eval() function.
This causes many scripts to be displayed within the Script Location Menu. (Each dynamically generated script is represented there.)
A possible solution, given that it was caused by the number of files in my instance, might be to see if you can bypass the problem entirely by utilizing fewer source files for the same code. Using a 'built' version of whatever frameworks you use might alleviate the problem. (Particularly if they still are debug-able in a built form.)
If that does not work, you might try debugging using Firefox' built-in debugger (available via Ctrl+Shift+S. (Or switch to another browser to do the debugging, but that is obviously a far less desirable solution.)

Problem running a jQuery application?

I'm developing a jQuery mobile application. The application is developed in JavaScript, jQuery, and HTML. When I debug the application in browser using Firebug (in Firefox) it's working fine, but it doesn't run normally? Is there a reason it's running in debug mode only?
Your question is worded somewhat confusingly so I'm not quite sure what you mean but I think you might be running into a problem with console.XXX() statements in your JS - on a browser that doesn't have console defined (like IE) or a Firefox installation that doesn't have Firebug, console will be undefined and your JavaScript code is likely to fail if you have forgotten to comment out your logging statements. You can verify if that is the problem by commenting out all calls to console (or by watching the console and looking for log output).
A long term solution might be to define the console object when your JavaScript initially loads if it finds that the console doesn't exist - this way, even if you forget to comment out calls to console and someone who doesn't have Firebug installed or is using a different browser tries to use your code, they won't run into this issue. Take a look at this blog post

Permission denied to call method Location.toString

I'm using YUI,
and sometimes I'll see this "Permission denied to call method Location.toString" error,
It's reported in connection.js,
I didn't find any clue why this error occur yet.
Very strange
If you are dealing with any Flash through a cross-domain iframe, then it is quite possible that you are seeing a bug in Adobe's Flash Player that occurs with FF2 and FF3.
The bug is in Adobe's public JIRA here: http://bugs.adobe.com/jira/browse/FP-561
There seems to be no motivation to get it fixed, unfortunately.
If the script is executed from a different domain, or you are trying to access the contents of a frame/window/iframe of a different domain, you will see this error. Safari's behavior was a little different, at least in the v1-2 era (iirc), so you will probably want to test in that as well.
If you are including scripts via a different domain, you need to make sure your actual triggers/events are tied in and executed from inline scripts, or from a script file loaded from the same domain as your html for best results.
Hi I've answered a similar question
why/where the error “Permission denied for to call method Location.toString”.
This is caused by firebug showing errors from other windows in your console. In short, these errors will probably be nothing to do with your code at all.
If you want to test this theory, you can close all other windows in firebug, clear your console and test just your site.
Are you seeing this in Firebug, by any chance?
I'm getting the same thing in Firefox, off-and-on, after adding jQuery to my site. I'm calling the jQuery js from another site (different domain completely), which I figure isn't much different than calling it from Google's servers.
I have no code using jQuery at all as of the moment. And, while Firebug reports this as an error, it doesn't do so all the time. While I have it turned on, I'm seeing no errors in IE.
While there are different libraries involved, my guess is that Firebug is generating a false-positive.
Now if you're not using Firebug when you see this ... are you using YUI hosted on your own server? What browser are you using? Etcetera.
~James

Categories