From 9982065666e830ded891b2ee9f6dec4533577d03 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 2 Sep 2023 14:24:35 +0530 Subject: [PATCH] Fix #2033947 [Content Server returning error messages (Running from source*)](https://bugs.launchpad.net/calibre/+bug/2033947) --- src/pyj/utils.pyj | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pyj/utils.pyj b/src/pyj/utils.pyj index ccaebbac8c..c6a6ca0636 100644 --- a/src/pyj/utils.pyj +++ b/src/pyj/utils.pyj @@ -242,7 +242,10 @@ def sandboxed_html(html, style, sandbox): final_html = f'{html}' # prevent context menu on right click in iframe ans.addEventListener('load', def(ev): - ev.target.contentWindow.addEventListener('contextmenu', def(e): e.preventDefault();) + try: + ev.target.contentWindow.addEventListener('contextmenu', def(e): e.preventDefault();) + except: + pass ) ans.srcdoc = final_html return ans