Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/downloadmanager.py
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2009-08-06 17:01:30 (GMT)
committer Simon Schampijer <simon@schampijer.de>2009-08-06 17:01:30 (GMT)
commit9cac83dae9eea3074b96095be10dad37cfd0f7e1 (patch)
tree11bc09a45c1bc98797136cd43d9f7df114fc454a /downloadmanager.py
parent54be350982755e42c702f6e554cd59358e3c3fe6 (diff)
Able to download Data URIs #1029 (Lucian Branescu)
Diffstat (limited to 'downloadmanager.py')
-rw-r--r--downloadmanager.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/downloadmanager.py b/downloadmanager.py
index 8402b81..a3fe6d8 100644
--- a/downloadmanager.py
+++ b/downloadmanager.py
@@ -1,5 +1,5 @@
# Copyright (C) 2007, One Laptop Per Child
-# Copyright (C) 2009, Tomeu Vizoso
+# Copyright (C) 2009, Tomeu Vizoso, Lucian Branescu
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -252,6 +252,8 @@ class Download:
def _get_file_name(self):
if self._display_name:
return self._display_name
+ elif self._source.scheme == 'data':
+ return 'Data URI'
else:
path = urlparse.urlparse(self._source.spec).path
location, file_name = os.path.split(path)
@@ -311,9 +313,12 @@ def save_link(url, text, owner_document):
interfaces.nsIRequest.LOAD_BYPASS_CACHE | \
interfaces.nsIChannel.LOAD_CALL_CONTENT_SNIFFERS
- if _implements_interface(channel, interfaces.nsIHttpChannel):
- channel.referrer = io_service.newURI(owner_document.documentURI, None,
- None)
+ # HACK: when we QI for nsIHttpChannel on objects that implement
+ # just nsIChannel, pyxpcom gets confused trac #1029
+ if uri.scheme == 'http':
+ if _implements_interface(channel, interfaces.nsIHttpChannel):
+ channel.referrer = io_service.newURI(owner_document.documentURI,
+ None, None)
# kick off the channel with our proxy object as the listener
listener = xpcom.server.WrapObject(