Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/downloadmanager.py
diff options
context:
space:
mode:
Diffstat (limited to 'downloadmanager.py')
-rw-r--r--downloadmanager.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/downloadmanager.py b/downloadmanager.py
index ec0923f..4f80259 100644
--- a/downloadmanager.py
+++ b/downloadmanager.py
@@ -401,10 +401,18 @@ def save_document(activity, browser):
local_file.initWithPath(os.path.join(temp_dir, 'index.html'))
local_data.initWithPath(os.path.join(temp_dir, 'data'))
+ # persist settings
persist.persistFlags = interfaces.nsIWebBrowserPersist \
.PERSIST_FLAGS_REPLACE_EXISTING_FILES
+ persist.persistFlags |= interfaces.nsIWebBrowserPersist \
+ .PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION
+ persist.persistFlags |= interfaces.nsIWebBrowserPersist \
+ .ENCODE_FLAGS_ENCODE_BASIC_ENTITIES
+
persist.progressListener = _SaveDocumentProgressListener(activity,
temp_dir, browser.props.title)._wrapped
+
+ # finally kick off the saving
persist.saveDocument(browser.dom_window.document, local_file, local_data,
None, 0, 0)
@@ -423,6 +431,8 @@ class _SaveDocumentProgressListener(object):
interfaces.nsIWebProgressListener)
def onStateChange(self, web_progress, request, state_flags, status):
+ logging.debug('######### state_flags %s, status %s' \
+ %s (state_flags, status))
if state_flags & interfaces.nsIWebProgressListener.STATE_STOP:
if NS_FAILED(status):
alert = TimeoutAlert(9)