From f38d3c986423ecfc61962f29b6aa95894328b937 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org>
Date: Wed, 2 May 2012 13:04:31 -0300
Subject: [PATCH v2 Browse] Fix for the MIME type handling of a request SL
#3512
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>
We were not returning the right value, the callback
should return True if the signal is handled, False otherwise.
This fixes http://bugs.sugarlabs.org/ticket/3512
-----
v1 -> v2: fixed regression with PDF handling.
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
---
browser.py | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/browser.py b/browser.py
index c0bb7bc..a40cc03 100644
a
|
b
|
class Browser(WebKit.WebView): |
532 | 532 | |
533 | 533 | def __mime_type_policy_cb(self, webview, frame, request, mimetype, |
534 | 534 | policy_decision): |
| 535 | """Handle downloads and PDF files.""" |
535 | 536 | if mimetype == 'application/pdf': |
536 | 537 | self.emit('open-pdf', request.get_uri()) |
537 | | return False |
538 | | elif self.can_show_mime_type(mimetype): |
539 | | return True |
540 | | else: |
| 538 | |
| 539 | elif not self.can_show_mime_type(mimetype): |
541 | 540 | policy_decision.download() |
542 | | return True |
| 541 | return True |
| 542 | |
| 543 | return False |
543 | 544 | |
544 | 545 | def __new_window_policy_cb(self, webview, webframe, request, |
545 | 546 | navigation_action, policy_decision): |