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

RESOLVED DUPLICATE of bug 227263

Status

()

Core
DOM: Core & HTML
RESOLVED DUPLICATE of bug 227263
15 years ago
9 years ago

People

(Reporter: Roman Neuhauser, Unassigned)

Tracking

Trunk
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

15 years ago
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

Comment 3

14 years ago
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
Last Resolved: 9 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 227263

Updated

9 years ago
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.