Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
path: root/browser.py
diff options
authorManuel Quiñones <manuq@laptop.org>2012-05-04 02:37:07 (GMT)
committer Manuel Quiñones <manuq@laptop.org>2012-05-04 13:40:53 (GMT)
commit8057d68dda9808485cd8e36482d01eff33e2e8c9 (patch)
tree300c5c8b73e639e7eb45c55a2f7410abf0500961 /browser.py
parente831a6e9977af1d7c5bdcb97b9a54f5c038df0a4 (diff)
Fix for the MIME type handling of a request SL #3512
We were not returning the right value, the callback should return True if the signal is handled, False otherwise. And a policy decision should be done, ignore for PDF. This fixes http://bugs.sugarlabs.org/ticket/3512 ----- v1 -> v2: fixed regression with PDF handling. v2 -> v3: set policy decision to ignore for PDF. Signed-off-by: Manuel Quiñones <manuq@laptop.org> Acked-by: Simon Schampijer <simon@laptop.org>
Diffstat (limited to 'browser.py')
1 files changed, 7 insertions, 4 deletions
diff --git a/browser.py b/browser.py
index c0bb7bc..4fd3b1a 100644
--- a/browser.py
+++ b/browser.py
@@ -532,14 +532,17 @@ class Browser(WebKit.WebView):
def __mime_type_policy_cb(self, webview, frame, request, mimetype,
+ """Handle downloads and PDF files."""
if mimetype == 'application/pdf':
self.emit('open-pdf', request.get_uri())
- return False
- elif self.can_show_mime_type(mimetype):
+ policy_decision.ignore()
return True
- else:
+ elif not self.can_show_mime_type(mimetype):
- return True
+ return True
+ return False
def __new_window_policy_cb(self, webview, webframe, request,
navigation_action, policy_decision):