Provide a way to stop / kill all JavaScript in a page
Categories
(WebExtensions :: General, enhancement)
Tracking
(Not tracked)
People
(Reporter: nicolas.george, Unassigned)
Details
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0
Steps to reproduce:
Some pages have JavaScript that consume CPU but do not contribute usefully to the experience, often because the code is bad, sometimes for other simple reasons, but not to the point that it will be detected as a loop and stopped.
Please provide a way to definitely stop / kill all JavaScript in a page, so that we can save CPU and power while being able to read the page.
Using the debugger to pause it is not satisfactory, because it blocks the page itself.
Disabling JavaScript is not satisfactory, because it will reload the page and JavaScript might have been necessary at load time.
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'DevTools::Debugger' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
| Reporter | ||
Comment 2•3 years ago
|
||
(In reply to Release mgmt bot [:suhaib / :marco/ :calixte] from comment #1)
The Bugbug bot thinks this bug should belong to the 'DevTools::Debugger' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
The Bugbug is wrong, this feature is for normal users, not for developers. And it seems I do not have the permissions to fix the bad classification done by this bot.
Updated•3 years ago
|
Comment 3•3 years ago
|
||
Setting this on the Core > JavaScript: GC so that our developers could take a look at it, if this is not the right component, please move it to a more appropriate one. Thanks!
Comment 4•3 years ago
|
||
As I read it this is a feature request for Firefox.
Comment 5•3 years ago
|
||
Based on Comment 4, setting this to NEW so that the engineering team could decide if they take this enhancement request into consideration or not.
Comment 6•3 years ago
|
||
This kind of problem is usually solved by extensions. The noscript extension does some of what you are looking for, and it might be a good place to start. You could also use the reader view feature.
For discussing this as a browser feature, it might be best to start a thread on https://connect.mozilla.org/.
| Reporter | ||
Comment 7•3 years ago
|
||
(In reply to Sam Foster [:sfoster] (he/him) from comment #6)
This kind of problem is usually solved by extensions. The noscript extension does some of what you are looking for, and it might be a good place to start. You could also use the reader view feature.
No, neither noscript nor reader view are anything like a solution.
-
Reader view completely change the layout of the page.
-
Noscript blocks even initial javascript execution, which might be necessary to get the contents of the page.
In case you did not understand the use cases, consider all those pages filled with javascript: we need to enable javascript to get any useful contents, but once it is displayed we want to kill all those stupid animations, all these click-stealing features (I want ctrl-F to find in the page, not to activate your crappy search form).
Comment 8•3 years ago
|
||
We are not aware of a way of doing something like this on the Firefox side. I think we would need support from spidermonkey - if its even possible at all.
Comment 9•3 years ago
|
||
SpiderMonkey provides an API to interrupt JS execution. It's currently used in the browser as part of the slow script dialog. It works by registering an interrupt callback (see here) and then requesting an interrupt (see here).
It might be worth looking at it to see if it meets your needs.
Comment 10•3 years ago
•
|
||
Lets move this to the addons group to see if this might become a (experimental/non-standard) API we could provide for extension developers. I can imagine an extension that provides a blocklist that allows you to always block js on some sites that you are forced to use for work or whatever, but are slow/abusive/terribly coded. That might be really useful and would provide another set of options.
Description
•