To use the load-spec system on a datum, cast the datum with the load_spec constructor, like this:

var spec = load_spec(thing);

You can now use load-spec accessors on the object to retrieve its properties without necessarily knowing its datatype. For example:

var uri = load_spec_uri(spec); // returns an nsIURI
var uri_string = load_spec_uri_string(spec); // returns a string
var title = load_spec_title(spec);

Occasionally, you may need to get the original datum out of a load spec.