Closed Bug 196523 Opened 21 years ago Closed 16 years ago

accessing window.open().document.* causes NS_ERROR_FAILURE in nsIDOMHTMLDocument.domain

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 227263

People

(Reporter: roman, Unassigned)

Details

User-Agent:       Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3a) Gecko/20030211 Phoenix/0.5
Build Identifier: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3a) Gecko/20030211 Phoenix/0.5

<pre>
<script language="javascript1.5">
    function inspect(o, n)
    {
        for (var i in o) {
            document.writeln(n + '.' + i + ': ' + typeof o[i] + ('function' !=
typeof o[i] ? ', ' + o[i] : ''));
        }
    }

    var w = window.open();
    inspect(w.document, 'w.document');
    w.close();
</script>
</pre>

Reproducible: Always

Steps to Reproduce:

Actual Results:  
Error: uncaught exception: [Exception... "Component returned failure code:
0x80004005 (NS_ERROR_FAILURE) [nsIDOMHTMLDocument.domain]"  nsresult:
"0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame ::
file:///web/test/test8.html :: inspect :: line 6"  data: no]


same thing happens in Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.0.0)
Gecko/20020822, but searching for nsIDOMHTMLDocument.domain returned zarro
boogs... am I really the first one to report this, or did I somehow miss the
other reports?
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.
Assignee: rogerl → jst
Status: UNCONFIRMED → NEW
Component: JavaScript Engine → DOM HTML
Ever confirmed: true
OS: FreeBSD → All
QA Contact: pschwartau → desale
Hardware: PC → All
Mass-reassigning bugs.
Assignee: jst → dom_bugs
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.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
Component: DOM: HTML → DOM: Core & HTML
QA Contact: desale → general
Checked in a test for this.
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.