Hi,

The attached change in web-activity/downloadmanager.py fix a
problem causing Browse downloads to fail with an exception in
onProgressChange64() due to _create_journal_object() having failed
to be called earlier from onStateChange() when state_flags contained
the bit STATE_START, but also other bits as corresponding to
State Type Flags from nsIWebProgressListener.idl.

I'm pretty confident about the changes in onStateChange(), but
the change (eliminating a trailing '"' character) in the
components.registrar.registerFactory() calls are fairly gratuitous,
and should be checked by someone who is familiar with that API.

- Dan


diff --git a/downloadmanager.py b/downloadmanager.py
index b8a2ff6..c39927e 100644
--- a/downloadmanager.py
+++ b/downloadmanager.py
@@ -103,7 +103,7 @@ class DownloadManager:
         launcher.saveToDisk(None, False)
         return NS_OK
 
-components.registrar.registerFactory('{64355793-988d-40a5-ba8e-fcde78cac631}"',
+components.registrar.registerFactory('{64355793-988d-40a5-ba8e-fcde78cac631}',
                                      'Sugar Download Manager',
                                      '@mozilla.org/helperapplauncherdialog;1',
                                      Factory(DownloadManager))
@@ -132,7 +132,7 @@ class Download:
             (web_progress, request, status, message))
 
     def onStateChange(self, web_progress, request, state_flags, status):
-        if state_flags == interfaces.nsIWebProgressListener.STATE_START:
+        if state_flags & interfaces.nsIWebProgressListener.STATE_START:
             self._create_journal_object()            
             self._object_id = self._dl_jobject.object_id
             
@@ -146,7 +146,7 @@ class Download:
             global _active_downloads
             _active_downloads.append(self)
             
-        elif state_flags == interfaces.nsIWebProgressListener.STATE_STOP:
+        elif state_flags & interfaces.nsIWebProgressListener.STATE_STOP:
             if NS_FAILED(status): # download cancelled
                 return
 
@@ -266,7 +266,7 @@ class Download:
         global _active_downloads
         _active_downloads.remove(self)
 
-components.registrar.registerFactory('{23c51569-e9a1-4a92-adeb-3723db82ef7c}"',
+components.registrar.registerFactory('{23c51569-e9a1-4a92-adeb-3723db82ef7c}',
                                      'Sugar Download',
                                      '@mozilla.org/transfer;1',
                                      Factory(Download))
_______________________________________________
Sugar mailing list
[email protected]
http://lists.laptop.org/listinfo/sugar

Reply via email to