One set of Mozilla autoconfig rules for both Firefox & Thunderbird

Discussion in 'other software & services' started by TheWindBringeth, Jan 16, 2013.

Thread Status:
Not open for further replies.
  1. TheWindBringeth

    TheWindBringeth Registered Member

    Joined:
    Feb 29, 2012
    Posts:
    2,171
    In case anyone might find this technique useful or have interesting ideas of their own to add (hopefully this still works in the latest versions, I'm using 16.02/WinXP on this machine)...

    1] Close all instances of Firefox and Thunderbird

    2] In Mozilla Firefox installation dir, create \defaults\preferences\autoconfig.js containing:

    Code:
    //
    pref("general.config.obscure_value", 0);
    pref("general.config.filename", "FirefoxCfg.js");
    
    3] In Mozilla Firefox installation dir, create FirefoxCfg.js containing:

    Code:
    //
    try
    {
      // Read config filename pref set by autoconfig.js earlier
      var cfgFile = getPref("general.config.filename");
      
      // Set a context independent pref, I'll demo pref() here
      pref("bogus.pref.common", "I am a common pref");
      
      // Set a context specific pref, I'll demo lockPref() here
      if(cfgFile == "FirefoxCfg.js")
        lockPref("bogus.pref.switched", "I am a Firefox specific pref");
      else if(cfgFile == "ThunderbirdCfg.js")
        lockPref("bogus.pref.switched", "I am a Thunderbird specific pref");
      else throw("Unknown cfgFile value: " + cfgFile);
      
      // Display set prefs
      var msg = "bogus.pref.common=" + getPref("bogus.pref.common")+
                "\nbogus.pref.switched=" + getPref("bogus.pref.switched");
      Components.utils.import("resource://gre/modules/Services.jsm");
      Services.prompt.alert(null, "AutoConfig", msg); 
    }
    catch(e)
    {
      displayError(cfgFile, e);
      throw("");  // Terminate startup, msg is not displayed 
    }
    
    4] In Mozilla Thunderbird installation dir, create \defaults\preferences\autoconfig.js containing:

    Code:
    //
    pref("general.config.obscure_value", 0);
    pref("general.config.filename", "ThunderbirdCfg.js");
    
    5] In Mozilla Thunderbird installation dir, create ThunderbirdCfg.js containing the same code put into FirefoxCfg.js (up above).

    6] Launch Firefox, you should see an alert window popup saying:

    hit OK button and Firefox should launch normally.

    7] Launch Thunderbird, you should see an alert window popup saying:

    hit OK button and Thunderbird should launch normally.

    8] To unwind this demo, close all instances of Firefox and Thunderbird, delete both autoconfig.js files, the FirefoxCfg.js file, and the ThunderbirdCfg.js file.
     
Thread Status:
Not open for further replies.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.