[Firefox] "Warning: Unresponsive add-on script" in large pages
j1elo opened this issue · 2 comments
First of all, thank you very much for this extension! it is awesome and bring a sorely lacking functionality to the browser's find function.
Issue Description
Warning: Unresponsive add-on script
A script from the extension “find+ | Regex Find-in-Page Tool” is running on this page, and making Firefox unresponsive.
It may be busy, or it may have stopped responding permanently. You can stop the script now, or you can continue to see if it will complete.
Script: moz-extension://13e262fc-7492-…fb2643c083f5/content/parser.js:0
The Firefox script execution limits seem to be fairly low, so this extension will trigger the warning dialog as soon as the page is a bit large. This issue renders the extension unusable for these pages, because the dialog will re-appear just 3 to 5 seconds later.
Steps to Reproduce
- Install the extension, find+ | Regex Find-in-Page Tool.
- Open https://ffmpeg.org/ffmpeg-all.html
- Open the extension's search box. Just open, nothing else. No need to start writing a search term or anything.
- After 5 seconds, the warning dialog appears.
Screenshots and Documentation
Firefox version: 85.0
OS: Ubuntu linux
Workaround
Giving more time to the extension will work around the issue, although ideally it shouldn't be needed:
- Open
about:config
. - Search for
dom.max_ext_content_script_run_time
. - Set a higher value, or set
0
to grant unlimited time (be careful, as this applies to all extension scripts).
Comments
Are there maybe any low hanging fruits to improve the performance of the internal regex engine? As right now it seems to be quite slow given that the test page is purely static text and the amount of text is not really that much.
@j1elo @sakyb7 Thanks for your interest in Find+!
Unfortunately this is a known issue and my hands are tied. I've put a lot of work into trying to optimize the parsing and searching logic as much as possible, but I'm kinda at the limitation of what kind of computation you can do in a chrome extension. The logic for searching text in pages is really complex, it's not very easy to do.
For huge pages, I recommend using other tools (grep, for example). See further: #310