The address of this document is XXX

Both document.URL and location.href pick up the changes (in Firefox 4.0 at least, not tested in other browsers. Beware that history.replaceState() - and presumably history.pushState() - appends stuff to the end of the URL, it seems to be fairly intelligent about overwriting bits that should be overwritten, but you should probably be careful

Behaviour in FF4 on file:// is less permissive than http:// - see comments