title: Set preferences in the user branch and unset them on uninstall
body: <p>I created a firefox add-on with the following <a href="https://gist.github.com/rubo77/21d03191015fd7e618aa" rel="nofollow noreferrer"><code>lib/main.js</code></a>:</p>
  
  <pre><code>const {Cc,Ci} = require("chrome");
  var pref = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
  pref.setIntPref("network.http.response.timeout", 3600*24);
  </code></pre>
  
  <p>It wasn't accepted with the following reason:</p>
  
  <blockquote>
    <p>Add-ons which change critical settings must revert the changes when disabled or uninstalled. You should also make the changes in the default, rather than the user, branch.</p>
    
    <p>You need to call <code>getDefaultBranch("")</code> on the preferences service, and call the preference methods on the returned object rather than on the preference service directly. </p>
  </blockquote>
  
  <p>To revert a preference back to the default, set by <code>setIntPref()</code>, I found out that I have to do <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIPrefBranch#clearUserPref%28%29" rel="nofollow noreferrer">this</a> on uninstall:</p>
  
  <pre><code>pref.clearUserPref("network.http.response.timeout")
  </code></pre>
  
  <p>This command works fine If I call it in another test-addon. I only have to find out <a href="https://stackoverflow.com/questions/24012750/how-to-implement-a-command-so-it-is-executed-when-the-firefox-addon-is-uninstall">How to implement a command, so it is executed when the firefox-addon is uninstalled?</a></p>
  
  <p>So how do I have to understand these comments? How do I set the preferences in a "user branch"?</p>