title: "sessionstore-state-read" observer not working
body: <p>Im currently making a firefox extension that will let you choose what tabs you want to reopen after startup, instead of opening everything (it opens about:sessionrestore page). My JS code looks like this:</p>
  
  <p><strong>Edit: code updated with working version</strong></p>
  
  <p>chrome.manifest</p>
  
  <pre><code>component {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} components/myextension.js
  contract @example.com/MyExtension;1 {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
  category profile-after-change MyExtension @example.com/MyExtension;1
  </code></pre>
  
  <p>components/myextension.js</p>
  
  <pre><code>Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
  const CI = Components.interfaces, CC = Components.classes, CR = Components.results;
  
  // class declaration
  function MyExtension () {}
  
  MyExtension.prototype = {
  
      classDescription: "My Firefox Extension",
      classID:          Components.ID("{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"),
      contractID:       "@example.com/MyExtension;1",
      QueryInterface: XPCOMUtils.generateQI([CI.nsIObserver]),
  
      // add to category manager
      _xpcom_categories: [{
          category: "profile-after-change"
      }],
  
      observe: function(aSubject, aTopic, aData) 
      {
          var obs = CC["@mozilla.org/observer-service;1"].getService(CI.nsIObserverService);
  
          switch (aTopic) 
          {
              case "profile-after-change":
                  obs.addObserver(this, "sessionstore-state-read", false);
                  break;
              case "sessionstore-state-read":
                  aSubject.QueryInterface(CI.nsISupportsString);
                  let newData = { windows: [{ tabs: [{ entries: [{
                    url: "about:sessionrestore",
                    formdata: { "#sessionData": aSubject.data }
                  }] }] }] };
                  aSubject.data = JSON.stringify(newData);
                  break;
              default:
                  throw Components.Exception("Unknown topic: " + aTopic);
          }
      }
  };
  
  if (XPCOMUtils.generateNSGetFactory)  
      var NSGetFactory = XPCOMUtils.generateNSGetFactory([EmbarrassedObserver]); 
  else  
      var NSGetModule = XPCOMUtils.generateNSGetModule([EmbarrassedObserver]); 
  </code></pre>
  
  <p>It works fine with sessionstore-state-write (commented lines), but i want to do it with the sessionstore-state-read event, cuz i dont want to edit what it writes to the disk. The problem is, when i change to the read event, my observer stops working. My guess is i register the observer too late (after the session is read), so i tried to register it as soon as possible (when the extension is first loaded, insted of window load event), but it still wont work. Any idea how to get it working?</p>