[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r15079: Woops. Turns out the two startup mechanisms were fighting. (in torbutton/trunk/src: chrome/content components defaults/preferences)



Author: mikeperry
Date: 2008-06-09 01:51:39 -0400 (Mon, 09 Jun 2008)
New Revision: 15079

Modified:
   torbutton/trunk/src/chrome/content/torbutton.js
   torbutton/trunk/src/components/crash-observer.js
   torbutton/trunk/src/defaults/preferences/preferences.js
Log:

Woops. Turns out the two startup mechanisms were fighting.



Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js	2008-06-09 05:21:07 UTC (rev 15078)
+++ torbutton/trunk/src/chrome/content/torbutton.js	2008-06-09 05:51:39 UTC (rev 15079)
@@ -111,12 +111,17 @@
                     m_tb_prefs.setIntPref("network.cookie.lifetimePolicy", 2); 
                 }
                 break;
-            
+
             case "extensions.torbutton.crashed":
                 // can we say ghetto hack, boys and girls?
                 torbutton_crash_recover();
                 break;
 
+            case "extensions.torbutton.noncrashed":
+               // can we say ghetto hack, boys and girls?
+               torbutton_set_initial_state();
+               break;
+
             case "extensions.torbutton.set_uagent":
                 // If the user turns off the pref, reset their user agent to
                 // vanilla
@@ -1811,21 +1816,27 @@
     torbutton_http_observer.register();
 }
 
+function torbutton_set_initial_state() {
+    if(m_tb_prefs.getBoolPref("extensions.torbutton.noncrashed")) {
+        var startup_state = m_tb_prefs.getIntPref("extensions.torbutton.startup_state");
+        
+        torbutton_log(3, "Setting inital state to: "+startup_state);
+
+        if(startup_state == 0) {
+            torbutton_conditional_set(false); // must be boolean
+        } else if(startup_state == 1) {
+            torbutton_conditional_set(true);
+        } // 2 means leave it as it was
+
+        m_tb_prefs.setBoolPref("extensions.torbutton.noncrashed", false);
+    }
+}
+
 function torbutton_do_onetime_startup()
 {
     if(m_tb_prefs.getBoolPref("extensions.torbutton.startup")) {
         torbutton_do_main_window_startup();
         m_tb_prefs.setBoolPref("extensions.torbutton.startup", false);
-
-        if(!m_tb_prefs.getBoolPref("extensions.torbutton.crashed")) {
-            var startup_state = m_tb_pref.getIntPref("extensions.torbutton.startup_state");
-
-            if(startup_state == 0) {
-                torbutton_conditional_set(false); // must be boolean
-            } else if(startup_state == 1) {
-                torbutton_conditional_set(true);
-            } // 2 means leave it as it was
-        }
     }
 }
 

Modified: torbutton/trunk/src/components/crash-observer.js
===================================================================
--- torbutton/trunk/src/components/crash-observer.js	2008-06-09 05:21:07 UTC (rev 15078)
+++ torbutton/trunk/src/components/crash-observer.js	2008-06-09 05:51:39 UTC (rev 15079)
@@ -126,8 +126,13 @@
     // must be hacked around
     dump("new doRestore\n");
     this.logger.log(3, "Got doRestore");
-    if((ret = this._store().doRestore()) && this._startup) {
-        this._prefs.setBoolPref("extensions.torbutton.crashed", true);
+    ret = this._store().doRestore();
+    if(this._startup) {
+        if(ret) {
+           this._prefs.setBoolPref("extensions.torbutton.crashed", true);
+        } else {
+           this._prefs.setBoolPref("extensions.torbutton.noncrashed", true);
+        }
     } 
     this._startup = false;
     return ret;

Modified: torbutton/trunk/src/defaults/preferences/preferences.js
===================================================================
--- torbutton/trunk/src/defaults/preferences/preferences.js	2008-06-09 05:21:07 UTC (rev 15078)
+++ torbutton/trunk/src/defaults/preferences/preferences.js	2008-06-09 05:51:39 UTC (rev 15079)
@@ -56,6 +56,7 @@
 pref("extensions.torbutton.tor_enabled",false);
 pref("extensions.torbutton.startup",false);
 pref("extensions.torbutton.crashed",false);
+pref("extensions.torbutton.noncrashed",false);
 pref("extensions.torbutton.block_cert_dialogs",false);
 pref("extensions.torbutton.asked_ca_disable",false);
 pref("extensions.torbutton.warned_ff3",false);