Is it possible to put a hard limit on how much CPU is used by JavaScript execution?
Even today, there are tons of Web pages with JavaScripts on them that seem to peg the CPU usage. Usually, the browser will completely freeze for a while (15 seconds, and it won't respond to clicks whatsoever - the only thing possible during that time is to terminate or kill it). It will always recover from said hang. About 30-40% of the time, there will be a dialog that offers to stop execution of the script.
It has a checkbox that says "don't ask me again", which I checked... but it seems that Firefox takes that as "don't terminate scripts ever", not "whenever this dialog box is about to be displayed, take this marked check as my implicit approval to halt the script without asking."
I'm not completely sure if it's something to do with the engine itself, the pages, or something else, but I'm wondering if such an option exists.
所有回覆 (3)
Hi castrwilliam, I do not know in the user interface, but all of the ways that these are controlled can be played with
- In the Location bar, type about:config and press Enter. The about:config "This might void your warranty!" warning page may appear.
- Click I'll be careful, I promise!, to continue to the about:config page.
- Search for javascript
Start Firefox in Safe Mode to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
- Do NOT click the Reset button on the Safe Mode start window.
I already looked in about:config. Nothing there seems to be of useful here. All that the options there mention is memory management. There's a "javascript.options.mem_notify", which sounded vague enough to maybe also control that, but apparently it's there to help developers optimize add-ons: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Internals/GC/Statistics_API
I just relaunched in safe mode this morning and nothing seems to be acting up yet. The problem was intermittent so I'm not going to say that fixed it completely, but it's a definite improvement.
由 castrwilliam 於