code: function(api, id) {
    if(!api) {
      throw new Error('WebStorage not available.');
    }
  
    // get the existing entry
    var rval = api.getItem(id);
  
    /* Note: We check api.init because we can't do (api == localStorage)
      on IE because of "Class doesn't support Automation" exception. Only
      the flash api has an init method so this works too, but we need a
      better solution in the future. */
  
    // flash returns item wrapped in an object, handle special case
    if(api.init) {
      if(rval.rval === null) {
        if(rval.error) {
          var error = new Error(rval.error.message);
          error.id = rval.error.id;
          error.name = rval.error.name;
          throw error;
        }
        // no error, but also no item
        rval = null;
      } else {
        rval = rval.rval;
      }
    }
  
    // handle decoding
    if(rval !== null) {
      // base64-decode and json-decode data
      rval = JSON.parse(util.decode64(rval));
    }
  
    return rval;
  }
docs: Gets a storage object.
  
  @param api the storage interface.
  @param id the storage ID to use.
  
  @return the storage object entry or null if none exists.