calibre viewer shows "Unhandled error: Uncaught InvalidStateError: Failed to execute 'surroundContents' on 'Range'" after RegExp searching in epub-file

Bug #1908000 reported by Sergey M.
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Undecided
Unassigned

Bug Description

Environment:
xUbuntu 18.04.5
Python 3.6.9
calibre 5.7.2; was installed over the 3.21.0 version (from of.ubuntu-repository) using command
 sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin

STR:
1. open the book from attachment in Calibre E-book viewer
2. open the Search dialog (Ctrl+F), select Regex type of searching
3. enter to the Serch field value \s+\w+ *: *\w+ *= *\w+
4. press Find next match trice (starting from the beginning of the book)
5. make sure the error is present

(full text of the error message):
calibre, version 5.7.2
ERROR: Unhandled error: Uncaught InvalidStateError: Failed to execute 'surroundContents' on 'Range': The Range has partially selected a non-Text node.<br><span style="font-size:smaller">Error at userscript:viewer.js:17926:15</span>
Traceback (most recent call last):
    at Number.onload (userscript:viewer.js:16991:21)
    at IframeBoss.content_loaded (userscript:viewer.js:25274:18)
    at IframeBoss.content_loaded_stage2 (userscript:viewer.js:25302:26)
    at IframeBoss.show_search_result (userscript:viewer.js:25836:22)
    at IframeBoss.ensure_selection_visible (userscript:viewer.js:19428:17)
    at wrap_range (userscript:viewer.js:17926:15)
Error: Failed to execute 'surroundContents' on 'Range': The Range has partially selected a non-Text node.

(should you need additional information please ask me in comments or any other ways)

Revision history for this message
Sergey M. (msvcontact) wrote :
Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 1908000

That regex gives me no matches. Since the problem is with the third
match why dont you just post it as plain text.

 status incomplete

Changed in calibre:
status: New → Incomplete
Revision history for this message
Sergey M. (msvcontact) wrote :

problem is not in RegExp as I got, but in the epub book rendering (which is executed after opening that particular search result).
so I attached here the screenshot with overall situation - RegExp + list of results of search + result number (4th) + the error message and reader's page view (was emptied after error).
Should You need any other information, let me know here in comments.

Revision history for this message
Sergey M. (msvcontact) wrote :

(add.)
bug repeated in almost the same way with another epub file (1st attachment - descriptive screenshot to the whole issue)

Revision history for this message
Sergey M. (msvcontact) wrote :

(2nd attachment - epub file)

Revision history for this message
Kovid Goyal (kovid) wrote :

I cannot replicate, with either of your attached files. See screenshot.

1) Uninstall the distro calibre, dont install over it.
2) Try to reproduce with a clean calibre config CALIBRE_CONFIG_DIRECTORY=/tmp/test ebook-viewer file.epub

Revision history for this message
Kovid Goyal (kovid) wrote :

Actually, never mind, am guessing you are in flow mode not paged mode.

Revision history for this message
Kovid Goyal (kovid) wrote : Fixed in master

Fixed in branch master. The fix will be in the next release. calibre is usually released every alternate Friday.

 status fixreleased

Changed in calibre:
status: Incomplete → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers