tor-commits
Threads by month
- ----- 2025 -----
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
September 2012
- 18 participants
- 792 discussions
commit a109f5109e174614064065016eabbf11191de43f
Author: Translation commit bot <translation(a)torproject.org>
Date: Wed Sep 26 09:15:08 2012 +0000
Update translations for tsum
---
lv/short-user-manual_lv_noimg.xhtml | 36 +++++++++++++++++-----------------
1 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/lv/short-user-manual_lv_noimg.xhtml b/lv/short-user-manual_lv_noimg.xhtml
index 12f63fe..1182dd9 100644
--- a/lv/short-user-manual_lv_noimg.xhtml
+++ b/lv/short-user-manual_lv_noimg.xhtml
@@ -27,7 +27,7 @@
<p>Pirms uzsākt Pārlūka Tor komplekta darbu, jāpārliecinās, kas lietojat pareizo versiju.</p>
<p>Saņemtajai programmatūrai tiek pievienota datne, kuras nosaukums ir tāds pats kā komplekta nosaukums, bet paplašinājums ir <strong>.asc</strong>. Šī .asc datne ir GPG paraksts, un tā sniedz iespēju verificēt, ka lejupielādētā datne ir tieši tā, kuru bijāt paredzējis saņemt.</p>
<p>Pirms parakstu var verificēt, nepieciešams lejupielādēt un instalēt GnuPG:</p>
- <p><strong>Windows</strong>: <a href="http://gpg4win.org/download.html">http://gpg4win.org/download.html</a><br/><strong>Mac OS X</strong>: <a href="http://www.gpgtools.org/">http://www.gpgtools.org/</a><br/><strong>Linux</strong>: Most Linux distributions come with GnuPG preinstalled.</p>
+ <p><strong>Windows</strong>: <a href="http://gpg4win.org/download.html">http://gpg4win.org/download.html</a><br/><strong>Mac OS X</strong>: <a href="http://www.gpgtools.org/">http://www.gpgtools.org/</a><br/><strong>Linux</strong>: Vairums Linux distributīvu, GnuPG ir iepriekš instalēts.</p>
<p>Lūdzu vērsiet uzmanību, ka var būt nepieciešams rediģēt zemāk lietotās komandas un ceļus, lai tas varētu strādāt jūsu sistēmā.</p>
<p>Erins Klārks jeb angļu valodā Erinn Clark paraksta Pārlūka Tor komplektus ar atslēgu 0x63FEE659. Lai importētu Erina atslēgu, izpildiet: </p>
<pre>
@@ -68,15 +68,15 @@
<p>Once you have a set of bridges to use, open the Vidalia control panel, click on <em>Settings</em>, <em>Network</em> and tick the box that says <em>My ISP blocks connections to the Tor network</em>. Enter the bridges in the box below, hit <em>OK</em> and start Tor again.</p>
<h3 id="how-to-use-an-open-proxy">Kā lietot atvērtu starpnieku</h3>
<p>If using a bridge does not work, try configuring Tor to use any HTTPS or SOCKS proxy to get access to the Tor network. This means even if Tor is blocked by your local network, open proxies can be safely used to connect to the Tor Network and on to the uncensored Internet.</p>
- <p>The steps below assume you have a functional Tor/Vidalia configuration, and you have found a list of HTTPS, SOCKS4, or SOCKS5 proxies.</p>
+ <p>Turpmāk uzskaitītie soļi paredz, ka izmantojat funkcionālu Tor/Vidalia konfigurāciju un ka esat atradis virkni HTTPS, SOCKS4 vai SOCKS5 starpnieku.</p>
<ol style="list-style-type: decimal">
<li>Atvēriet Vidalia vadības paneli, noklikšķiniet uz <em>Iestatījumi</em>.</li>
<li>Noklikšķiniet <em>Tīkls</em>. Izvēlieties <em>Es izmantoju starpnieku, lai piekļūtu internetam</em>.</li>
- <li>On the <em>Address</em> line, enter the open proxy address. This can be a hostname or an IP Address.</li>
+ <li><em>Address</em> rindā, ievadiet starpnieka adresi. Tā var būt gan resursdatora nosaukums , gan IP adrese.</li>
<li>Ievadiet starpnieka portu.</li>
- <li>Generally, you do not need a username and password. If you do, enter the information in the proper fields.</li>
- <li>Choose the <em>Type</em> of proxy you are using, whether HTTP/HTTPS, SOCKS4, or SOCKS5.</li>
- <li>Push the <em>OK</em> button. Vidalia and Tor are now configured to use a proxy to access the rest of the Tor network.</li>
+ <li>Vispārīgā gadījumā lietotājvārds un parole nav nepieciešami. Tomēr ja tie ir vajadzīgi, ievadiet informāciju atbilstīgajos laukos.</li>
+ <li>Izvēlieties izmantotā starpnieka <em>veidu</em>, vai nu HTTP/HTTPS, SOCKS4, vai arī SOCKS5.</li>
+ <li>Nospiediet pogu <em>Labi</em>. Tagad Vidalia un Tor ir nokonfigurēti, lai izmantotu starpnieku Tor pārējā tīkla piekļuvei.</li>
</ol>
<h2 id="frequently-asked-questions">Bieži uzdotie jautājumi</h2>
<p>This section will answer some of the most common questions. If your question is not mentioned here, please send an email to help(a)rt.torproject.org.</p>
@@ -86,26 +86,26 @@
<h4 id="windows-xp">Windows XP</h4>
<ol style="list-style-type: decimal">
<li>Atvērt <em>Mans dators</em></li>
- <li>Click on <em>Tools</em> and choose <em>Folder Options...</em> in the menu</li>
- <li>Click on the <em>View</em> tab</li>
- <li>Uncheck <em>Hide extensions for known file types</em> and click <em>OK</em></li>
+ <li>Noklikšķiniet uz <em>Rīki</em>, un izvēlnē izvēlieties <em>Mapju iespējas...</em></li>
+ <li>Noklikšķiniet uz cilni <em>Skats</em></li>
+ <li>Noņemt atzīmi <em>Hide paplašinājumus extensions for known file types</em> and click <em>OK</em></li>
</ol>
<h4 id="windows-vista">Windows Vista</h4>
<ol style="list-style-type: decimal">
- <li>Open <em>Computer</em></li>
- <li>Click on <em>Organize</em> and choose <em>Folder and search options</em> in the menu</li>
- <li>Click on the <em>View</em> tab</li>
- <li>Uncheck <em>Hide extensions for known file types</em> and click <em>OK</em></li>
+ <li>Atvērt <em>Datoru</em></li>
+ <li>Noklikšķiniet <em>Organizēt</em> , un izvēlnē izvēlieties <em>Mape un meklēšanas papildizvēles </em></li>
+ <li>Noklikšķiniet uz cilni <em>Skats</em></li>
+ <li>Noņemt atzīmi <em>Hide paplašinājumus extensions for known file types</em> and click <em>OK</em></li>
</ol>
<h4 id="windows-7">Windows 7</h4>
<ol style="list-style-type: decimal">
- <li>Open <em>Computer</em></li>
- <li>Click on <em>Organize</em> and choose <em>Folder and search options</em> in the menu</li>
- <li>Click on the <em>View</em> tab</li>
- <li>Uncheck <em>Hide extensions for known file types</em> and click <em>OK</em></li>
+ <li>Atvērt <em>Datoru</em></li>
+ <li>Noklikšķiniet <em>Organizēt</em> , un izvēlnē izvēlieties <em>Mape un meklēšanas papildizvēles </em></li>
+ <li>Noklikšķiniet uz cilni <em>Skats</em></li>
+ <li>Noņemt atzīmi <em>Hide paplašinājumus extensions for known file types</em> and click <em>OK</em></li>
</ol>
<h3 id="vidalia-asks-for-a-password">Vidalia pieprasa paroli</h3>
- <p>You should not have to enter a password when starting Vidalia. If you are prompted for one, you are likely affected by one of these problems:</p>
+ <p>Startējot Vidalia, nav vajadzīgs ievadīt paroli. Ja parole tiek prasīta, tad, ticami, ir kāda no šīm problēmām:</p>
<p><strong>You are already running Vidalia and Tor</strong>: For example, this situation can happen if you installed the Vidalia bundle and now you're trying to run the Tor Browser Bundle. In that case, you will need to close the old Vidalia and Tor before you can run this one.</p>
<p><strong>Vidalia crashed, but left Tor running</strong>: If the dialog that prompts you for a control password has a Reset button, you can click the button and Vidalia will restart Tor with a new random control password. If you do not see a Reset button, or if Vidalia is unable to restart Tor for you; go into your process or task manager, and terminate the Tor process. Then use Vidalia to restart Tor.</p>
<p>Lai uzzinātu vairāk informācijas, skatieties <a href="https://torproject.org/docs/faq.html#VidaliaPassword">FAQ</a> projekta Tor mājas lapā.</p>
1
0
commit 373ab41e740168eb32bc16af19ca7092f228625c
Author: Translation commit bot <translation(a)torproject.org>
Date: Wed Sep 26 08:45:08 2012 +0000
Update translations for tsum
---
lv/short-user-manual_lv_noimg.xhtml | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/lv/short-user-manual_lv_noimg.xhtml b/lv/short-user-manual_lv_noimg.xhtml
index a11ab5e..12f63fe 100644
--- a/lv/short-user-manual_lv_noimg.xhtml
+++ b/lv/short-user-manual_lv_noimg.xhtml
@@ -58,9 +58,9 @@
<p>If your normal Internet connection is working, but Tor still can't connect to the network, try the following; open the Vidalia control panel, click on <em>Message Log</em> and select the <em>Advanced</em> tab. It may be that Tor won't connect because:</p>
<p><strong>Your system clock is off</strong>: Make sure that the date and time on your system is correct, and restart Tor. You may need to synchronize your system clock with an Internet time server.</p>
<p><strong>You are behind a restrictive firewall</strong>: To tell Tor to only try port 80 and port 443, open the Vidalia control panel, click on <em>Settings</em> and <em>Network</em>, and tick the box that says <em>My firewall only lets me connect to certain ports</em>.</p>
- <p><strong>Your anti-virus program is blocking Tor</strong>: Make sure that your anti-virus program is not preventing Tor from making network connections.</p>
+ <p><strong>Jūsu pretvīrusu programma bloķē Tor</strong>: Nodrošiniet to, lai pretvīrusu programma neliegtu Tor izveidot tīkla savienojumus.</p>
<p>If Tor still doesn't work, it's likely that your Internet Service Provider (ISP) is blocking Tor. Very often this can be worked around with <strong>Tor bridges</strong>, hidden relays that aren't as easy to block.</p>
- <p>If you need help with figuring out why Tor can't connect, send an email to help(a)rt.torproject.org and include the relevant parts from the log file.</p>
+ <p>Ja Jums nepieciešama palīdzība, lai saprastu kāpēc Tor nevar izveidot savienojumu, sūtiet e-pasta ziņu angļu valodā uz help(a)rt.torproject.org , un pievienojiet atbilstīgos izvilkumus no žurnāldatnes.</p>
<h3 id="how-to-find-a-bridge">Kā atrast tiltu</h3>
<p>To use a bridge, you will first have to locate one; you can either browse to <a href="https://bridges.torproject.org/">bridges.torproject.org</a>, or you can send an email to bridges(a)torproject.org. If you do send an email, please make sure that you write <strong>get bridges</strong> in the body of the email. Without this, you will not get a reply. Note that you need to send this email from either a gmail.com or a yahoo.com address.</p>
<p>Configuring more than one bridge address will make your Tor connection more stable, in case some of the bridges become unreachable. There is no guarantee that the bridge you are using now will work tomorrow, so you should make a habit of updating your list of bridges every so often.</p>
@@ -70,8 +70,8 @@
<p>If using a bridge does not work, try configuring Tor to use any HTTPS or SOCKS proxy to get access to the Tor network. This means even if Tor is blocked by your local network, open proxies can be safely used to connect to the Tor Network and on to the uncensored Internet.</p>
<p>The steps below assume you have a functional Tor/Vidalia configuration, and you have found a list of HTTPS, SOCKS4, or SOCKS5 proxies.</p>
<ol style="list-style-type: decimal">
- <li>Open the Vidalia control panel, click on <em>Settings</em>.</li>
- <li>Click <em>Network</em>. Select <em>I use a proxy to access the Internet</em>.</li>
+ <li>Atvēriet Vidalia vadības paneli, noklikšķiniet uz <em>Iestatījumi</em>.</li>
+ <li>Noklikšķiniet <em>Tīkls</em>. Izvēlieties <em>Es izmantoju starpnieku, lai piekļūtu internetam</em>.</li>
<li>On the <em>Address</em> line, enter the open proxy address. This can be a hostname or an IP Address.</li>
<li>Ievadiet starpnieka portu.</li>
<li>Generally, you do not need a username and password. If you do, enter the information in the proper fields.</li>
@@ -104,13 +104,13 @@
<li>Click on the <em>View</em> tab</li>
<li>Uncheck <em>Hide extensions for known file types</em> and click <em>OK</em></li>
</ol>
- <h3 id="vidalia-asks-for-a-password">Vidalia asks for a password</h3>
+ <h3 id="vidalia-asks-for-a-password">Vidalia pieprasa paroli</h3>
<p>You should not have to enter a password when starting Vidalia. If you are prompted for one, you are likely affected by one of these problems:</p>
<p><strong>You are already running Vidalia and Tor</strong>: For example, this situation can happen if you installed the Vidalia bundle and now you're trying to run the Tor Browser Bundle. In that case, you will need to close the old Vidalia and Tor before you can run this one.</p>
<p><strong>Vidalia crashed, but left Tor running</strong>: If the dialog that prompts you for a control password has a Reset button, you can click the button and Vidalia will restart Tor with a new random control password. If you do not see a Reset button, or if Vidalia is unable to restart Tor for you; go into your process or task manager, and terminate the Tor process. Then use Vidalia to restart Tor.</p>
- <p>For more information, see the <a href="https://torproject.org/docs/faq.html#VidaliaPassword">FAQ</a> on the Tor Project website.</p>
+ <p>Lai uzzinātu vairāk informācijas, skatieties <a href="https://torproject.org/docs/faq.html#VidaliaPassword">FAQ</a> projekta Tor mājas lapā.</p>
<h3 id="flash-does-not-work">Nestrādā Flash</h3>
- <p>For security reasons, Flash, Java, and other plugins are currently disabled for Tor. Plugins operate independently from Firefox and can perform activity on your computer that ruins your anonymity.</p>
+ <p>Drošības apsvērumu dēļ Flash, Java un citi spraudņi Tor'ā patlaban ir atspējoti. Spraudņu darbību Firefox nekontrolē, un tie uz datorā var veikt darbības, kuras nenosargā anonimitāti.</p>
<p>Most YouTube videos work with HTML5, and it is possible to view these videos over Tor. You need to join the <a href="https://www.youtube.com/html5">HTML5 trial</a> on the YouTube website before you can use the HTML5 player.</p>
<p>Note that the browser will not remember that you joined the trial once you close it, so you will need to re-join the trial the next time you run the Tor Browser Bundle.</p>
<p>Please see the <a href="https://www.torproject.org/torbutton/torbutton-faq.html#noflash">Torbutton FAQ</a> for more information.</p>
1
0

[translation/whisperback_completed] Update translations for whisperback_completed
by translation@torproject.org 25 Sep '12
by translation@torproject.org 25 Sep '12
25 Sep '12
commit 0182fce0e21d2058ac3f9f9b06735af9291362b5
Author: Translation commit bot <translation(a)torproject.org>
Date: Tue Sep 25 23:45:35 2012 +0000
Update translations for whisperback_completed
---
nl/nl.po | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/nl/nl.po b/nl/nl.po
index c79a479..d88f1f2 100644
--- a/nl/nl.po
+++ b/nl/nl.po
@@ -3,20 +3,23 @@
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
+# <ayurveda63(a)gmail.com>, 2012.
# Shondoit Walker <shondoit+transifex(a)gmail.com>, 2012.
+# <therbom(a)gmail.com>, 2012.
+# <unknown365(a)hotmail.com>, 2012.
msgid ""
msgstr ""
"Project-Id-Version: The Tor Project\n"
"Report-Msgid-Bugs-To: https://trac.torproject.org/projects/tor\n"
"POT-Creation-Date: 2012-02-16 22:33+0100\n"
-"PO-Revision-Date: 2012-02-26 21:19+0000\n"
-"Last-Translator: Shondoit Walker <shondoit+transifex(a)gmail.com>\n"
+"PO-Revision-Date: 2012-09-25 23:18+0000\n"
+"Last-Translator: unknown365 <unknown365(a)hotmail.com>\n"
"Language-Team: LANGUAGE <LL(a)li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: nl\n"
-"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. XXX use a better exception
#: ../whisperBack/whisperback.py:63
@@ -157,8 +160,8 @@ msgid "Send feedback in an encrypted mail."
msgstr "Stuur feedback in een versleutelde mail."
#: ../whisperBack/gui.py:405
-msgid "Copyright © 2009-2011 Tails developpers (tails(a)boum.org)"
-msgstr "Copyright © 2009-2011 Tails ontwikkelaars (tails(a)boum.org)"
+msgid "Copyright © 2009-2012 Tails developpers (tails(a)boum.org)"
+msgstr "Copyright © 2009-2012 Tails-ontwikkelaars (tails(a)boum.org)"
#: ../whisperBack/gui.py:406
msgid "Tails developers <tails(a)boum.org>"
@@ -182,8 +185,8 @@ msgid "Bug description"
msgstr "Foutomschrijving"
#: ../data/whisperback.ui.h:3
-msgid "Copyright © 2009-2011 tails(a)boum.org"
-msgstr "Copyright © 2009-2011 tails(a)boum.org"
+msgid "Copyright © 2009-2012 tails(a)boum.org"
+msgstr "Copyright © 2009-2012 tails(a)boum.org"
#: ../data/whisperback.ui.h:4
msgid "Help"
@@ -214,7 +217,7 @@ msgstr "Technische details om bij te voegen"
#: ../data/whisperback.ui.h:12
msgid ""
"WhisperBack - Send feedback in an encrypted mail\n"
-"Copyright (C) 2009-2011 Tails developers <tails(a)boum.org>\n"
+"Copyright (C) 2009-2012 Tails developers <tails(a)boum.org>\n"
"\n"
"This program is free software; you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n"
@@ -228,7 +231,7 @@ msgid ""
"\n"
"You should have received a copy of the GNU General Public License\n"
"along with this program. If not, see <http://www.gnu.org/licenses/>.\n"
-msgstr "WhisperBack - Verstuur feedback in een versleutelde mail\nCopyright (C) 2009-2011 Tails ontwikkelaars <tails(a)boum.org>\n\nDit programma is vrije software; je mag het verspreiden en/of het aanpassen onder de voorwaarden van de GNU General Public License zoals gepubliceerd door de Free Software Foundation; zij het versie 3 van de Licentie, of (naar eigen keuze) enige latere versie.\n\nDit programma is verspreid in de hoop dat het nuttig is, maar ZONDER ENIGE GARANTIE; zonder zelfs de impliciete garantie van\nVERKOOPBAARHEID of GESCHIKTHEID VOOR EEN BEPAALD DOEL. Zie de GNU General Public License voor meer details.\n\nJe zou een kopie ontvangen moeten hebben van de GNU General Public License samen met dit programma. Zo niet, zie <http://www.gnu.org/licenses/>.\n"
+msgstr "WhisperBack - Stuur terugkoppeling in een versleutelde email.\nCopyright (C) 2009-2012 Tails ontwikkelaars <tail(a)boum.org>\n\nDit programma is vrije programmatuur; u kan het verspreiden en/of aanpassen\nonder de voorwaarden van de GNU General Public License zoals gepubliceerd door\nThe Free Software Foundation; ofwel versie 3 van de Licentie, of (naar\nuw keuze) elke latere versie.\n\nDit programma wordt gedistribueerd in de hoop dat het nuttig zal zijn, maar\nZONDER ENIGE GARANTIE; zelfs zonder de impliciete garantie van\nVERKOOPBAARHEID of GESCHIKTHEID VOOR EEN BEPAALD DOEL. Zie de GNU\nGeneral Public License voor meer details.\n\nU heeft een kopie moeten ontvangen van de GNU General Public License samen met dit programma. Zo niet, zie <http://www.gnu.org/licenses/>.\n"
#: ../data/whisperback.ui.h:28
msgid "debugging info"
1
0

[translation/whisperback] Update translations for whisperback
by translation@torproject.org 25 Sep '12
by translation@torproject.org 25 Sep '12
25 Sep '12
commit 3f2f7dc81b823e2395b07b3e8be74d67120245a7
Author: Translation commit bot <translation(a)torproject.org>
Date: Tue Sep 25 23:45:33 2012 +0000
Update translations for whisperback
---
nl/nl.po | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/nl/nl.po b/nl/nl.po
index 0130e99..d88f1f2 100644
--- a/nl/nl.po
+++ b/nl/nl.po
@@ -6,13 +6,14 @@
# <ayurveda63(a)gmail.com>, 2012.
# Shondoit Walker <shondoit+transifex(a)gmail.com>, 2012.
# <therbom(a)gmail.com>, 2012.
+# <unknown365(a)hotmail.com>, 2012.
msgid ""
msgstr ""
"Project-Id-Version: The Tor Project\n"
"Report-Msgid-Bugs-To: https://trac.torproject.org/projects/tor\n"
"POT-Creation-Date: 2012-02-16 22:33+0100\n"
-"PO-Revision-Date: 2012-09-20 21:10+0000\n"
-"Last-Translator: therbom <therbom(a)gmail.com>\n"
+"PO-Revision-Date: 2012-09-25 23:18+0000\n"
+"Last-Translator: unknown365 <unknown365(a)hotmail.com>\n"
"Language-Team: LANGUAGE <LL(a)li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -230,7 +231,7 @@ msgid ""
"\n"
"You should have received a copy of the GNU General Public License\n"
"along with this program. If not, see <http://www.gnu.org/licenses/>.\n"
-msgstr ""
+msgstr "WhisperBack - Stuur terugkoppeling in een versleutelde email.\nCopyright (C) 2009-2012 Tails ontwikkelaars <tail(a)boum.org>\n\nDit programma is vrije programmatuur; u kan het verspreiden en/of aanpassen\nonder de voorwaarden van de GNU General Public License zoals gepubliceerd door\nThe Free Software Foundation; ofwel versie 3 van de Licentie, of (naar\nuw keuze) elke latere versie.\n\nDit programma wordt gedistribueerd in de hoop dat het nuttig zal zijn, maar\nZONDER ENIGE GARANTIE; zelfs zonder de impliciete garantie van\nVERKOOPBAARHEID of GESCHIKTHEID VOOR EEN BEPAALD DOEL. Zie de GNU\nGeneral Public License voor meer details.\n\nU heeft een kopie moeten ontvangen van de GNU General Public License samen met dit programma. Zo niet, zie <http://www.gnu.org/licenses/>.\n"
#: ../data/whisperback.ui.h:28
msgid "debugging info"
1
0
commit 94cf0b247d4e4bb95cf3bd6398ae94060ac35844
Author: Sebastian Baginski <sebthestampede(a)gmail.com>
Date: Sat Sep 15 13:26:49 2012 +0200
test code for torrc classes
---
CMakeLists.txt | 3 +
changes/bug6128 | 2 +
src/CMakeLists.txt | 4 +-
src/tests/CMakeLists.txt | 332 ++++++++++++++++++++++++++
src/tests/TorrcTest.cpp | 589 ++++++++++++++++++++++++++++++++++++++++++++++
src/tests/Torrctest.h | 44 ++++
src/tests/testMain.cpp | 43 ++++
7 files changed, 1016 insertions(+), 1 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 021de50..08a70bc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -115,6 +115,9 @@ if (USE_GEOIP)
include(${CMAKE_SOURCE_DIR}/cmake/FindGeoIP.cmake)
endif(USE_GEOIP)
+## Optional include test sources
+option(BUILD_TESTS "Build test sources" OFF)
+
## Check for system header files
check_include_file("limits.h" HAVE_LIMITS_H)
check_include_file("sys/limits.h" HAVE_SYS_LIMITS_H)
diff --git a/changes/bug6128 b/changes/bug6128
new file mode 100644
index 0000000..f261f06
--- /dev/null
+++ b/changes/bug6128
@@ -0,0 +1,2 @@
+ Internal cleanups and improvements:
+ o Create test code for Vidalia torrc classes. Fixes ticket 6128.
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4a25aac..fefa2c6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -65,4 +65,6 @@ add_subdirectory(common)
add_subdirectory(tools)
add_subdirectory(torcontrol)
add_subdirectory(vidalia)
-
+if (BUILD_TESTS)
+ add_subdirectory(tests)
+endif (BUILD_TESTS)
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
new file mode 100644
index 0000000..1d0bf34
--- /dev/null
+++ b/src/tests/CMakeLists.txt
@@ -0,0 +1,332 @@
+##
+## $Id$
+##
+## This file is part of Vidalia, and is subject to the license terms in the
+## LICENSE file, found in the top level directory of this distribution. If
+## you did not receive the LICENSE file with this file, you may obtain it
+## from the Vidalia source package distributed by the Vidalia Project at
+## http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
+## including this file, may be copied, modified, propagated, or distributed
+## except according to the terms described in the LICENSE file.
+##
+
+add_definitions( -DBUILD_TESTS )
+
+include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/about
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/torrc
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/help/browser
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/log
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/prototypes
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions
+)
+
+## About dialog sources
+set(vidalia_SRCS
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/about/AboutDialog.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/about/LicenseDialog.cpp
+)
+qt4_wrap_cpp(vidalia_SRCS
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/about/AboutDialog.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/about/LicenseDialog.h
+)
+
+## Plugin framework sources
+set(vidalia_SRCS ${vidalia_SRCS}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/PluginEngine.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/PluginWrapper.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/DebugDialog.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/prototypes/HelperProcessPrototype.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/prototypes/TorrcPrototype.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/VidaliaExtensions.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/VidaliaExtensionsInit.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscript_BootstrapStatus.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscript_Circuit.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscript_ControlCommand.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscript_ControlConnection.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscript_ControlMethod.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscript_ControlReply.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscript_ControlSocket.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscript_ReplyLine.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscript_RouterDescriptor.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscript_RouterStatus.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscript_SendCommandEvent.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscript_Stream.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscript_TorControl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscript_TorEvents.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscript_TorProcess.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscript_TorSignal.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscript_VidaliaTab.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscriptshell_ControlConnection.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscriptshell_ControlMethod.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscriptshell_ControlSocket.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscriptshell_TorControl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscriptshell_TorEvents.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscriptshell_TorProcess.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscriptshell_TorSignal.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/extensions/qtscriptshell_VidaliaTab.cpp
+)
+qt4_wrap_cpp(vidalia_SRCS
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/PluginEngine.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/PluginWrapper.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/DebugDialog.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/prototypes/HelperProcessPrototype.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/prototypes/TorrcPrototype.h
+)
+
+## Configuration dialog sources
+set(vidalia_SRCS ${vidalia_SRCS}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/AbstractTorSettings.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/AdvancedPage.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/AppearancePage.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/BridgeUsageDialog.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/ConfigDialog.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/ConfigPageStack.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/DomainValidator.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/ExitPolicy.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/GeneralPage.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/IpValidator.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/Local8BitStringValidator.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/NetworkPage.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/NetworkSettings.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/NicknameValidator.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/Policy.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/PortValidator.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/ServerPage.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/ServerSettings.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/TorrcDialog.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/TorSettings.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/VidaliaSettings.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/VSettings.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/torrc/TorrcParser.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/torrc/Torrc.cpp
+)
+qt4_wrap_cpp(vidalia_SRCS
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/AbstractTorSettings.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/AdvancedPage.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/AppearancePage.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/BridgeUsageDialog.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/ConfigDialog.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/ConfigPage.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/ConfigPageStack.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/DomainValidator.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/GeneralPage.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/Local8BitStringValidator.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/NetworkPage.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/NetworkSettings.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/NicknameValidator.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/PortValidator.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/ServerPage.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/ServerSettings.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/TorrcDialog.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/TorSettings.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/VidaliaSettings.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/VSettings.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/torrc/Torrc.h
+)
+if (USE_MINIUPNPC)
+ include_directories(${MINIUPNPC_INCLUDE_DIR})
+ set(vidalia_SRCS ${vidalia_SRCS}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/UPNPControl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/UPNPControlThread.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/UPNPTestDialog.cpp
+ )
+ qt4_wrap_cpp(vidalia_SRCS
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/UPNPControl.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/UPNPControlThread.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/UPNPTestDialog.h
+ )
+endif(USE_MINIUPNPC)
+
+## Main Vidalia sources (without main.cpp)
+set(vidalia_SRCS ${vidalia_SRCS}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/Vidalia.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/LanguageSupport.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/VTabWidget.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/VAttachButton.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/MainWindow.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/VidaliaWindow.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/VMessageBox.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/ControlPasswordInputDialog.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/VidaliaTab.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/StatusTab.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/HelperProcess.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/FirstRunWizard.cpp
+)
+qt4_wrap_cpp(vidalia_SRCS
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/Vidalia.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/VTabWidget.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/VAttachButton.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/MainWindow.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/VidaliaWindow.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/VMessageBox.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/ControlPasswordInputDialog.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/VidaliaTab.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/StatusTab.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/HelperProcess.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/FirstRunWizard.h
+)
+
+if (USE_MINIUPNPC)
+ qt4_wrap_ui(vidalia_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/UPNPTestDialog.ui)
+endif(USE_MINIUPNPC)
+
+## Specify all the Qt Designer .ui files
+qt4_wrap_ui(vidalia_SRCS
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/ControlPasswordInputDialog.ui
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/StatusTab.ui
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/MainWindow.ui
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/about/AboutDialog.ui
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/about/LicenseDialog.ui
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/AdvancedPage.ui
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/AppearancePage.ui
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/BridgeUsageDialog.ui
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/ConfigDialog.ui
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/GeneralPage.ui
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/NetworkPage.ui
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/ServerPage.ui
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/config/TorrcDialog.ui
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/log/MessageLog.ui
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/help/browser/HelpBrowser.ui
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/NetViewer.ui
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/RouterInfoDialog.ui
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/plugin/DebugDialog.ui
+)
+
+## Add the resource files (icons, etc.)
+qt4_add_resources(vidalia_SRCS
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/res/vidalia.qrc
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/help/content/content.qrc
+ ${CMAKE_CURRENT_BINARY_DIR}/../vidalia/i18n/vidalia_i18n.qrc
+)
+
+## Network map sources
+set(vidalia_SRCS ${vidalia_SRCS}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/CircuitItem.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/CircuitListWidget.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/CountryInfo.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/GeoIpRecord.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/GeoIpResolver.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/NetViewer.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/RouterDescriptorView.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/RouterInfoDialog.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/RouterListItem.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/RouterListWidget.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/StreamItem.cpp
+)
+qt4_wrap_cpp(vidalia_SRCS
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/CircuitListWidget.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/CountryInfo.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/GeoIpResolver.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/NetViewer.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/RouterDescriptorView.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/RouterInfoDialog.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/RouterListWidget.h
+)
+if (USE_MARBLE)
+ set(vidalia_SRCS ${vidalia_SRCS}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/TorMapWidget.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/TorMapWidgetPopupMenu.cpp
+ )
+ qt4_wrap_cpp(vidalia_SRCS
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/TorMapWidget.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/TorMapWidgetPopupMenu.h
+ )
+else(USE_MARBLE)
+ set(vidalia_SRCS ${vidalia_SRCS}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/TorMapImageView.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/ZImageView.cpp
+ )
+ qt4_wrap_cpp(vidalia_SRCS
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/TorMapImageView.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/ZImageView.h
+ )
+endif(USE_MARBLE)
+if (USE_GEOIP)
+ set(vidalia_SRCS ${vidalia_SRCS}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/GeoIpDatabase.cpp
+ )
+ qt4_wrap_cpp(vidalia_SRCS
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/network/GeoIpDatabase.h
+ )
+endif(USE_GEOIP)
+
+## Help browser sources
+set(vidalia_SRCS ${vidalia_SRCS}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/help/browser/HelpBrowser.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/help/browser/HelpTextBrowser.cpp
+)
+qt4_wrap_cpp(vidalia_SRCS
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/help/browser/HelpBrowser.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/help/browser/HelpTextBrowser.h
+)
+
+## Message log sources
+set(vidalia_SRCS ${vidalia_SRCS}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/log/LogFile.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/log/LogHeaderView.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/log/LogMessageColumnDelegate.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/log/LogTreeItem.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/log/LogTreeWidget.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/log/MessageLog.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/log/StatusEventItem.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/log/StatusEventItemDelegate.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/log/StatusEventWidget.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/log/LogFilter.cpp
+)
+qt4_wrap_cpp(vidalia_SRCS
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/log/LogFile.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/log/LogHeaderView.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/log/LogTreeWidget.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/log/MessageLog.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/log/StatusEventItemDelegate.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../vidalia/log/StatusEventWidget.h
+)
+
+
+## Bootstrap test sources
+set(vidalia_SRCS ${vidalia_SRCS}
+ testMain.cpp
+ TorrcTest.cpp
+)
+qt4_wrap_cpp(vidalia_SRCS
+ TorrcTest.h
+)
+
+set(test_BIN VidaliaTestSuite)
+
+add_executable(${test_BIN} ${vidalia_SRCS})
+target_link_libraries(${test_BIN}
+ ${QT_LIBRARIES}
+ ${QT_QTTEST_LIBRARY}
+ common
+ torcontrol
+)
+if (USE_MINIUPNPC)
+ target_link_libraries(${test_BIN} miniupnpc)
+endif(USE_MINIUPNPC)
+if (USE_BREAKPAD)
+ target_link_libraries(${test_BIN} ${BREAKPAD_LIBRARY})
+endif(USE_BREAKPAD)
+if (USE_MARBLE)
+ target_link_libraries(${test_BIN}
+ ${MARBLE_LIBRARIES}
+ ${QT_QTSVG_LIBRARY}
+ )
+endif(USE_MARBLE)
+if (USE_GEOIP)
+ target_link_libraries(${test_BIN} ${GEOIP_LIBRARIES})
+endif(USE_GEOIP)
+
+if (APPLE)
+ target_link_libraries(${test_BIN}
+ "-framework AppKit"
+ iconv
+ )
+endif(APPLE)
diff --git a/src/tests/TorrcTest.cpp b/src/tests/TorrcTest.cpp
new file mode 100644
index 0000000..1e2a026
--- /dev/null
+++ b/src/tests/TorrcTest.cpp
@@ -0,0 +1,589 @@
+/*
+** This file is part of Vidalia, and is subject to the license terms in the
+** LICENSE file, found in the top level directory of this distribution. If you
+** did not receive the LICENSE file with this file, you may obtain it from the
+** Vidalia source package distributed by the Vidalia Project at
+** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
+** including this file, may be copied, modified, propagated, or distributed
+** except according to the terms described in the LICENSE file.
+*/
+
+/*
+** \file TorrcTest.cpp
+** \brief test of torrc handling
+*/
+
+#include "TorrcTest.h"
+#include "TorrcParser.h"
+#include "Torrc.h"
+#include "Vidalia.h"
+#include "MainWindow.h"
+#include <QTimer>
+#include <QEventLoop>
+
+/** Constructor. */
+TorrcTestSuite::TorrcTestSuite(QObject *parent)
+ :QObject(parent)
+{
+
+}
+
+/** Destructor. */
+TorrcTestSuite::~TorrcTestSuite()
+{
+
+}
+
+/** Test TorrcLine class */
+void TorrcTestSuite::testTorrcLine()
+{
+ const int count = 100;
+
+ // test single lined values
+ for (int i=0 ; i<count ; ++i) {
+ const QString content = QString("test_content_%1").arg(i);
+ const QString comment = QString("test_comment_%1").arg(i);
+ TorrcLine tLine(content,comment);
+ QCOMPARE(content, tLine.content());
+ QCOMPARE(comment, tLine.comment());
+ QVERIFY(tLine.isMultilined() == false);
+ tLine.setComment(content);
+ tLine.setContent(comment);
+ QCOMPARE(comment, tLine.content());
+ QCOMPARE(content, tLine.comment());
+ QVERIFY(tLine.isMultilined() == false);
+ }
+
+ // test multilined TorrcLine
+ for (int i=0 ; i<count ; ++i) {
+ const QString content = QString("test\\multiline\\content\\%1\\").arg(i);
+ const QString comment = QString("test\\multiline\\comment\\%1\\").arg(i);
+ TorrcLine tLine(content,comment);
+ QCOMPARE(content, tLine.content());
+ QCOMPARE(comment, tLine.comment());
+ QVERIFY(tLine.isMultilined() == true);
+ tLine.setComment(content);
+ tLine.setContent(comment);
+ QCOMPARE(comment, tLine.content());
+ QCOMPARE(content, tLine.comment());
+ QVERIFY(tLine.isMultilined() == true);
+ }
+}
+
+/** Test parser class */
+void TorrcTestSuite::testTorrcParser()
+{
+ const QString testFilePath("vidalia_test_suite_torrc_file.txt");
+ QFile file(testFilePath);
+ if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
+ QVERIFY(false && "Cannot open test torrc file!");
+ const int optCount = 100;
+ QList< QPair<QString,QString> > testData;
+ // create test file
+ QString content;
+ for (int i=0 ; i<optCount ; ++i) {
+ const QString optName = QString("option_%1 value_%1").arg(i);
+ const QString optComt = QString("#comment_%1").arg(i);
+ content += optName + optComt;
+ testData.append( QPair<QString,QString>(optName,optComt) );
+ if (i<optCount-1)
+ content += "\n";
+ }
+ file.write(content.toAscii());
+ file.close();
+
+ TorrcParser parser;
+ QMap<QString, QPair<QString, TorOpt> > map;
+ QList<TorrcLine*> lines = parser.parse(testFilePath,map);
+ QVERIFY(lines.isEmpty() == false);
+ QCOMPARE(lines.count(), optCount);
+
+ for (int i=0 ; i<optCount ; ++i) {
+ TorrcLine * line = lines.at(i);
+ QVERIFY(line != NULL);
+ QCOMPARE(line->content(), testData[i].first);
+ QCOMPARE(line->comment(), testData[i].second);
+ }
+
+ // verify loaded values (all should be null)
+ QCOMPARE(map.count(), optCount);
+ foreach (QString key, map.keys()) {
+ QString value = map[key].first;
+ TorOpt opt = map[key].second;
+ QVERIFY(value.startsWith("value_"));
+ QVERIFY(opt.isNull());
+ }
+
+ qDeleteAll(lines);
+ QVERIFY( QFile::remove(testFilePath) );
+}
+
+QList<TorOpt> createTestOpts();
+QString createTestValue(TorOpt::OptType);
+QString defaultValue(const QString &);
+
+/** Test main Torrc class */
+void TorrcTestSuite::testTorrc()
+{
+ const QString testFilePath("vidalia_test_suite_torrc_file.txt");
+ QFile file(testFilePath);
+ if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
+ QVERIFY(false && "Cannot open test torrc file!");
+ QList<TorOpt> opts = createTestOpts();
+ QList< QPair<QString,QString> > testData;
+ foreach (const TorOpt &opt, opts) {
+ testData.append( QPair<QString,QString>(opt.name(),createTestValue(opt.type())) );
+ }
+ // create test file with real option names and values
+ QString content;
+ for (int i=0 ; i<testData.count() ; ++i) {
+ const QString optName = testData[i].first + " " + testData[i].second;
+ const QString optComt = QString("#comment_%1").arg(i);
+ content += optName + optComt;
+ if (i<testData.count()-1)
+ content += "\n";
+ }
+ file.write(content.toAscii());
+ file.close();
+
+ TorrcParser parser;
+ QMap<QString, QPair<QString, TorOpt> > map;
+ QList<TorrcLine*> lines = parser.parse(testFilePath,map);
+ QVERIFY(lines.isEmpty() == false);
+ QCOMPARE(lines.count(), testData.count());
+
+ for (int i=0 ; i<testData.count() ; ++i) {
+ TorrcLine * line = lines.at(i);
+ QVERIFY(line != NULL);
+ QCOMPARE(line->content(), QString(testData[i].first + " " + testData[i].second).trimmed());
+ QCOMPARE(line->comment(), QString("#comment_%1").arg(i));
+ }
+
+ // verify loaded values
+ foreach (QString key, map.keys()) {
+ QString value = map[key].first;
+ TorOpt opt = map[key].second;
+ QCOMPARE(value, createTestValue(opt.type()));
+ QVERIFY(opt.isNull() == false);
+ QVERIFY(testData.contains( QPair<QString,QString>(key,value) ));
+ }
+
+ qDeleteAll(lines);
+
+ // test torrc object
+ Torrc torrc(testFilePath);
+ QCOMPARE(torrc.getTorrcPath(), testFilePath);
+ for (int i=0 ; i<testData.count() ; ++i) {
+ // test the data in torrc file
+ QVERIFY(torrc.isValid(testData[i].first, testData[i].second));
+ QStringList values = torrc.value(testData[i].first);
+ if (testData[i].second.isEmpty()==false) {
+ QVERIFY(values.contains(testData[i].second));
+ }
+ // test if clearing a value works ok
+ torrc.clear(QStringList() << testData[i].first);
+ values = torrc.value(testData[i].first);
+ if (testData[i].second.isEmpty()==false) {
+ QVERIFY(values.contains(testData[i].second) == false);
+ }
+ }
+ QVERIFY(torrc.apply(Vidalia::torControl()));
+ // after applying changes, we test the file content
+ QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text));
+ content = file.readAll();
+ file.close();
+ for (int i=0 ; i<testData.count() ; ++i) {
+ QVERIFY(content.contains(testData[i].first) == false);
+ }
+ // test adding values to empty file
+ QVERIFY(QFile::remove(testFilePath));
+ QVERIFY(file.open(QIODevice::WriteOnly | QIODevice::Text));
+ file.write("");
+ file.close();
+ torrc.load(testFilePath);
+ int lastKeyPos = -1; // value for checking if <key, value> pairs are present in the file
+ for (int i=0 ; i<testData.count() ; ++i) {
+ torrc.setValue(testData[i].first,testData[i].second);
+ QVERIFY(torrc.apply(Vidalia::torControl()));
+ QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text));
+ content = file.readAll();
+ file.close();
+ // if value is default for given key, file should not contain the entry
+ if (testData[i].second == defaultValue(testData[i].first)) {
+ QVERIFY(content.contains(testData[i].first)==false);
+ } else {
+ // check if key is in the file, and the value follows
+ QVERIFY(content.contains(testData[i].first));
+ lastKeyPos = content.indexOf(testData[i].first,lastKeyPos+1);
+ int nlPos = content.indexOf("\n",lastKeyPos);
+ if (nlPos == -1)
+ nlPos = content.length();
+ const int valPos = content.indexOf(testData[i].second,lastKeyPos);
+ QVERIFY(valPos != -1);
+ QVERIFY(valPos < nlPos);
+ }
+ }
+ QVERIFY(QFile::remove(testFilePath));
+}
+
+inline bool
+compareValues(const QVariant& var, const QString& value){
+ bool ok = false;
+ const double r = value.toDouble(&ok);
+ if (ok)
+ return qFuzzyCompare(var.toDouble(),r);
+ else
+ return var.toString() == value;
+}
+
+void TorrcTestSuite::testRunningTor()
+{
+ MainWindow * mw = new MainWindow;
+ mw->show();
+ TorControl * torControl = Vidalia::torControl();
+ QVERIFY(torControl);
+
+ // start tor, make sure we wont wait forever
+ QEventLoop loop;
+ QTimer timeoutCheck;
+ timeoutCheck.setSingleShot(true);
+ timeoutCheck.setInterval(120*1000);
+ connect(&timeoutCheck, SIGNAL(timeout()), &loop, SLOT(quit()));
+ connect(torControl, SIGNAL(started()), &loop, SLOT(quit()));
+ QTimer::singleShot(0,mw,SLOT(start()));
+ timeoutCheck.start();
+ loop.exec();
+ qApp->processEvents();
+
+ if (timeoutCheck.isActive()) {
+ vWarn("Tor process started.");
+ QVERIFY(torControl->isConnected());
+ QVERIFY(torControl->isRunning());
+
+ // create test torrc file
+ const QString testFilePath("vidalia_test_suite_torrc_file.txt");
+ QFile file(testFilePath);
+ if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
+ QVERIFY(false && "Cannot open test torrc file!");
+
+ QHash<QString,QString> testData;
+ testData["AccountingMax"] = "0";
+ testData["AllowDotExit"] = "0";
+ testData["AllowInvalidNodes"] = "middle,rendezvous";
+ testData["AllowNonRFC953Hostnames"] = "0";
+ testData["AllowSingleHopCircuits"] = "0";
+ testData["BridgeRecordUsageByCountry"] = "0";
+ testData["CircuitIdleTimeout"] = "3600";
+ testData["CircuitPriorityHalflife"] = "-100.0";
+ testData["ControlPort"] = "9051";
+ testData["CookieAuthentication"] = "0";
+ testData["DataDirectory"] = "C:\\DifferentDataDirectory";
+ testData["PortForwarding"] = "0";
+ testData["ProtocolWarnings"] = "0";
+ testData["User"] = "userid";
+ // data directory should remain unchanged
+ const QString dataDir = torControl->getConf("DataDirectory").toString();
+
+ QString content;
+ foreach (QString key, testData) {
+ content += key + " " + testData[key] + "#comment\n";
+ }
+ file.write(content.toAscii());
+ file.close();
+ Torrc torrc(testFilePath);
+ QVERIFY( torrc.apply(torControl) );
+
+ // check values in running tor instance
+ foreach (QString key, testData) {
+ const QVariant val = torControl->getConf(key);
+ if (key == "DataDirectory"){
+ QCOMPARE(dataDir,val.toString());
+ } else
+ QVERIFY(compareValues(val,testData[key]));
+ }
+ // create new test data, different from current tor values
+ testData.remove("DataDirectory");
+ testData["AccountingMax"] = "1";
+ testData["AllowDotExit"] = "1";
+ testData["AllowInvalidNodes"] = "middle";
+ testData["AllowNonRFC953Hostnames"] = "1";
+ testData["AllowSingleHopCircuits"] = "1";
+ testData["BridgeRecordUsageByCountry"] = "1";
+ testData["CircuitIdleTimeout"] = "900";
+ testData["CircuitPriorityHalflife"] = "-150.0";
+ testData["ControlPort"] = "8974";
+ testData["CookieAuthentication"] = "1";
+ testData["PortForwarding"] = "1";
+ testData["ProtocolWarnings"] = "1";
+ testData["User"] = "u2id";
+
+ // check if values are applied ok
+ QVERIFY( torrc.apply(torControl) );
+ foreach (QString key, testData) {
+ const QVariant val = torControl->getConf(key);
+ QVERIFY(compareValues(val,testData[key]));
+ }
+ QVERIFY(QFile::remove(testFilePath));
+ } else {
+ QVERIFY(false && "Cannot start the tor process!");
+ }
+ mw->deleteLater();
+}
+
+QList<TorOpt>
+createTestOpts()
+{
+ QList<TorOpt> opt;
+ opt << TorOpt("AccountingMax", TorOpt::DataSize, "0");
+ opt << TorOpt("AccountingStart", TorOpt::String, "");
+ opt << TorOpt("Address", TorOpt::String, "");
+ opt << TorOpt("AllowDotExit", TorOpt::Boolean, "0");
+ opt << TorOpt("AllowInvalidNodes", TorOpt::CommaList, "middle,rendezvous");
+ opt << TorOpt("AllowNonRFC953Hostnames", TorOpt::Boolean, "0");
+ opt << TorOpt("AllowSingleHopCircuits", TorOpt::Boolean, "0");
+ opt << TorOpt("AllowSingleHopExits", TorOpt::Boolean, "0");
+ opt << TorOpt("AlternateBridgeAuthority", TorOpt::LineList, "");
+ opt << TorOpt("AlternateDirAuthority", TorOpt::LineList, "");
+ opt << TorOpt("AlternateHSAuthority", TorOpt::LineList, "");
+ opt << TorOpt("AssumeReachable", TorOpt::Boolean, "0");
+ opt << TorOpt("AuthDirBadDir", TorOpt::LineList, "");
+ opt << TorOpt("AuthDirBadExit", TorOpt::LineList, "");
+ opt << TorOpt("AuthDirInvalid", TorOpt::LineList, "");
+ opt << TorOpt("AuthDirReject", TorOpt::LineList, "");
+ opt << TorOpt("AuthDirRejectUnlisted", TorOpt::Boolean, "0");
+ opt << TorOpt("AuthDirListBadDirs", TorOpt::Boolean, "0");
+ opt << TorOpt("AuthDirListBadExits", TorOpt::Boolean, "0");
+ opt << TorOpt("AuthDirMaxServersPerAddr", TorOpt::Integer, "2");
+ opt << TorOpt("AuthDirMaxServersPerAuthAddr", TorOpt::Integer, "5");
+ opt << TorOpt("AuthoritativeDirectory", TorOpt::Boolean, "0");
+ opt << TorOpt("AutomapHostsOnResolve", TorOpt::Boolean, "0");
+ opt << TorOpt("AutomapHostsSuffixes", TorOpt::CommaList, ".onion,.exit");
+ opt << TorOpt("AvoidDiskWrites", TorOpt::Boolean, "0");
+ opt << TorOpt("BandwidthBurst", TorOpt::DataSize, "10485760");
+ opt << TorOpt("BandwidthRate", TorOpt::DataSize, "5242880");
+ opt << TorOpt("BridgeAuthoritativeDir", TorOpt::Boolean, "0");
+ opt << TorOpt("Bridge", TorOpt::LineList, "");
+ opt << TorOpt("BridgePassword", TorOpt::String, "");
+ opt << TorOpt("BridgeRecordUsageByCountry", TorOpt::Boolean, "1");
+ opt << TorOpt("BridgeRelay", TorOpt::Boolean, "0");
+ opt << TorOpt("CellStatistics", TorOpt::Boolean, "0");
+ opt << TorOpt("LearnCircuitBuildTimeout", TorOpt::Boolean, "1");
+ opt << TorOpt("CircuitBuildTimeout", TorOpt::TimeInterval, "0");
+ opt << TorOpt("CircuitIdleTimeout", TorOpt::TimeInterval, "3600");
+ opt << TorOpt("CircuitStreamTimeout", TorOpt::TimeInterval, "0");
+ opt << TorOpt("CircuitPriorityHalflife", TorOpt::Float, "-100.0");
+ opt << TorOpt("ClientDNSRejectInternalAddresses", TorOpt::Boolean, "1");
+ opt << TorOpt("ClientOnly", TorOpt::Boolean, "0");
+ opt << TorOpt("ClientRejectInternalAddresses", TorOpt::Boolean, "1");
+ opt << TorOpt("ClientTransportPlugin", TorOpt::LineList, "");
+ opt << TorOpt("ConsensusParams", TorOpt::String, "");
+ opt << TorOpt("ConnLimit", TorOpt::Integer, "1000");
+ opt << TorOpt("ConnDirectionStatistics", TorOpt::Boolean, "0");
+ opt << TorOpt("ConstrainedSockets", TorOpt::Boolean, "0");
+ opt << TorOpt("ConstrainedSockSize", TorOpt::DataSize, "8192");
+ opt << TorOpt("ContactInfo", TorOpt::String, "");
+ opt << TorOpt("ControlListenAddress", TorOpt::LineList, "");
+ opt << TorOpt("ControlPort", TorOpt::Port, "9051");
+ opt << TorOpt("ControlPortFileGroupReadable", TorOpt::Boolean, "0");
+ opt << TorOpt("ControlPortWriteToFile", TorOpt::Filename, "");
+ opt << TorOpt("ControlSocket", TorOpt::LineList, "");
+ opt << TorOpt("ControlSocketsGroupWritable", TorOpt::Boolean, "0");
+ opt << TorOpt("CookieAuthentication", TorOpt::Boolean, "0");
+ opt << TorOpt("CookieAuthFileGroupReadable", TorOpt::Boolean, "0");
+ opt << TorOpt("CookieAuthFile", TorOpt::String, "");
+ opt << TorOpt("CountPrivateBandwidth", TorOpt::Boolean, "0");
+ opt << TorOpt("DataDirectory", TorOpt::Filename, "");
+ opt << TorOpt("DirAllowPrivateAddresses", TorOpt::Boolean, "0");
+ opt << TorOpt("TestingAuthDirTimeToLearnReachability", TorOpt::TimeInterval, "1800");
+ opt << TorOpt("DirListenAddress", TorOpt::LineList, "");
+ opt << TorOpt("DirPolicy", TorOpt::LineList, "");
+ opt << TorOpt("DirPort", TorOpt::Port, "0");
+ opt << TorOpt("DirPortFrontPage", TorOpt::Filename, "");
+ opt << TorOpt("DirServer", TorOpt::LineList, "");
+ opt << TorOpt("DisableAllSwap", TorOpt::Boolean, "0");
+ opt << TorOpt("DisableIOCP", TorOpt::Boolean, "1");
+ opt << TorOpt("DisableNetwork", TorOpt::Boolean, "0");
+ opt << TorOpt("DNSPort", TorOpt::LineList, "");
+ opt << TorOpt("DNSListenAddress", TorOpt::LineList, "");
+ opt << TorOpt("DownloadExtraInfo", TorOpt::Boolean, "0");
+ opt << TorOpt("EnforceDistinctSubnets", TorOpt::Boolean, "1");
+ opt << TorOpt("EntryNodes", TorOpt::RouterList, "");
+ opt << TorOpt("EntryStatistics", TorOpt::Boolean, "0");
+ opt << TorOpt("TestingEstimatedDescriptorPropagationTime", TorOpt::TimeInterval, "600");
+ opt << TorOpt("ExcludeNodes", TorOpt::RouterList, "");
+ opt << TorOpt("ExcludeExitNodes", TorOpt::RouterList, "");
+ opt << TorOpt("ExcludeSingleHopRelays", TorOpt::Boolean, "1");
+ opt << TorOpt("ExitNodes", TorOpt::RouterList, "");
+ opt << TorOpt("ExitPolicy", TorOpt::LineList, "");
+ opt << TorOpt("ExitPolicyRejectPrivate", TorOpt::Boolean, "1");
+ opt << TorOpt("ExitPortStatistics", TorOpt::Boolean, "0");
+ opt << TorOpt("ExtraInfoStatistics", TorOpt::Boolean, "1");
+ opt << TorOpt("FallbackNetworkstatusFile", TorOpt::Filename, "/usr/local/share/tor/fallback-consensus");
+ opt << TorOpt("FascistFirewall", TorOpt::Boolean, "0");
+ opt << TorOpt("FirewallPorts", TorOpt::CommaList, "");
+ opt << TorOpt("FastFirstHopPK", TorOpt::Boolean, "1");
+ opt << TorOpt("FetchDirInfoEarly", TorOpt::Boolean, "0");
+ opt << TorOpt("FetchDirInfoExtraEarly", TorOpt::Boolean, "0");
+ opt << TorOpt("FetchServerDescriptors", TorOpt::Boolean, "1");
+ opt << TorOpt("FetchHidServDescriptors", TorOpt::Boolean, "1");
+ opt << TorOpt("FetchUselessDescriptors", TorOpt::Boolean, "0");
+ opt << TorOpt("FetchV2Networkstatus", TorOpt::Boolean, "0");
+ opt << TorOpt("GeoIPFile", TorOpt::Filename, "/usr/local/share/tor/geoip");
+ opt << TorOpt("GiveGuardFlagTo_CVE_2011_2768_VulnerableRelays", TorOpt::Boolean, "0");
+ opt << TorOpt("HardwareAccel", TorOpt::Boolean, "0");
+ opt << TorOpt("HeartbeatPeriod", TorOpt::TimeInterval, "21300");
+ opt << TorOpt("AccelName", TorOpt::String, "");
+ opt << TorOpt("AccelDir", TorOpt::Filename, "");
+ opt << TorOpt("HashedControlPassword", TorOpt::String, "");
+ opt << TorOpt("HidServDirectoryV2", TorOpt::Boolean, "1");
+ opt << TorOpt("HiddenServiceDir", TorOpt::Dependant, "");
+ opt << TorOpt("HiddenServiceOptions", TorOpt::Virtual, "");
+ opt << TorOpt("HiddenServicePort", TorOpt::Dependant, "");
+ opt << TorOpt("HiddenServiceVersion", TorOpt::Dependant, "");
+ opt << TorOpt("HiddenServiceAuthorizeClient", TorOpt::Dependant, "");
+ opt << TorOpt("HidServAuth", TorOpt::LineList, "");
+ opt << TorOpt("HSAuthoritativeDir", TorOpt::Boolean, "0");
+ opt << TorOpt("HTTPProxy", TorOpt::String, "");
+ opt << TorOpt("HTTPProxyAuthenticator", TorOpt::String, "");
+ opt << TorOpt("HTTPSProxy", TorOpt::String, "");
+ opt << TorOpt("HTTPSProxyAuthenticator", TorOpt::String, "");
+ opt << TorOpt("ServerTransportPlugin", TorOpt::LineList, "");
+ opt << TorOpt("Socks4Proxy", TorOpt::String, "");
+ opt << TorOpt("Socks5Proxy", TorOpt::String, "");
+ opt << TorOpt("Socks5ProxyUsername", TorOpt::String, "");
+ opt << TorOpt("Socks5ProxyPassword", TorOpt::String, "");
+ opt << TorOpt("KeepalivePeriod", TorOpt::TimeInterval, "300");
+ opt << TorOpt("Log", TorOpt::LineList, "");
+ opt << TorOpt("LogMessageDomains", TorOpt::Boolean, "0");
+ opt << TorOpt("LogTimeGranularity", TorOpt::TimeMsecInterval, "1000");
+ opt << TorOpt("LongLivedPorts", TorOpt::CommaList, "21,22,706,1863,5050,5190,5222,5223,6523,6667,6697,8300");
+ opt << TorOpt("MapAddress", TorOpt::LineList, "");
+ opt << TorOpt("MaxAdvertisedBandwidth", TorOpt::DataSize, "1073741824");
+ opt << TorOpt("MaxCircuitDirtiness", TorOpt::TimeInterval, "600");
+ opt << TorOpt("MaxClientCircuitsPending", TorOpt::Integer, "32");
+ opt << TorOpt("MaxOnionsPending", TorOpt::Integer, "100");
+ opt << TorOpt("MyFamily", TorOpt::String, "");
+ opt << TorOpt("NewCircuitPeriod", TorOpt::TimeInterval, "30");
+ opt << TorOpt("NamingAuthoritativeDirectory", TorOpt::Boolean, "0");
+ opt << TorOpt("NATDListenAddress", TorOpt::LineList, "");
+ opt << TorOpt("NATDPort", TorOpt::LineList, "0");
+ opt << TorOpt("Nickname", TorOpt::String, "");
+ opt << TorOpt("WarnUnsafeSocks", TorOpt::Boolean, "1");
+ opt << TorOpt("NodeFamily", TorOpt::LineList, "");
+ opt << TorOpt("NumCPUs", TorOpt::Integer, "0");
+ opt << TorOpt("NumEntryGuards", TorOpt::Integer, "3");
+ opt << TorOpt("ORListenAddress", TorOpt::LineList, "");
+ opt << TorOpt("ORPort", TorOpt::Port, "0");
+ opt << TorOpt("OutboundBindAddress", TorOpt::String, "");
+ opt << TorOpt("PerConnBWBurst", TorOpt::DataSize, "0");
+ opt << TorOpt("PerConnBWRate", TorOpt::DataSize, "0");
+ opt << TorOpt("PidFile", TorOpt::String, "");
+ opt << TorOpt("TestingTorNetwork", TorOpt::Boolean, "0");
+ opt << TorOpt("OptimisticData", TorOpt::BooleanAuto, "auto");
+ opt << TorOpt("PortForwarding", TorOpt::Boolean, "0");
+ opt << TorOpt("PortForwardingHelper", TorOpt::Filename, "tor-fw-helper");
+ opt << TorOpt("PreferTunneledDirConns", TorOpt::Boolean, "1");
+ opt << TorOpt("ProtocolWarnings", TorOpt::Boolean, "0");
+ opt << TorOpt("PublishServerDescriptor", TorOpt::CommaList, "1");
+ opt << TorOpt("PublishHidServDescriptors", TorOpt::Boolean, "1");
+ opt << TorOpt("ReachableAddresses", TorOpt::LineList, "");
+ opt << TorOpt("ReachableDirAddresses", TorOpt::LineList, "");
+ opt << TorOpt("ReachableORAddresses", TorOpt::LineList, "");
+ opt << TorOpt("RecommendedVersions", TorOpt::LineList, "");
+ opt << TorOpt("RecommendedClientVersions", TorOpt::LineList, "");
+ opt << TorOpt("RecommendedServerVersions", TorOpt::LineList, "");
+ opt << TorOpt("RefuseUnknownExits", TorOpt::BooleanAuto, "auto");
+ opt << TorOpt("RejectPlaintextPorts", TorOpt::CommaList, "");
+ opt << TorOpt("RelayBandwidthBurst", TorOpt::DataSize, "0");
+ opt << TorOpt("RelayBandwidthRate", TorOpt::DataSize, "0");
+ opt << TorOpt("RendPostPeriod", TorOpt::TimeInterval, "3600");
+ opt << TorOpt("RephistTrackTime", TorOpt::TimeInterval, "36000");
+ opt << TorOpt("RunAsDaemon", TorOpt::Boolean, "0");
+ opt << TorOpt("SafeLogging", TorOpt::String, "1");
+ opt << TorOpt("SafeSocks", TorOpt::Boolean, "0");
+ opt << TorOpt("ServerDNSAllowBrokenConfig", TorOpt::Boolean, "1");
+ opt << TorOpt("ServerDNSAllowNonRFC953Hostnames", TorOpt::Boolean, "0");
+ opt << TorOpt("ServerDNSDetectHijacking", TorOpt::Boolean, "1");
+ opt << TorOpt("ServerDNSRandomizeCase", TorOpt::Boolean, "1");
+ opt << TorOpt("ServerDNSResolvConfFile", TorOpt::String, "");
+ opt << TorOpt("ServerDNSSearchDomains", TorOpt::Boolean, "0");
+ opt << TorOpt("ServerDNSTestAddresses", TorOpt::CommaList, "www.google.com,www.mit.edu,www.yahoo.com,www.slashdot.org");
+ opt << TorOpt("ShutdownWaitLength", TorOpt::TimeInterval, "30");
+ opt << TorOpt("SocksListenAddress", TorOpt::LineList, "");
+ opt << TorOpt("SocksPolicy", TorOpt::LineList, "");
+ opt << TorOpt("SocksPort", TorOpt::LineList, "9051");
+ opt << TorOpt("SocksTimeout", TorOpt::TimeInterval, "200");
+ opt << TorOpt("StrictNodes", TorOpt::Boolean, "0");
+ opt << TorOpt("TestSocks", TorOpt::Boolean, "0");
+ opt << TorOpt("TokenBucketRefillInterval", TorOpt::TimeMsecInterval, "100");
+ opt << TorOpt("TrackHostExits", TorOpt::CommaList, "");
+ opt << TorOpt("TrackHostExitsExpire", TorOpt::TimeInterval, "1800");
+ opt << TorOpt("TransListenAddress", TorOpt::LineList, "");
+ opt << TorOpt("TransPort", TorOpt::LineList, "0");
+ opt << TorOpt("TunnelDirConns", TorOpt::Boolean, "1");
+ opt << TorOpt("UpdateBridgesFromAuthority", TorOpt::Boolean, "0");
+ opt << TorOpt("UseBridges", TorOpt::Boolean, "0");
+ opt << TorOpt("UseEntryGuards", TorOpt::Boolean, "1");
+ opt << TorOpt("UseMicrodescriptors", TorOpt::BooleanAuto, "auto");
+ opt << TorOpt("User", TorOpt::String, "");
+ opt << TorOpt("V1AuthoritativeDirectory", TorOpt::Boolean, "0");
+ opt << TorOpt("V2AuthoritativeDirectory", TorOpt::Boolean, "0");
+ opt << TorOpt("V3AuthoritativeDirectory", TorOpt::Boolean, "0");
+ opt << TorOpt("TestingV3AuthInitialVotingInterval", TorOpt::TimeInterval, "1800");
+ opt << TorOpt("TestingV3AuthInitialVoteDelay", TorOpt::TimeInterval, "300");
+ opt << TorOpt("TestingV3AuthInitialDistDelay", TorOpt::TimeInterval, "300");
+ opt << TorOpt("V3AuthVotingInterval", TorOpt::TimeInterval, "3600");
+ opt << TorOpt("V3AuthVoteDelay", TorOpt::TimeInterval, "300");
+ opt << TorOpt("V3AuthDistDelay", TorOpt::TimeInterval, "300");
+ opt << TorOpt("V3AuthNIntervalsValid", TorOpt::Integer, "3");
+ opt << TorOpt("V3AuthUseLegacyKey", TorOpt::Boolean, "0");
+ opt << TorOpt("V3BandwidthsFile", TorOpt::Filename, "");
+ opt << TorOpt("VersioningAuthoritativeDirectory", TorOpt::Boolean, "0");
+ opt << TorOpt("VirtualAddrNetwork", TorOpt::String, "127.192.0.0/10");
+ opt << TorOpt("WarnPlaintextPorts", TorOpt::CommaList, "23,109,110,143");
+ opt << TorOpt("_UseFilteringSSLBufferevents", TorOpt::Boolean, "0");
+ opt << TorOpt("__ReloadTorrcOnSIGHUP", TorOpt::Boolean, "1");
+ opt << TorOpt("__AllDirActionsPrivate", TorOpt::Boolean, "0");
+ opt << TorOpt("__DisablePredictedCircuits", TorOpt::Boolean, "0");
+ opt << TorOpt("__LeaveStreamsUnattached", TorOpt::Boolean, "0");
+ opt << TorOpt("__HashedControlSessionPassword", TorOpt::LineList, "");
+ opt << TorOpt("__OwningControllerProcess", TorOpt::String, "");
+ opt << TorOpt("MinUptimeHidServDirectoryV2", TorOpt::TimeInterval, "1500");
+ opt << TorOpt("VoteOnHidServDirectoriesV2", TorOpt::Boolean, "1");
+ opt << TorOpt("_UsingTestNetworkDefaults", TorOpt::Boolean, "0");
+ return opt;
+}
+
+QString
+createTestValue(TorOpt::OptType type)
+{
+ switch (type) {
+ case TorOpt::TimeInterval: return "32684";
+ case TorOpt::TimeMsecInterval: return "5000";
+ case TorOpt::String: return "test_string";
+ case TorOpt::RouterList: return "";
+ case TorOpt::LineList: return "123 456 789";
+ case TorOpt::Float: return "3.14";
+ case TorOpt::Dependant: return "dep";
+ case TorOpt::Virtual: return "virt";
+ case TorOpt::Filename: return "/usr/share/test/test.txt";
+ case TorOpt::CommaList: return "12,43,521,123";
+ case TorOpt::Boolean: return "1";
+ case TorOpt::BooleanAuto: return "1";
+ case TorOpt::Integer: return "7";
+ case TorOpt::DataSize: return "128";
+ case TorOpt::Port: return "9053";
+ case TorOpt::NIL: return "";
+ }
+}
+
+QString
+defaultValue(const QString& optName)
+{
+ static QList<TorOpt> opts = createTestOpts();
+ foreach (const TorOpt& opt, opts) {
+ if (opt.name() == optName)
+ return opt.defaultValue();
+ }
+ return QString();
+}
diff --git a/src/tests/Torrctest.h b/src/tests/Torrctest.h
new file mode 100644
index 0000000..14bce17
--- /dev/null
+++ b/src/tests/Torrctest.h
@@ -0,0 +1,44 @@
+/*
+** This file is part of Vidalia, and is subject to the license terms in the
+** LICENSE file, found in the top level directory of this distribution. If you
+** did not receive the LICENSE file with this file, you may obtain it from the
+** Vidalia source package distributed by the Vidalia Project at
+** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
+** including this file, may be copied, modified, propagated, or distributed
+** except according to the terms described in the LICENSE file.
+*/
+
+/*
+** \file TorrcTest.h
+** \brief test of torrc file handling
+*/
+
+#ifndef _TORRC_TEST_H
+#define _TORRC_TEST_H
+
+#include <QtTest/QTest>
+
+/** Full torrc test suite. */
+class TorrcTestSuite : public QObject
+{
+ Q_OBJECT
+
+public:
+ /** Constructor. */
+ TorrcTestSuite(QObject * parent = NULL);
+ /** Destructor. */
+ ~TorrcTestSuite();
+
+private slots:
+ /** Test TorrcLine class */
+ void testTorrcLine();
+ /** Test parser class */
+ void testTorrcParser();
+ /** Test main Torrc class */
+ void testTorrc();
+ /** Test with running Tor */
+ void testRunningTor();
+
+};
+
+#endif
diff --git a/src/tests/testMain.cpp b/src/tests/testMain.cpp
new file mode 100644
index 0000000..7632636
--- /dev/null
+++ b/src/tests/testMain.cpp
@@ -0,0 +1,43 @@
+/*
+** This file is part of Vidalia, and is subject to the license terms in the
+** LICENSE file, found in the top level directory of this distribution. If you
+** did not receive the LICENSE file with this file, you may obtain it from the
+** Vidalia source package distributed by the Vidalia Project at
+** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
+** including this file, may be copied, modified, propagated, or distributed
+** except according to the terms described in the LICENSE file.
+*/
+
+/*
+** \file testMain.cpp
+** \brief Main Vidalia entry point for test target
+*/
+
+#include "Vidalia.h"
+#include "stringutil.h"
+#include "TorrcTest.h"
+
+#include <QtTest/QTest>
+
+/** Helper method to run test cases. */
+template<typename T>
+void runTest(){
+ T * t = new T();
+ const int ret = QTest::qExec(t,QApplication::arguments());
+ if( ret != 0 ){
+ vError(QString("%1: test failed!").arg(t->metaObject()->className()));
+ }
+ delete t;
+}
+
+/** Main application entry point. */
+int
+main(int argc, char *argv[])
+{
+ const QStringList args = char_array_to_stringlist(argv+1, argc-1);
+ Vidalia vidalia(args, argc, argv);
+ /* Launch each test class */
+ runTest<TorrcTestSuite>();
+ return 0;
+}
+
1
0

[vidalia-plugins/master] Add sanity checks for bandwidth scheduler
by chiiph@torproject.org 25 Sep '12
by chiiph@torproject.org 25 Sep '12
25 Sep '12
commit a1decc38737c83e579993d8ead1f527ce3a84925
Author: Feroze Naina <ferozenaina(a)gmail.com>
Date: Mon Aug 20 18:56:18 2012 +0530
Add sanity checks for bandwidth scheduler
---
bwscheduler/bwscheduler.js | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/bwscheduler/bwscheduler.js b/bwscheduler/bwscheduler.js
index 2ce553b..03d96c9 100644
--- a/bwscheduler/bwscheduler.js
+++ b/bwscheduler/bwscheduler.js
@@ -156,7 +156,29 @@ var bwscheduler = {
enableApply: function() {
this.btnDiscard.enabled = true;
- this.btnApply.enabled = true;
+ if (this.sanityCheck())
+ this.btnApply.enabled = true;
+ else
+ this.btnApply.enabled = false;
+ },
+
+ sanityCheck: function() {
+ for (var i = 0; i < this.customwidget.length; i++) {
+ if (this.timeStart[i].time > this.timeEnd[i].time) {
+ this.lineError[i].setText("Start Time must be lesser than End Time");
+ this.lineError[i].show();
+ return false;
+ }
+ if (this.cmbUnit[i].currentText == "KB") {
+ if (this.spinRate[i].value > 0 && this.spinRate[i].value < 25) {
+ this.lineError[i].setText("Bandwidth Rate must be atleast 25 KB");
+ this.lineError[i].show();
+ return false;
+ }
+ }
+ }
+
+ return true;
},
enableRemove: function() {
1
0

[vidalia-plugins/master] Add scheduler backend to handle bandwidth limits
by chiiph@torproject.org 25 Sep '12
by chiiph@torproject.org 25 Sep '12
25 Sep '12
commit 5df0403bdac4250ae7891a73c4e802042da00cb8
Author: Feroze Naina <ferozenaina(a)gmail.com>
Date: Sun Aug 19 23:21:54 2012 +0530
Add scheduler backend to handle bandwidth limits
---
bwscheduler/bwscheduler.js | 257 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 257 insertions(+), 0 deletions(-)
diff --git a/bwscheduler/bwscheduler.js b/bwscheduler/bwscheduler.js
new file mode 100644
index 0000000..1f8b754
--- /dev/null
+++ b/bwscheduler/bwscheduler.js
@@ -0,0 +1,257 @@
+importExtension("qt");
+importExtension("qt.core");
+importExtension("qt.gui");
+importExtension("qt.uitools");
+importExtension("qt.network");
+
+var bwscheduler = {
+
+ weekDays : ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],
+
+ start: function() {
+ vdebug("BandwidthScheduler@start");
+
+ var configPath = pluginPath + "/bwscheduler/config.ini";
+ this.settings = new QSettings(configPath, QSettings.NativeFormat);
+
+ this.timer = new QTimer();
+ this.timer['timeout()'].connect(this, this.updateRate);
+ this.timer.start(60000);
+ },
+
+ updateRate: function() {
+ torrc.clear(["BandwidthRate", "BandwidthBurst"]);
+
+ var currentTime = QTime.currentTime();
+ var today = new Date()
+
+ var size = this.settings.beginReadArray("schedules");
+
+ for (var i = 0; i < size; i++) {
+ this.settings.setArrayIndex(i);
+ var day = this.settings.value("cmbDay");
+ var startTime = QTime.fromString(this.settings.value("timeStart"), "hh:mm");
+ var endTime = QTime.fromString(this.settings.value("timeEnd"), "hh:mm");
+ var bwRate = this.settings.value("spinRate");
+ var bwUnit = this.settings.value("cmbUnit");
+
+ if (startTime <= currentTime && currentTime <= endTime) {
+ if (day == "Everyday") {
+ torrc.setValue("BandwidthRate" , bwRate + " " + bwUnit);
+ torrc.setValue("BandwidthBurst" , bwRate + " " + bwUnit);
+ }
+ else if (day == this.weekDays[today.getDay()]) {
+ torrc.setValue("BandwidthRate" , bwRate + " " + bwUnit);
+ torrc.setValue("BandwidthBurst" , bwRate + " " + bwUnit);
+ }
+ }
+ }
+
+ this.settings.endArray();
+ torrc.apply(torControl);
+ },
+
+ updateList: function() {
+ try{
+ for (var i = 0; i < this.customwidget.length; i++) {
+ this.customwidget[i].hide();
+ this.listLayout.removeWidget(this.customwidget[i]);
+ }
+ }
+ catch(err){}
+
+ this.customwidget = new Array();
+ this.grpBox = new Array();
+ this.cmbDay = new Array();
+ this.timeStart = new Array();
+ this.timeEnd = new Array();
+ this.spinRate = new Array();
+ this.cmbUnit = new Array();
+ this.chkRemove = new Array();
+ this.lineError = new Array();
+
+ this.listLayout = this.scrollArea.widget().layout();
+ while(this.listLayout.count() > 1) this.listLayout.takeAt(0);
+
+ var loader = new QUiLoader(this.containerWidget);
+
+ var size = this.settings.beginReadArray("schedules");
+
+ for (var i = 0; i < size; i++) {
+ this.customwidget[i] = loader.load(new QFile(pluginPath + "/bwscheduler/schedulerwidget.ui"));
+ this.grpBox[i] = this.customwidget[i].children()[findWidget(this.customwidget[i], "groupBox")];
+ this.cmbDay[i] = this.grpBox[i].children()[findWidget(this.grpBox[i], "cmbDay")];
+ this.timeStart[i] = this.grpBox[i].children()[findWidget(this.grpBox[i], "timeStart")];
+ this.timeEnd[i] = this.grpBox[i].children()[findWidget(this.grpBox[i], "timeEnd")];
+ this.spinRate[i] = this.grpBox[i].children()[findWidget(this.grpBox[i], "spinRate")];
+ this.cmbUnit[i] = this.grpBox[i].children()[findWidget(this.grpBox[i], "cmbUnit")];
+ this.chkRemove[i] = this.grpBox[i].children()[findWidget(this.grpBox[i], "chkRemove")];
+ this.lineError[i] = this.grpBox[i].children()[findWidget(this.grpBox[i], "lineError")];
+ this.fillDays(this.cmbDay[i]);
+
+ this.settings.setArrayIndex(i);
+ this.cmbDay[i].setCurrentIndex(this.cmbDay[i].findText(this.settings.value("cmbDay")));
+ this.timeStart[i].time = QTime.fromString(this.settings.value("timeStart"), "hh:mm");
+ this.timeEnd[i].time = QTime.fromString(this.settings.value("timeEnd"), "hh:mm");
+ this.spinRate[i].value = this.settings.value("spinRate");
+ this.cmbUnit[i].setCurrentIndex(this.cmbUnit[i].findText(this.settings.value("cmbUnit")));
+
+ this.cmbDay[i]['currentIndexChanged(int)'].connect(this, this.enableApply);
+ this.timeStart[i]['timeChanged(QTime)'].connect(this, this.enableApply);
+ this.timeEnd[i]['timeChanged(QTime)'].connect(this, this.enableApply);
+ this.spinRate[i]['valueChanged(int)'].connect(this, this.enableApply);
+ this.cmbUnit[i]['currentIndexChanged(int)'].connect(this, this.enableApply);
+ this.chkRemove[i]['stateChanged(int)'].connect(this, this.enableRemove);
+
+ this.listLayout.insertWidget(0, this.customwidget[i], 0, 0);
+ }
+
+ this.settings.endArray();
+
+ this.btnApply.enabled = false;
+ this.btnDiscard.enabled = false;
+ },
+
+ applyServices: function() {
+ this.settings.remove("schedules");
+ this.settings.beginWriteArray("schedules");
+ for (var i = 0; i < this.customwidget.length; i++) {
+ this.settings.setArrayIndex(i);
+ this.settings.setValue("cmbDay", this.cmbDay[i].currentText);
+ this.settings.setValue("timeStart", this.timeStart[i].time.toString("hh:mm"));
+ this.settings.setValue("timeEnd", this.timeEnd[i].time.toString("hh:mm"));
+ this.settings.setValue("spinRate", this.spinRate[i].value);
+ this.settings.setValue("cmbUnit", this.cmbUnit[i].currentText);
+ }
+ this.settings.endArray();
+
+ this.updateList();
+ this.btnApply.enabled = false;
+ this.btnDiscard.enabled = false;
+ },
+
+ removeServices: function() {
+ this.settings.remove("schedules");
+ this.settings.beginWriteArray("schedules");
+ var pos = 0;
+ for (var i = 0; i < this.customwidget.length; i++) {
+ if (this.chkRemove[i].checkState() == Qt.Unchecked) {
+ this.settings.setArrayIndex(pos);
+ this.settings.setValue("cmbDay", this.cmbDay[i].currentText);
+ this.settings.setValue("timeStart", this.timeStart[i].time.toString("hh:mm"));
+ this.settings.setValue("timeEnd", this.timeEnd[i].time.toString("hh:mm"));
+ this.settings.setValue("spinRate", this.spinRate[i].value);
+ this.settings.setValue("cmbUnit", this.cmbUnit[i].currentText);
+ pos++;
+ }
+ }
+ this.settings.endArray();
+
+ this.updateList();
+ this.btnRemove.enabled = false;
+ },
+
+ enableApply: function() {
+ this.btnDiscard.enabled = true;
+ this.btnApply.enabled = true;
+ },
+
+ enableRemove: function() {
+ this.btnRemove.enabled = false;
+ for (var i = 0; i < this.customwidget.length; i++) {
+ if (this.chkRemove[i].checkState() == Qt.Checked) {
+ this.btnRemove.enabled = true;
+ break;
+ }
+ }
+ },
+
+ addService: function() {
+ var loader = new QUiLoader(this.containerWidget);
+ this.customwidget.push(loader.load(new QFile(pluginPath + "/bwscheduler/schedulerwidget.ui")));
+ var pos = this.customwidget.length-1;
+
+ this.grpBox[pos] = this.customwidget[pos].children()[findWidget(this.customwidget[pos], "groupBox")];
+ this.cmbDay[pos] = this.grpBox[pos].children()[findWidget(this.grpBox[pos], "cmbDay")];
+ this.timeStart[pos] = this.grpBox[pos].children()[findWidget(this.grpBox[pos], "timeStart")];
+ this.timeEnd[pos] = this.grpBox[pos].children()[findWidget(this.grpBox[pos], "timeEnd")];
+ this.spinRate[pos] = this.grpBox[pos].children()[findWidget(this.grpBox[pos], "spinRate")];
+ this.cmbUnit[pos] = this.grpBox[pos].children()[findWidget(this.grpBox[pos], "cmbUnit")];
+ this.chkRemove[pos] = this.grpBox[pos].children()[findWidget(this.grpBox[pos], "chkRemove")];
+ this.lineError[pos] = this.grpBox[pos].children()[findWidget(this.grpBox[pos], "lineError")];
+ this.fillDays(this.cmbDay[pos]);
+
+ this.cmbDay[pos]['currentIndexChanged(int)'].connect(this, this.enableApply);
+ this.timeStart[pos]['timeChanged(QTime)'].connect(this, this.enableApply);
+ this.timeEnd[pos]['timeChanged(QTime)'].connect(this, this.enableApply);
+ this.spinRate[pos]['valueChanged(int)'].connect(this, this.enableApply);
+ this.chkRemove[pos]['stateChanged(int)'].connect(this, this.enableRemove);
+
+ this.listLayout.insertWidget(0, this.customwidget[pos], 0, 0);
+ },
+
+ fillDays: function(cmbDay) {
+ cmbDay.addItem("Everyday");
+ cmbDay.addItem("Sunday", Qt.Sunday);
+ cmbDay.addItem("Monday", Qt.Monday);
+ cmbDay.addItem("Tuesday", Qt.Tuesday);
+ cmbDay.addItem("Wednesday", Qt.Wednesday);
+ cmbDay.addItem("Thursday", Qt.Thursday);
+ cmbDay.addItem("Friday", Qt.Friday);
+ cmbDay.addItem("Saturday", Qt.Saturday);
+ },
+
+ buildGUI: function() {
+ vdebug("BandwidthScheduler@buildGUI");
+
+ this.tab = new VidaliaTab("Bandwidth Scheduler", "BandwidthScheduler");
+
+ var containerui = new QFile(pluginPath + "/bwscheduler/bwscheduler.ui");
+ var loader = new QUiLoader(this.tab);
+ containerui.open(QIODevice.ReadOnly);
+
+ this.containerwidget = loader.load(containerui);
+
+ var layout = new QVBoxLayout();
+ layout.addWidget(this.containerwidget, 0, Qt.AlignCenter);
+ this.tab.setLayout(layout);
+
+ this.scrollArea = this.containerwidget.children()[findWidget(this.containerwidget, "scrollArea")];
+ if (this.scrollArea == null)
+ return this.tab;
+
+ this.chkEnabled = this.containerwidget.children()[findWidget(this.containerwidget, "chkEnabled")];
+ if (this.chkEnabled == null)
+ return this.tab;
+
+ this.btnAdd = this.containerwidget.children()[findWidget(this.containerwidget, "btnAdd")];
+ if (this.btnAdd == null)
+ return this.tab;
+
+ this.btnRemove = this.containerwidget.children()[findWidget(this.containerwidget, "btnRemove")];
+ if (this.btnRemove == null)
+ return this.tab;
+
+ this.btnApply = this.containerwidget.children()[findWidget(this.containerwidget, "btnApply")];
+ if (this.btnApply == null)
+ return this.tab;
+
+ this.btnDiscard = this.containerwidget.children()[findWidget(this.containerwidget, "btnDiscard")];
+ if (this.btnDiscard == null)
+ return this.tab;
+
+ this.btnAdd['clicked()'].connect(this, this.addService);
+ this.btnRemove['clicked()'].connect(this, this.removeServices);
+ this.btnApply['clicked()'].connect(this, this.applyServices);
+ this.btnDiscard['clicked()'].connect(this, this.updateList);
+
+ this.updateList();
+
+ return this.tab;
+ },
+
+
+ stop: function() {
+ vdebug("Tutorial@stop");
+ },
+};
1
0

25 Sep '12
commit 5558973925b7653c313593d1a86b0d6c04935c2f
Author: Feroze Naina <ferozenaina(a)gmail.com>
Date: Sun Aug 19 23:20:31 2012 +0530
Add UI for bandwidth scheduler plugin
---
bwscheduler/bwscheduler.ui | 177 ++++++++++++++++++++++++++++++++++++++++
bwscheduler/info.xml | 11 +++
bwscheduler/schedulerwidget.ui | 141 ++++++++++++++++++++++++++++++++
3 files changed, 329 insertions(+), 0 deletions(-)
diff --git a/bwscheduler/bwscheduler.ui b/bwscheduler/bwscheduler.ui
new file mode 100644
index 0000000..9b270f6
--- /dev/null
+++ b/bwscheduler/bwscheduler.ui
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>670</width>
+ <height>628</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="2" column="0">
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="0" colspan="6">
+ <widget class="QScrollArea" name="scrollArea">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>600</width>
+ <height>400</height>
+ </size>
+ </property>
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="scrollAreaWidgetContents">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>650</width>
+ <height>537</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>495</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QPushButton" name="btnApply">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Apply</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="5">
+ <widget class="QPushButton" name="btnRemove">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="../../vidalia/src/vidalia/res/vidalia.qrc">
+ <normaloff>:/images/22x22/list-remove.png</normaloff>:/images/22x22/list-remove.png</iconset>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>22</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2" colspan="4">
+ <widget class="QPushButton" name="btnDiscard">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Discard Changes</string>
+ </property>
+ <property name="default">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="4">
+ <widget class="QPushButton" name="btnAdd">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="../../vidalia/src/vidalia/res/vidalia.qrc">
+ <normaloff>:/images/22x22/list-add.png</normaloff>:/images/22x22/list-add.png</iconset>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>22</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="chkEnabled">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Enable Bandwidth Scheduler</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources>
+ <include location="../../vidalia/src/vidalia/res/vidalia.qrc"/>
+ </resources>
+ <connections/>
+</ui>
diff --git a/bwscheduler/info.xml b/bwscheduler/info.xml
new file mode 100644
index 0000000..d3700a4
--- /dev/null
+++ b/bwscheduler/info.xml
@@ -0,0 +1,11 @@
+<VidaliaPlugin>
+ <name>Bandwidth Scheduler</name>
+ <date>30/07/2012</date>
+ <author>feroze</author>
+ <type persistent="true" gui="true" />
+ <files>
+ <file>bwscheduler.js</file>
+ </files>
+ <namespace>bwscheduler</namespace>
+ <icon>:/images/16x16/preferences-system.png</icon>
+</VidaliaPlugin>
diff --git a/bwscheduler/schedulerwidget.ui b/bwscheduler/schedulerwidget.ui
new file mode 100644
index 0000000..7fbaa5e
--- /dev/null
+++ b/bwscheduler/schedulerwidget.ui
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>488</width>
+ <height>208</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>400</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>410</width>
+ <height>190</height>
+ </size>
+ </property>
+ <property name="title">
+ <string/>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="2" column="1">
+ <widget class="QLabel" name="lblStartTime">
+ <property name="text">
+ <string>Start Time</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1">
+ <widget class="QLabel" name="lblBW">
+ <property name="text">
+ <string>Bandwidth</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="2">
+ <widget class="QSpinBox" name="spinRate"/>
+ </item>
+ <item row="4" column="1">
+ <widget class="QLabel" name="lblEndTime">
+ <property name="text">
+ <string>End Time</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="lblDay">
+ <property name="text">
+ <string>Day</string>
+ </property>
+ </widget>
+ </item>
+ <item row="10" column="1" colspan="2">
+ <widget class="QCheckBox" name="chkRemove">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>25</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Mark for removal</string>
+ </property>
+ </widget>
+ </item>
+ <item row="11" column="2">
+ <widget class="QLabel" name="lineError">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="3">
+ <widget class="QComboBox" name="cmbUnit">
+ <item>
+ <property name="text">
+ <string>KB</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>MB</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>GB</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="4" column="2" colspan="2">
+ <widget class="QTimeEdit" name="timeEnd">
+ <property name="displayFormat">
+ <string>HH:mm</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2" colspan="2">
+ <widget class="QTimeEdit" name="timeStart">
+ <property name="displayFormat">
+ <string>HH:mm</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2" colspan="2">
+ <widget class="QComboBox" name="cmbDay"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
1
0

[vidalia-plugins/master] Allow user to enable or disable bandwidth scheduler
by chiiph@torproject.org 25 Sep '12
by chiiph@torproject.org 25 Sep '12
25 Sep '12
commit 025a6f5a0b54adf534ab90fb57be08f2272c3750
Author: Feroze Naina <ferozenaina(a)gmail.com>
Date: Sun Aug 19 23:23:03 2012 +0530
Allow user to enable or disable bandwidth scheduler
---
bwscheduler/bwscheduler.js | 69 +++++++++++++++++++++++++++----------------
bwscheduler/bwscheduler.ui | 4 +-
2 files changed, 45 insertions(+), 28 deletions(-)
diff --git a/bwscheduler/bwscheduler.js b/bwscheduler/bwscheduler.js
index 1f8b754..2ce553b 100644
--- a/bwscheduler/bwscheduler.js
+++ b/bwscheduler/bwscheduler.js
@@ -5,6 +5,7 @@ importExtension("qt.uitools");
importExtension("qt.network");
var bwscheduler = {
+ SETTING_ENABLED: "BandwidthSchedulerEnabled",
weekDays : ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],
@@ -20,35 +21,37 @@ var bwscheduler = {
},
updateRate: function() {
- torrc.clear(["BandwidthRate", "BandwidthBurst"]);
-
- var currentTime = QTime.currentTime();
- var today = new Date()
-
- var size = this.settings.beginReadArray("schedules");
-
- for (var i = 0; i < size; i++) {
- this.settings.setArrayIndex(i);
- var day = this.settings.value("cmbDay");
- var startTime = QTime.fromString(this.settings.value("timeStart"), "hh:mm");
- var endTime = QTime.fromString(this.settings.value("timeEnd"), "hh:mm");
- var bwRate = this.settings.value("spinRate");
- var bwUnit = this.settings.value("cmbUnit");
-
- if (startTime <= currentTime && currentTime <= endTime) {
- if (day == "Everyday") {
- torrc.setValue("BandwidthRate" , bwRate + " " + bwUnit);
- torrc.setValue("BandwidthBurst" , bwRate + " " + bwUnit);
- }
- else if (day == this.weekDays[today.getDay()]) {
- torrc.setValue("BandwidthRate" , bwRate + " " + bwUnit);
- torrc.setValue("BandwidthBurst" , bwRate + " " + bwUnit);
+ if (this.settings.value(this.SETTING_ENABLED) == "true") {
+ torrc.clear(["BandwidthRate", "BandwidthBurst"]);
+
+ var currentTime = QTime.currentTime();
+ var today = new Date()
+
+ var size = this.settings.beginReadArray("schedules");
+
+ for (var i = 0; i < size; i++) {
+ this.settings.setArrayIndex(i);
+ var day = this.settings.value("cmbDay");
+ var startTime = QTime.fromString(this.settings.value("timeStart"), "hh:mm");
+ var endTime = QTime.fromString(this.settings.value("timeEnd"), "hh:mm");
+ var bwRate = this.settings.value("spinRate");
+ var bwUnit = this.settings.value("cmbUnit");
+
+ if (startTime <= currentTime && currentTime <= endTime) {
+ if (day == "Everyday") {
+ torrc.setValue("BandwidthRate" , bwRate + " " + bwUnit);
+ torrc.setValue("BandwidthBurst" , bwRate + " " + bwUnit);
+ }
+ else if (day == this.weekDays[today.getDay()]) {
+ torrc.setValue("BandwidthRate" , bwRate + " " + bwUnit);
+ torrc.setValue("BandwidthBurst" , bwRate + " " + bwUnit);
+ }
}
}
- }
- this.settings.endArray();
- torrc.apply(torControl);
+ this.settings.endArray();
+ torrc.apply(torControl);
+ }
},
updateList: function() {
@@ -240,16 +243,30 @@ var bwscheduler = {
if (this.btnDiscard == null)
return this.tab;
+ this.chkEnabled['stateChanged(int)'].connect(this, this.toggleEnabled);
this.btnAdd['clicked()'].connect(this, this.addService);
this.btnRemove['clicked()'].connect(this, this.removeServices);
this.btnApply['clicked()'].connect(this, this.applyServices);
this.btnDiscard['clicked()'].connect(this, this.updateList);
+ this.chkEnabled.setCheckState((this.settings.value(this.SETTING_ENABLED, "false") == "true")?Qt.Checked:Qt.Unchecked);
+
this.updateList();
return this.tab;
},
+ toggleEnabled: function() {
+ var enableScheduler = (this.chkEnabled.checkState() == Qt.Checked) ? true : false;
+ this.settings.setValue(this.SETTING_ENABLED, enableScheduler.toString());
+ this.scrollArea.setEnabled(enableScheduler);
+ this.btnAdd.setEnabled(enableScheduler);
+
+ if (! enableScheduler) {
+ torrc.clear(["BandwidthRate", "BandwidthBurst"]);
+ torrc.apply(torControl);
+ }
+ },
stop: function() {
vdebug("Tutorial@stop");
diff --git a/bwscheduler/bwscheduler.ui b/bwscheduler/bwscheduler.ui
index 9b270f6..4daf621 100644
--- a/bwscheduler/bwscheduler.ui
+++ b/bwscheduler/bwscheduler.ui
@@ -30,7 +30,7 @@
<item row="1" column="0" colspan="6">
<widget class="QScrollArea" name="scrollArea">
<property name="enabled">
- <bool>true</bool>
+ <bool>false</bool>
</property>
<property name="minimumSize">
<size>
@@ -123,7 +123,7 @@
<item row="0" column="4">
<widget class="QPushButton" name="btnAdd">
<property name="enabled">
- <bool>true</bool>
+ <bool>false</bool>
</property>
<property name="minimumSize">
<size>
1
0

[torbrowser/master] Add mozIThirdPartyUtil.getFirstPartyURI API patch.
by mikeperry@torproject.org 25 Sep '12
by mikeperry@torproject.org 25 Sep '12
25 Sep '12
commit 31f5977ea51d755e758c2846edd6fcb8c8209b7b
Author: Mike Perry <mikeperry-git(a)fscked.org>
Date: Tue Sep 25 14:18:07 2012 -0700
Add mozIThirdPartyUtil.getFirstPartyURI API patch.
---
...d-mozIThirdPartyUtil.getFirstPartyURI-API.patch | 148 ++++++++++++++++++++
1 files changed, 148 insertions(+), 0 deletions(-)
diff --git a/src/current-patches/firefox/alpha/0020-Add-mozIThirdPartyUtil.getFirstPartyURI-API.patch b/src/current-patches/firefox/alpha/0020-Add-mozIThirdPartyUtil.getFirstPartyURI-API.patch
new file mode 100644
index 0000000..d7a24d9
--- /dev/null
+++ b/src/current-patches/firefox/alpha/0020-Add-mozIThirdPartyUtil.getFirstPartyURI-API.patch
@@ -0,0 +1,148 @@
+From e91ad38f3db238eebf2f1cae9383a6f317717bef Mon Sep 17 00:00:00 2001
+From: Mike Perry <mikeperry-git(a)torproject.org>
+Date: Tue, 28 Aug 2012 18:35:33 -0700
+Subject: [PATCH 20/21] Add mozIThirdPartyUtil.getFirstPartyURI API
+
+API allows you to get the url bar URI for a channel or nsIDocument.
+---
+ content/base/src/ThirdPartyUtil.cpp | 52 ++++++++++++++++++++++++++++
+ content/base/src/ThirdPartyUtil.h | 2 +
+ netwerk/base/public/mozIThirdPartyUtil.idl | 21 +++++++++++
+ 3 files changed, 75 insertions(+), 0 deletions(-)
+
+diff --git a/content/base/src/ThirdPartyUtil.cpp b/content/base/src/ThirdPartyUtil.cpp
+index 97a000e..87ffc8a 100644
+--- a/content/base/src/ThirdPartyUtil.cpp
++++ b/content/base/src/ThirdPartyUtil.cpp
+@@ -7,6 +7,9 @@
+ #include "nsIServiceManager.h"
+ #include "nsIHttpChannelInternal.h"
+ #include "nsIDOMWindow.h"
++#include "nsICookiePermission.h"
++#include "nsIDOMDocument.h"
++#include "nsIDocument.h"
+ #include "nsILoadContext.h"
+ #include "nsIPrincipal.h"
+ #include "nsIScriptObjectPrincipal.h"
+@@ -21,6 +24,7 @@ ThirdPartyUtil::Init()
+
+ nsresult rv;
+ mTLDService = do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID, &rv);
++ mCookiePermissions = do_GetService(NS_COOKIEPERMISSION_CONTRACTID);
+ return rv;
+ }
+
+@@ -282,3 +286,51 @@ ThirdPartyUtil::GetBaseDomain(nsIURI* aHostURI,
+
+ return NS_OK;
+ }
++
++NS_IMETHODIMP
++ThirdPartyUtil::GetFirstPartyURI(nsIChannel *aChannel,
++ nsIDocument *aDoc,
++ nsIURI **aOutput)
++{
++ nsresult rv = NS_ERROR_NULL_POINTER;
++
++ if (!aChannel && aDoc) {
++ aChannel = aDoc->GetChannel();
++ }
++
++ // If aChannel is specified or available, use the official route
++ // for sure
++ if (aChannel) {
++ rv = mCookiePermissions->GetOriginatingURI(aChannel, aOutput);
++ }
++
++ // If the channel was missing, closed or broken, try the
++ // window hierarchy directly.
++ //
++ // This might fail to work for first-party loads themselves, but
++ // we don't need this codepath for that case.
++ if (NS_FAILED(rv) && aDoc) {
++ nsCOMPtr<nsIDOMWindow> top;
++ nsCOMPtr<nsIDOMDocument> topDDoc;
++
++ aDoc->GetWindow()->GetTop(getter_AddRefs(top));
++ top->GetDocument(getter_AddRefs(topDDoc));
++
++ nsCOMPtr<nsIDocument> topDoc(do_QueryInterface(topDDoc));
++ *aOutput = topDoc->GetOriginalURI();
++
++ if (*aOutput)
++ rv = NS_OK;
++ }
++
++ // TODO: We could provide a route through the loadgroup + notification
++ // callbacks too, but either channel or document was always available
++ // in the cases where this function was originally needed (the image cache).
++ // The notification callbacks also appear to suffers from the same limitation
++ // as the document path. See nsICookiePermissions.GetOriginatingURI() for
++ // details.
++
++ return rv;
++}
++
++
+diff --git a/content/base/src/ThirdPartyUtil.h b/content/base/src/ThirdPartyUtil.h
+index 269069b..37c30e8 100644
+--- a/content/base/src/ThirdPartyUtil.h
++++ b/content/base/src/ThirdPartyUtil.h
+@@ -9,6 +9,7 @@
+ #include "nsString.h"
+ #include "mozIThirdPartyUtil.h"
+ #include "nsIEffectiveTLDService.h"
++#include "nsICookiePermission.h"
+
+ class nsIURI;
+ class nsIChannel;
+@@ -28,6 +29,7 @@ private:
+ static already_AddRefed<nsIURI> GetURIFromWindow(nsIDOMWindow* aWin);
+
+ nsCOMPtr<nsIEffectiveTLDService> mTLDService;
++ nsCOMPtr<nsICookiePermission> mCookiePermissions;
+ };
+
+ #endif
+diff --git a/netwerk/base/public/mozIThirdPartyUtil.idl b/netwerk/base/public/mozIThirdPartyUtil.idl
+index 578d8db..1869d14 100644
+--- a/netwerk/base/public/mozIThirdPartyUtil.idl
++++ b/netwerk/base/public/mozIThirdPartyUtil.idl
+@@ -7,6 +7,7 @@
+ interface nsIURI;
+ interface nsIDOMWindow;
+ interface nsIChannel;
++interface nsIDocument;
+
+ /**
+ * Utility functions for determining whether a given URI, channel, or window
+@@ -140,6 +141,26 @@ interface mozIThirdPartyUtil : nsISupports
+ * @return the base domain.
+ */
+ AUTF8String getBaseDomain(in nsIURI aHostURI);
++
++
++ /**
++ * getFirstPartyURI
++ *
++ * Obtain the top-level url bar URI for either a channel or a document.
++ * Either parameter may be null (but not both).
++ *
++ * @param aChannel
++ * An arbitrary channel for some content element of a first party
++ * load. Can be null.
++ *
++ * @param aDoc
++ * An arbitrary third party document. Can be null.
++ *
++ * @return the first party url bar URI for the load.
++ */
++ nsIURI getFirstPartyURI(in nsIChannel aChannel,
++ in nsIDocument aDoc);
++
+ };
+
+ %{ C++
+--
+1.7.5.4
+
1
0