[Sugar-devel] [PATCH Browse] Handle LoadInterruptedByPolicyChange SL #3972

Manuel Kaufmann humitos at gmail.com
Mon Oct 1 16:41:35 EDT 2012


This error is raised when the mimetype policy suffers a change. When
this happens __load_error_cb is called and we were showing the error
page in any case.

With this patch that case is properly handled in __load_error_cb and
the error page is not shown on the current tab. In fact, we keep the
same page where the user clicked the link in the tab.

Signed-off-by: Manuel Kaufmann <humitos at gmail.com>
---
 browser.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/browser.py b/browser.py
index fb8a985..ccdf78c 100644
--- a/browser.py
+++ b/browser.py
@@ -653,6 +653,12 @@ class Browser(WebKit.WebView):
             'url': uri,
             }
 
+        # Don't show error page if the load was interrupted by policy
+        # change. For example, if a file was requested for download
+        if web_error.code == WebKit.PolicyError.\
+                FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE:
+            return True
+
         html = open(DEFAULT_ERROR_PAGE, 'r').read() % data
         web_frame.load_alternate_string(html, '', uri)
 
-- 
1.7.11.4



More information about the Sugar-devel mailing list