Recently when I try to open the inspect page from Vscode for the output for the JavaScript code the console page starts to freeze and it begins using up too much memory like up to 4gb. It even takes time to close the tab cause my laptop begins to freeze and it becomes really hot after that I don't know why.
I thought it was some problem with the browser so i changed to to Microsoft edge and I get the same problem and I even tried to reinstall both Vscode and chrome but I get the same problem.
Sometimes this error occurs if our code make repetitive call and call stack goes in deadlock condition. Just try running new simple application you can find that error will not occur.
Try to find out which piece of code making that call again and again
In chrome developer tool you can see call stack also for better understanding.
Related
I'm working on Chrome extension which needs to perform an action just before Chrome closes. Is there any method like chrome.window.onClose.addListener(...), or chrome.runtime.onClose.addListener(...) to ensure that something will be done and then chrome will close itself?
I've been struggling with this problem for two weeks. Here are the options for potential solutions that I've found, but they didn't work.
My investigation results:
Using function: chrome.runtime.onSuspend.addListener(...) - I don't know why, but it doesn't work at all for me. For example, I've tried to write a callback for this event, which tries to add hardcoded data to the indexed DB, but it doesn't add it. Description of this method even says that the callback is not guaranteed to be completed. OnSuspend documentation
Sent to the event page just before it is unloaded. This gives the extension opportunity to do some cleanup. Note that since the page is unloading, any asynchronous operations started while handling this event are not guaranteed to complete.
Chrome working in a background - with this option my extensions seems to work, but... only on Windows older than Windows 10. I've checked few options and on my other computer, which has Windows 7 installed, processes connected to Chrome are closing more slowly, which gives time for my extension to perform necessary tasks. Unfortunately, Windows 10 kills all the processes much faster. I've check option "continue running background apps when google chrome is closed", but it doesn't change anything. I've also enabled flag "#enable-push-api-background-mode", it hasn't helped either.
Keep Chrome running in the background on Win10, Enable flag to keep Chrome processes running
chrome.app.window.current().onClosed - I've found a similar question on Stack Overflow, and one of the answers was the code mentioned above. The problem is when I try to type chrome.app.win... inside console, it doesn't show any suggestions both in background script and content script. Google's documentation doesn't mention any permission that I've to add inside my manifest.json to get access to this functionality.Stack Overflow similar question, Google's documentation about chrome.app
Methods build in web browser - I've thought that method window.onclose might be useful in my case. I've performed the same test as for chrome.runtime.onSuspend, but the result was exactly the same. Documentation
I've stuck and haven't got any idea how to solve my problem. Maybe I missed something important? Hope you will help me.
I'm trying to follow these instructions for debugging android javascript.
I am aware of How can I debug javascript on Android?, but it's not clear to me how (or if) I can hit breakpoints - either using Chrome on the Android device, or the Android browser.
I can see and 'inspect' the device OK:
But breakpoints don't get hit, nor can I see line numbers on the errors in the console:
Between these two problems, I'm not getting much useful information from the debugging experience! I have tried going to 'about:debug' in the android browser, and do see the debug options appear.
I will add that the js I am debugging works fine in the latest Chrome on the same Android device.
First off, it seems like there are a bunch of syntax errors that may be preventing mustache.js from executing at all - see if you can take care of those first.
I'd try setting a breakpoint on the next line down - line #9 - to see if anything in that IIFE is running at all.
Assuming you are using a module bundler (such as Webpack) in development (based on port 8080 in your screenshot), most likely the code you're trying to debug is executed via eval. In which case by the time you can see it in the devtools, it has already run.
You can either use the debugger statement in your code, or running in production mode - where there's a real script file being executed. In both cases, you should attach the remote debugger first, and only then navigate to your page (or refresh it).
I have now tried the same thing again, and this time didn't experience the problem. Unfortunately I can't put my finger on what the problem was exactly, as due to my dev machine dying I am running a new windows 10 installation, and potentially a different version of the Android SDK and ADB. The phone and android browser haven't changed.
Anyway, I can now set and hit breakpoints as I'd expect:
I also get better error descriptions and line numbers:
FWIW, the only problem that needed fixing was changing some 'let' declarations to 'var'.
An issue I've been having with working with JavaScript is simply debugging it in a stand-alone way. I have an extremely basic JavaScript file with just one function and a call to that function. No external dependencies. I want to debug it but it has an infinite loop which crashes the browser and won't even let me access the Chrome Dev Tools... Literally, when I hit F12, the entire thing is locked up and I have to end the process.
I have also tried running it as a "Snippet" from a different tab, which does work, but is not ideal and frankly, the entire Chrome Dev Tools interface feels strange for debugging... Like it is designed for a user not a developer, at least compared to Visual Studio.
Lastly, I tried to use Node.js by typing in "node myfile.js", and node just paused and did nothing, at which point I entered Visual Studio Code and then tried to use the Node.js debugging system from within that, but then it said that I hadn't defined a program attribute... Just trying to debug a simple js file here..
This is a problem. The whole point of debugging is to be able to figure out what's going on. What other options do I have to execute/debug a basic JavaScript file? Thank you.
I would do this, for the lack of better options:
1) Remove the critical portion of your code that is causing the infinite loop. If you're not sure which part that is, remove most of your code.
2) Open the code in Google Chrome as usual.
3) Set a breakpoint in Dev Tools at the beginning of your file or function.
4) Add back the problematic code to your javascript file.
5) Reload the page in Chrome.
The breakpoint will still be there on the same line, and you can move through your code step-by-step with F10.
Use can use debugger keyword to stop execution of javascript and debug your code.
But I strongly recommend you to remove code which is causing infinite loop.
I am the developer for a large enterprise website, after the upgrade to chrome 32 the website stopped working completely. I Get the 'aw snap' about the time we have to render most of the elements on the page.
Its a massive code base so i haven't been able to find what's causing it. Ive been booting chrome in debug mode and watching the logs there.
Wierd behavior:
1)If i disable flash it works, we are using swfobject with a flash library.
2)I sometimes see in the logs when it crashes "Uncaught RangeError: Maximum call stack size exceeded" so i must have a infinite loop, but its not a always thing.
3)If i refresh enough it will boot all the way up, and work for good until i kill tab and start over. But again thats a sometimes cause it may start the crash cycle again after a few refreshes.
4) I sometimes see the error "file_descriptor_set_posix.cc(22)] FileDescriptorSet destroyed with unconsumed descriptors" Which i think relates to a infinite loop in the rendering of the webpage which would relate to the maximum call stack exceeded error.
Does anyone know what has changed in Chrome Version 32 that would be a good starting place to find the bug?
Libraries used: SWFobject, Backbone, underscore, soundmanager.js
I dont know why this fixed it, or what chrome changed that caused the code to break but if anyone is interested in what we did to resolve the error i'll explain.
1) I made all events going out of swfobject and our swf code go directly to the Flash.js class we had to interface with flash. Before it was propagating through a Backbone.dispatcher to the flash class. That caused the aw snap error to go away.
2) We were using a datetime library called Moment.js version 2.2.0. It was the one throwing the maximum call stack error, after updating that to 2.3.0 it stopped. Would love to know what chrome changed to cause a infinite loop.
If anyone has info on what chrome changed between the two versions that caused either error, I would love the answer because its a bit scary fixing the symptoms but not knowing the cause.
chrome will open multi tasks in the task manager, and it is sensitive to many plugins
try the following
1- go to settings in chrome
2- open extentions
3- disable all the extensions that you can
4- close chrome
5- open task manager in windows
6- go to processes
7- close all the processes related to chrome
8- reopen chrome and check your problem again
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