[Pkg-mozext-commits] [automatic-save-folder] 33/133: Fix : Corrected an error when using Private browsing mode, the suggested folder was the last used in non private browsing instead of the filtered one.

David Prévot taffit at moszumanska.debian.org
Mon Apr 27 20:33:49 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch wip
in repository automatic-save-folder.

commit 4245aa40a93c4afc1ddb6b72e7c4abf81537c910
Author: Cyan <Cyan at d0063192-6b2e-11de-89a9-0b20f3e2dceb>
Date:   Sat Nov 14 17:52:06 2009 +0000

    Fix : Corrected an error when using Private browsing mode,
          the suggested folder was the last used in non private browsing instead of
          the filtered one.
    
          NOTE : it's still the last used in non private mode if the new suggested
          folder doesn't exist.
          I could add the creation option, but it defeats the "private"'s first
          intention as to not write anything to disk.
    
          Maybe I'll add a checkbox in the option tab to let the user choose.
    
    git-svn-id: http://automatic-save-folder.googlecode.com/svn/trunk@33 d0063192-6b2e-11de-89a9-0b20f3e2dceb
---
 content/asf_download.js    | 33 ++++++++++++++++++++++++++++-----
 content/asf_right_click.js |  2 +-
 2 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/content/asf_download.js b/content/asf_download.js
index 05ae7c7..ed1552e 100644
--- a/content/asf_download.js
+++ b/content/asf_download.js
@@ -261,8 +261,8 @@ Copyright (C) 2007-2009 Eric Cassar (Cyan).
 		if (this.firefoxversion == 2)
 		{
 		
-		this.saveUnicodeString("browser.download.dir", directory.path);
-		if (lastdir)
+			this.saveUnicodeString("browser.download.dir", directory.path);
+			if (lastdir)
 			this.saveUnicodeString("browser.download.lastDir", directory.path);		
 		}
 		
@@ -278,7 +278,7 @@ Copyright (C) 2007-2009 Eric Cassar (Cyan).
 			catch (e) { // nsIPrivateBrowsingService not working on FF2 and 3.0
 			}
 			
-			if (inPrivateBrowsing)
+			if (inPrivateBrowsing && directory)
 			{
 				gDownloadLastDir.file = directory;
 			}
@@ -528,15 +528,38 @@ Copyright (C) 2007-2009 Eric Cassar (Cyan).
 	
 	
 	show_dloptions: function ()	{
-		
+
 		var asf_dloptions = document.getElementById('asf_dloptions');
 		var asf_radiogroup_pathselect = document.getElementById('asf_radiogroup_pathselect');
 		var asf_savefolder = document.getElementById('asf_savefolder');
 		var asf_viewdloption = this.prefManager.getBoolPref("extensions.asf.viewdloption");	
 		var asf_viewpathselect = this.prefManager.getBoolPref("extensions.asf.viewpathselect");	
 		var folder = "";
-		if (this.firefoxversion == 3) folder = this.loadUnicodeString("browser.download.lastDir");
 		if (this.firefoxversion == 2) folder = this.loadUnicodeString("browser.download.dir");
+		if (this.firefoxversion == 3)
+		{
+			
+			var inPrivateBrowsing = false;
+			try {
+				var pbs = Components.classes["@mozilla.org/privatebrowsing;1"]
+									.getService(Components.interfaces.nsIPrivateBrowsingService);
+				inPrivateBrowsing = pbs.privateBrowsingEnabled;
+			}
+			catch (e) { // nsIPrivateBrowsingService not working on FF2 and 3.0
+			}
+			
+			if (inPrivateBrowsing && gDownloadLastDir.file)
+			{
+				folder = gDownloadLastDir.file.path;
+			}
+			else
+			{	
+				folder = this.loadUnicodeString("browser.download.lastDir");
+			}
+			
+		}	
+		
+		
 		
 		// check the lastpath, if different than current folder, then print radio choice to user
 		// so he can choose from found filters, or last used path.
diff --git a/content/asf_right_click.js b/content/asf_right_click.js
index 65a01fe..02c35ce 100644
--- a/content/asf_right_click.js
+++ b/content/asf_right_click.js
@@ -487,7 +487,7 @@ var automatic_save_folder = {
 			catch (e) { // nsIPrivateBrowsingService not working on FF2 and 3.0
 			}
 			
-			if (inPrivateBrowsing)
+			if (inPrivateBrowsing && directory)
 			{
 				gDownloadLastDir.file = directory;
 			}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/automatic-save-folder.git



More information about the Pkg-mozext-commits mailing list