We're calling on all EU-based Mozillians with iOS or iPadOS devices to help us monitor Apple’s new browser choice screens. Join the effort to hold Big Tech to account!

Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Tìm hiểu thêm

Is it possible to put a hard limit on how much CPU is used by JavaScript execution?

  • 3 trả lời
  • 7 gặp vấn đề này
  • 3 lượt xem
  • Trả lời mới nhất được viết bởi castrwilliam

more options

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.

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.

Tất cả các câu trả lời (3)

more options

Hi castrwilliam, I do not know in the user interface, but all of the ways that these are controlled can be played with

  1. In the Location bar, type about:config and press Enter. The about:config "This might void your warranty!" warning page may appear.
  2. Click I'll be careful, I promise!, to continue to the about:config page.
  3. Search for javascript
more options

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.
more options

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.

Được chỉnh sửa bởi castrwilliam vào