Ticket #3972: 0001-Handle-LoadInterruptedByPolicyChange-SL-3972.patch

File 0001-Handle-LoadInterruptedByPolicyChange-SL-3972.patch, 1.3 KB (added by humitos, 12 years ago)
  • browser.py

    From 159084e93a451ac57b97ace6e401212f4242e170 Mon Sep 17 00:00:00 2001
    From: Manuel Kaufmann <humitos@gmail.com>
    Date: Mon, 1 Oct 2012 17:35:07 -0300
    Subject: [PATCH Browse] Handle LoadInterruptedByPolicyChange SL #3972
    
    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@gmail.com>
    ---
     browser.py | 6 ++++++
     1 file changed, 6 insertions(+)
    
    diff --git a/browser.py b/browser.py
    index fb8a985..ccdf78c 100644
    a b class Browser(WebKit.WebView): 
    653653            'url': uri,
    654654            }
    655655
     656        # Don't show error page if the load was interrupted by policy
     657        # change. For example, if a file was requested for download
     658        if web_error.code == WebKit.PolicyError.\
     659                FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE:
     660            return True
     661
    656662        html = open(DEFAULT_ERROR_PAGE, 'r').read() % data
    657663        web_frame.load_alternate_string(html, '', uri)
    658664