[Pkg-mozext-commits] [automatic-save-folder] 106/133: Add: - Added two new Domain Type : Referrer's URL and Active Tab's URL field Content. - Added an alert on badly formed filters on filter's checking process when downloading a file.

David Prévot taffit at moszumanska.debian.org
Mon Apr 27 20:33:57 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 47b4a902200a75885a0dac2fb7e8741c6999a180
Author: Cyan <Cyan at d0063192-6b2e-11de-89a9-0b20f3e2dceb>
Date:   Sat Feb 18 11:07:37 2012 +0000

    Add:
    - Added two new Domain Type : Referrer's URL and Active Tab's URL field Content.
    - Added an alert on badly formed filters on filter's checking process when
      downloading a file.
    
    Change:
    Changed the name of "Current tab" to "Active Page" in the Domain Type tooltip and error console logs.
    
    git-svn-id: http://automatic-save-folder.googlecode.com/svn/trunk@115 d0063192-6b2e-11de-89a9-0b20f3e2dceb
---
 content/asf_download.js    | 43 +++++++++++++++++++++++++++++++++++++------
 content/asf_right_click.js | 41 +++++++++++++++++++++++++++++++++++------
 content/common.dtd         |  2 +-
 content/options.xul        |  2 ++
 locale/cs/asf.dtd          |  2 ++
 locale/en-US/asf.dtd       |  6 ++++--
 locale/fr/asf.dtd          |  6 ++++--
 locale/it/asf.dtd          |  6 ++++--
 locale/ru/asf.dtd          |  6 ++++--
 locale/sv-SE/asf.dtd       |  2 ++
 10 files changed, 95 insertions(+), 21 deletions(-)

diff --git a/content/asf_download.js b/content/asf_download.js
index f23e3e0..294a0ab 100644
--- a/content/asf_download.js
+++ b/content/asf_download.js
@@ -68,11 +68,19 @@ Copyright (C) 2007-2011 Éric Cassar (Cyan).
 		var nbrfilters = 	prefManager.getIntPref("extensions.asf.filtersNumber");
 		
 		
-		// load the domain and the filename of the saved file (copy the data from the firefox saving window)
-		var tBrowser = Components.classes["@mozilla.org/appshell/window-mediator;1"]
-				 .getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow("navigator:browser").getBrowser();
-		var tabLocation = tBrowser.mCurrentTab.linkedBrowser.contentDocument.location;
+		// load the domain and the filename of the saved file (copy the data from the firefox saving window and from the last active tab)
+		var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+						   .getService(Components.interfaces.nsIWindowMediator);
+		var mainWindow = wm.getMostRecentWindow("navigator:browser");
+		
+		var currentTab = mainWindow.gBrowser.getBrowserAtIndex(mainWindow.gBrowser.tabContainer.selectedIndex);
+		// var tabLocation = currentTab.currentURI.spec;
+		var tabLocation = mainWindow.gBrowser.mCurrentTab.linkedBrowser.contentDocument.location;
+		var tabURL = mainWindow.gURLBar.value;
+		var currentReferrer = mainWindow.gBrowser.mCurrentTab.linkedBrowser.contentDocument.referrer;
+		
 		var filename = 			document.getElementById("location").value ;
+		
 		var domain = 			document.getElementById("source").value ;
 		var	domainWithoutProtocol = domain.replace(/^.*:\/\//g,'');  // remove the protocol name from the domain
 		var fileURL = 			document.getElementById("source").getAttribute("tooltiptext");
@@ -82,6 +90,7 @@ Copyright (C) 2007-2011 Éric Cassar (Cyan).
 		{
 			currentDomain = 	tabLocation.protocol + "//" + tabLocation.host; // look for the current website URL in the DOM.
 			currentURL = 		tabLocation.href; // look for the current website URL in the DOM.
+			if (currentDomain == "about://") currentDomain = "";
 		}
 		catch (e) // if there is no data (The tab is closed or it's a script redirection), use the file's data.
 		{
@@ -101,7 +110,15 @@ Copyright (C) 2007-2011 Éric Cassar (Cyan).
 		
 		var domain_testOrder = prefManager.getCharPref("extensions.asf.domainTestOrder");
 		if (this.trim(domain_testOrder) == "") domain_testOrder = "1,5";
-		var message = "These data will be used to verify the filters :\nFilename:\t\t"+filename+"\nDomain test order:\t"+domain_testOrder+"\n1 - File's domain:\t"+domain+"\n2 - File's URL:\t\t"+fileURL+"\n3 - Full file's URL:\t"+fileURLAndFilename+"\n4 - Tab's domain:\t"+currentDomain+"\n5 - Tab's URL:\t\t"+currentURL;
+		var message = "These data will be used to verify the filters :\n"+
+							"Filename:\t\t"+filename+"\nDomain test order:\t"+domain_testOrder+"\n"+
+							"1 - File's domain:\t"+domain+"\n"+
+							"2 - File's URL:\t\t"+fileURL+"\n"+
+							"3 - Full file's URL:\t"+fileURLAndFilename+"\n"+
+							"4 - Page's domain:\t"+currentDomain+"\n"+
+							"5 - Page's URL:\t\t"+currentURL+"\n"+
+							"6 - Page's referrer:\t"+currentReferrer+"\n"+
+							"7 - Tab's URL content:\t"+tabURL;
 		if (!this.inPrivateBrowsing) this.console_print(message);
 		// debug : show the full downloaded link  http://abc.xyz/def/file.ext
 		// Can use this new function to get free from the need of the download window.
@@ -196,6 +213,14 @@ Copyright (C) 2007-2011 Éric Cassar (Cyan).
 						case "5":
 							dom_regexp = this.test_regexp(filters[i][0], currentURL, i, "domain");
 							if (dom_regexp && this.logtoconsole && !this.inPrivateBrowsing) this.console_print("Filter "+i+" matched domain type : 5");
+							break;
+						case "6":
+							dom_regexp = this.test_regexp(filters[i][0], currentReferrer, i, "domain");
+							if (dom_regexp && this.logtoconsole && !this.inPrivateBrowsing) this.console_print("Filter "+i+" matched domain type : 6");
+							break;
+						case "7":
+							dom_regexp = this.test_regexp(filters[i][0], tabURL, i, "domain");
+							if (dom_regexp && this.logtoconsole && !this.inPrivateBrowsing) this.console_print("Filter "+i+" matched domain type : 7");
 						default:
 					}
 					
@@ -1113,7 +1138,13 @@ Copyright (C) 2007-2011 Éric Cassar (Cyan).
 		
 		// initialize the regular expression search
 		var param = (this.prefManager.getBoolPref("extensions.asf.regexp_caseinsensitive") == true ? "i" : "");
-		var test = new RegExp(filter_data, param);
+		try 
+		{
+			var test = new RegExp(filter_data, param);
+		}
+		catch(e){
+			alert('\t\tAutomatic Save Folder\n\n-'+e.message+'\nin filter N°'+idx+':\n'+filter_data+'\nregular expression: '+isregexp)
+		}
 		
 		// Thanks to Ted Gifford for the regular expression capture.
 		var res = downloaded_data.match(test);
diff --git a/content/asf_right_click.js b/content/asf_right_click.js
index 4334fd5..20f6add 100644
--- a/content/asf_right_click.js
+++ b/content/asf_right_click.js
@@ -116,11 +116,18 @@ var automatic_save_folder = {
 				
 				
 			// load the domain and the filename of the saved file
-			var tBrowser = Components.classes["@mozilla.org/appshell/window-mediator;1"]
-						.getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow("navigator:browser").getBrowser();
-			var tabLocation = tBrowser.mCurrentTab.linkedBrowser.contentDocument.location;
+			var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+							   .getService(Components.interfaces.nsIWindowMediator);
+			var mainWindow = wm.getMostRecentWindow("navigator:browser");
+			
+			var currentTab = mainWindow.gBrowser.getBrowserAtIndex(mainWindow.gBrowser.tabContainer.selectedIndex);
+			// var tabLocation = currentTab.currentURI.spec;
+			var tabLocation = mainWindow.gBrowser.mCurrentTab.linkedBrowser.contentDocument.location;
+			var tabURL = mainWindow.gURLBar.value;
+			var currentReferrer = mainWindow.gBrowser.mCurrentTab.linkedBrowser.contentDocument.referrer;
+			
 			var filename = aFpP.fileInfo.fileName; // filename or tab's name if no filename specified.
-
+			
 			var domain = 					aFpP.fileInfo.uri.scheme+"://"+aFpP.fileInfo.uri.host;
 			var	domainWithoutProtocol =    	aFpP.fileInfo.uri.host;
 			var fileURL = 					aFpP.fileInfo.uri.prePath+aFpP.fileInfo.uri.directory; 
@@ -150,7 +157,15 @@ var automatic_save_folder = {
 			
 			var domain_testOrder = prefManager.getCharPref("extensions.asf.domainTestOrder");
 			if (this.trim(domain_testOrder) == "") domain_testOrder = "1,5";
-			var message = "These data will be used to verify the filters :\nFilename:\t\t"+filename+"\nDomain test order:\t"+domain_testOrder+"\n1 - File's domain:\t"+domain+"\n2 - File's URL:\t\t"+fileURL+"\n3 - Full file's URL:\t"+fileURLAndFilename+"\n4 - Tab's domain:\t"+currentDomain+"\n5 - Tab's URL:\t\t"+currentURL;
+					var message = "These data will be used to verify the filters :\n"+
+							"Filename:\t\t"+filename+"\nDomain test order:\t"+domain_testOrder+"\n"+
+							"1 - File's domain:\t"+domain+"\n"+
+							"2 - File's URL:\t\t"+fileURL+"\n"+
+							"3 - Full file's URL:\t"+fileURLAndFilename+"\n"+
+							"4 - Page's domain:\t"+currentDomain+"\n"+
+							"5 - Page's URL:\t\t"+currentURL+"\n"+
+							"6 - Page's referrer:\t"+currentReferrer+"\n"+
+							"7 - Tab's URL content:\t"+tabURL;
 			if (!this.inPrivateBrowsing) this.console_print(message);
 			
 			
@@ -240,6 +255,14 @@ var automatic_save_folder = {
 						case "5":
 							dom_regexp = this.test_regexp(filters[i][0], currentURL, i, "domain");
 							if (dom_regexp && this.logtoconsole && !this.inPrivateBrowsing) this.console_print("Filter "+i+" matched domain type : 5");
+							break;
+						case "6":
+							dom_regexp = this.test_regexp(filters[i][0], currentReferrer, i, "domain");
+							if (dom_regexp && this.logtoconsole && !this.inPrivateBrowsing) this.console_print("Filter "+i+" matched domain type : 6");
+							break;
+						case "7":
+							dom_regexp = this.test_regexp(filters[i][0], tabURL, i, "domain");
+							if (dom_regexp && this.logtoconsole && !this.inPrivateBrowsing) this.console_print("Filter "+i+" matched domain type : 7");
 						default:
 					}
 					
@@ -743,7 +766,13 @@ var automatic_save_folder = {
 		
 		// initialize the regular expression search
 		var param = (this.prefManager.getBoolPref("extensions.asf.regexp_caseinsensitive") == true ? "i" : "");
-		var test = new RegExp(filter_data, param);
+		try 
+		{
+			var test = new RegExp(filter_data, param);
+		}
+		catch(e){
+			alert('\t\tAutomatic Save Folder\n\n-'+e.message+'\nin filter N°'+idx+':\n'+filter_data+'\nregular expression: '+isregexp)
+		}
 		
 		// Thanks to Ted Gifford for the regular expression capture.
 		var res = downloaded_data.match(test);
diff --git a/content/common.dtd b/content/common.dtd
index c46a717..a112c92 100644
--- a/content/common.dtd
+++ b/content/common.dtd
@@ -1,5 +1,5 @@
 <!-- Current version -->
-<!ENTITY asf.version "1.0.5bRev114">
+<!ENTITY asf.version "1.0.5bRev115">
 
 <!ENTITY about.translators "
 - cs : Stanislav Horáček<br />
diff --git a/content/options.xul b/content/options.xul
index a84a6db..1221ace 100644
--- a/content/options.xul
+++ b/content/options.xul
@@ -94,6 +94,8 @@
 		<hbox><description value="3 :"/><label>&asf.domainTestOrder.tooltip4;</label></hbox>
 		<hbox><description value="4 :"/><label>&asf.domainTestOrder.tooltip5;</label></hbox>
 		<hbox><description value="5 :"/><label>&asf.domainTestOrder.tooltip6;</label></hbox>
+		<hbox><description value="6 :"/><label>&asf.domainTestOrder.tooltip8;</label></hbox>
+		<hbox><description value="7 :"/><label>&asf.domainTestOrder.tooltip9;</label></hbox>
 		<label>
&asf.domainTestOrder.tooltip7;</label>
 	</tooltip>
 	<tooltip id="tooltip_suggestAllPossibleFolders" label="&asf.suggestAllPossibleFolders.tooltip;" noautohide="true" />
diff --git a/locale/cs/asf.dtd b/locale/cs/asf.dtd
index f801b4a..9a02f53 100644
--- a/locale/cs/asf.dtd
+++ b/locale/cs/asf.dtd
@@ -84,6 +84,8 @@
 <!ENTITY asf.domainTestOrder.tooltip5 "Doména panelu (nebo doména souboru, pokud není údaj nalezen)">
 <!ENTITY asf.domainTestOrder.tooltip6 "URL panelu (nebo URL souboru, pokud není údaj nalezen)">
 <!ENTITY asf.domainTestOrder.tooltip7 "Více informací o tom, které hodnoty odpovídají jednotlivým položkám, zjistíte v Chybové konzoli při stahování souboru.">
+<!ENTITY asf.domainTestOrder.tooltip8 "Active page's referrer URL">
+<!ENTITY asf.domainTestOrder.tooltip9 "Content of the active tab's URL">
 <!ENTITY asf.regexp_caseinsensitive.bool "Filtry nerozlišují velikost písmen.">
 <!ENTITY asf.options.groupbox4.label "Klepnutí pravým tlačítkem">
 <!ENTITY asf.userightclick.bool "Použít filtry v nabídkách">
diff --git a/locale/en-US/asf.dtd b/locale/en-US/asf.dtd
index d3e3a3a..cde51a7 100644
--- a/locale/en-US/asf.dtd
+++ b/locale/en-US/asf.dtd
@@ -90,9 +90,11 @@
 <!ENTITY asf.domainTestOrder.tooltip2 "File's domain">
 <!ENTITY asf.domainTestOrder.tooltip3 "File's URL">
 <!ENTITY asf.domainTestOrder.tooltip4 "File's URL + Filename">
-<!ENTITY asf.domainTestOrder.tooltip5 "Tab's domain (or the file's domain if no data is found)">
-<!ENTITY asf.domainTestOrder.tooltip6 "Tab's URL (or the file's URL if no data is found)">
+<!ENTITY asf.domainTestOrder.tooltip5 "Active page's domain (or the file's domain if no data is found)">
+<!ENTITY asf.domainTestOrder.tooltip6 "Active page's URL (or the file's URL if no data is found)">
 <!ENTITY asf.domainTestOrder.tooltip7 "For more informations, you can see to which values correspond each entry in the Error console when downloading a file.">
+<!ENTITY asf.domainTestOrder.tooltip8 "Active page's referrer URL">
+<!ENTITY asf.domainTestOrder.tooltip9 "Content of the active tab's URL">
 <!ENTITY asf.regexp_caseinsensitive.bool "Filters are case insensitive.">
 
 <!ENTITY asf.options.groupbox4.label "Right-click">
diff --git a/locale/fr/asf.dtd b/locale/fr/asf.dtd
index b255463..707415e 100644
--- a/locale/fr/asf.dtd
+++ b/locale/fr/asf.dtd
@@ -90,9 +90,11 @@
 <!ENTITY asf.domainTestOrder.tooltip2 "Domaine du fichier">
 <!ENTITY asf.domainTestOrder.tooltip3 "URL du fichier">
 <!ENTITY asf.domainTestOrder.tooltip4 "URL du fichier + nom du fichier">
-<!ENTITY asf.domainTestOrder.tooltip5 "Domaine de l'onglet (ou le domaine du fichier si aucun résultat n'est trouvé)">
-<!ENTITY asf.domainTestOrder.tooltip6 "URL de l'onglet (ou l'URL du fichier si aucun résultat n'est trouvé)">
+<!ENTITY asf.domainTestOrder.tooltip5 "Domaine de la page active (ou le domaine du fichier si aucun résultat n'est trouvé)">
+<!ENTITY asf.domainTestOrder.tooltip6 "URL de la page active (ou l'URL du fichier si aucun résultat n'est trouvé)">
 <!ENTITY asf.domainTestOrder.tooltip7 "Pour plus de précisions, vous pouvez voir à quoi correspondent ces informations dans la Console d'erreurs lorsque vous téléchargez un fichier.">
+<!ENTITY asf.domainTestOrder.tooltip8 "URL du referrer de la page active">
+<!ENTITY asf.domainTestOrder.tooltip9 "Contenu du champs URL de l'onglet actif">
 <!ENTITY asf.regexp_caseinsensitive.bool "Les filtres sont insensibles à la casse.">
 
 <!ENTITY asf.options.groupbox4.label "Clic droit">
diff --git a/locale/it/asf.dtd b/locale/it/asf.dtd
index 71473d8..72ca611 100644
--- a/locale/it/asf.dtd
+++ b/locale/it/asf.dtd
@@ -90,9 +90,11 @@
 <!ENTITY asf.domainTestOrder.tooltip2 "File's domain">
 <!ENTITY asf.domainTestOrder.tooltip3 "File's URL">
 <!ENTITY asf.domainTestOrder.tooltip4 "File's URL + Filename">
-<!ENTITY asf.domainTestOrder.tooltip5 "Tab's domain (or the file's domain if no data is found)">
-<!ENTITY asf.domainTestOrder.tooltip6 "Tab's URL (or the file's URL if no data is found)">
+<!ENTITY asf.domainTestOrder.tooltip5 "Active page's domain (or the file's domain if no data is found)">
+<!ENTITY asf.domainTestOrder.tooltip6 "Active page's URL (or the file's URL if no data is found)">
 <!ENTITY asf.domainTestOrder.tooltip7 "For more informations, you can see to which values correspond each entry in the Error console when downloading a file.">
+<!ENTITY asf.domainTestOrder.tooltip8 "Active page's referrer URL">
+<!ENTITY asf.domainTestOrder.tooltip9 "Content of the active tab's URL">
 <!ENTITY asf.regexp_caseinsensitive.bool "Filters are case insensitive.">
 
 <!ENTITY asf.options.groupbox4.label "Right-click">
diff --git a/locale/ru/asf.dtd b/locale/ru/asf.dtd
index 81619d1..4795e27 100644
--- a/locale/ru/asf.dtd
+++ b/locale/ru/asf.dtd
@@ -90,9 +90,11 @@
 <!ENTITY asf.domainTestOrder.tooltip2 "File's domain">
 <!ENTITY asf.domainTestOrder.tooltip3 "File's URL">
 <!ENTITY asf.domainTestOrder.tooltip4 "File's URL + Filename">
-<!ENTITY asf.domainTestOrder.tooltip5 "Tab's domain (or the file's domain if no data is found)">
-<!ENTITY asf.domainTestOrder.tooltip6 "Tab's URL (or the file's URL if no data is found)">
+<!ENTITY asf.domainTestOrder.tooltip5 "Active page's domain (or the file's domain if no data is found)">
+<!ENTITY asf.domainTestOrder.tooltip6 "Active page's URL (or the file's URL if no data is found)">
 <!ENTITY asf.domainTestOrder.tooltip7 "For more informations, you can see to which values correspond each entry in the Error console when downloading a file.">
+<!ENTITY asf.domainTestOrder.tooltip8 "Active page's referrer URL">
+<!ENTITY asf.domainTestOrder.tooltip9 "Content of the active tab's URL">
 <!ENTITY asf.regexp_caseinsensitive.bool "Учитывать регистр при обработке фильтров.">
 
 <!ENTITY asf.options.groupbox4.label "Правая кнопка мыши">
diff --git a/locale/sv-SE/asf.dtd b/locale/sv-SE/asf.dtd
index 37a42b6..2866b89 100644
--- a/locale/sv-SE/asf.dtd
+++ b/locale/sv-SE/asf.dtd
@@ -93,6 +93,8 @@
 <!ENTITY asf.domainTestOrder.tooltip5 "Flikens domän (eller filens domän om ingen data hittas)">
 <!ENTITY asf.domainTestOrder.tooltip6 "Flikens URL (eller filens URL om ingen data hittas)">
 <!ENTITY asf.domainTestOrder.tooltip7 "För mer information kan du se vilka värden som hör ihop med vilka poster i Felkonsolen när du laddar ner en fil.">
+<!ENTITY asf.domainTestOrder.tooltip8 "Active page's referrer URL">
+<!ENTITY asf.domainTestOrder.tooltip9 "Content of the active tab's URL">
 <!ENTITY asf.regexp_caseinsensitive.bool "Filtren är inte skiftlägeskänsliga.">
 
 <!ENTITY asf.options.groupbox4.label "Högerklick">

-- 
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