You're getting the domain of a document which has the URL "about:blank". This URL has no domain; not sure whether we should be throwing.. In any case, this is not JS engine -- JS has no such thing as documents or domains; it deals with things like strings, objects, etc.
I've just seen this problem too, what I'm doing is: mywindow = window.open('', myname); if (mywindow.document.domain ... The Gecko DOM doco states that if the domain can't be determined, document.domain should be empty.
This got fixed in bug 227263, and since then the domain for the new window is the opener's domain anyway, not about:blank.
Checked in a test for this.