Uncaught Exception... I have no clue about.

E

Evertjan.

-Lost wrote on 21 dec 2006 in comp.lang.javascript:
s += j + ". " + i + ": " + document + "<br />\n";


document cannot be an array or collection, methinks,
it is reserved for window.document.
 
L

-Lost

Error: uncaught exception: [Exception... "Component returned failure code: 0x80004001
(NS_ERROR_NOT_IMPLEMENTED) [nsIDOM3Document.domConfig]" nsresult: "0x80004001
(NS_ERROR_NOT_IMPLEMENTED)" location: "JS frame ::
file:///D:/sites/_test/js/iterate_document.htm :: <TOP_LEVEL> :: line 15" data: no]

Line 15 being:

s += j + ". " + i + ": " + document + "<br />\n";

All the code:

s = '';
j = 1;
for (i in document)
{
s += j + ". " + i + ": " + document + "<br />\n";
j++;
}

In Mozilla Firefox it prints a nice 136 item long list, but also throws that error up.
Can anyone explain to me what it means and why it popped up?

Many thanks in advance.

-Lost
 
L

-Lost

Evertjan. said:
-Lost wrote on 21 dec 2006 in comp.lang.javascript:
s += j + ". " + i + ": " + document + "<br />\n";


document cannot be an array or collection, methinks,
it is reserved for window.document.


I am no expert, but "document" is an object. The for/in loop can iterate its properties
and methods as such. As a matter of fact an object *is* a collection of named pieces of
data.

The for/in is essentially the same thing as a foreach in PHP.

As a last aside objects in JavaScript double as associative arrays. That is how we can
use things like:

document['lastModified']
window.frames['length']

....instead of document.lastModified or window.frames.length.

The code works, aside from throwing that exception. I have no clue either if it throws it
in the beginning or the end. I just know it throws it.

Thanks for the reply.

-Lost
 
E

Evertjan.

-Lost wrote on 21 dec 2006 in comp.lang.javascript:
Evertjan. said:
-Lost wrote on 21 dec 2006 in comp.lang.javascript:
s += j + ". " + i + ": " + document + "<br />\n";


document cannot be an array or collection, methinks,
it is reserved for window.document.


I am no expert, but "document" is an object. The for/in loop can
iterate its properties and methods as such. As a matter of fact an
object *is* a collection of named pieces of data.

The for/in is essentially the same thing as a foreach in PHP.

As a last aside objects in JavaScript double as associative arrays.
That is how we can use things like:

document['lastModified']
window.frames['length']

...instead of document.lastModified or window.frames.length.

The code works, aside from throwing that exception. I have no clue
either if it throws it in the beginning or the end. I just know it
throws it.

Thanks for the reply.

-Lost


Perhaps you are lost, but I think here you are right.

I [wrongly?] surmized you had redefined document, like:

var document= {}

od

var document= []

If you are still experiencing an error on this line,
perhaps expanding to more lines will narrow down the error location:

s += j;
s += ". ";
s += i;
s += ": ";
s += document;
s += "<br />\n";
 
A

ASM

-Lost a écrit :
Error: uncaught exception: [Exception... (...)
All the code:

s = '';
j = 1;
for (i in document)
{
s += j + ". " + i + ": " + document + "<br />\n";


Probably better with :

s += j + ". " + i + ": " + document[i] + said:
 
L

-Lost

-Lost said:
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004001
(NS_ERROR_NOT_IMPLEMENTED) [nsIDOM3Document.domConfig]" nsresult: "0x80004001
(NS_ERROR_NOT_IMPLEMENTED)" location: "JS frame ::
file:///D:/sites/_test/js/iterate_document.htm :: <TOP_LEVEL> :: line 15" data: no]

Line 15 being:

s += j + ". " + i + ": " + document + "<br />\n";

All the code:

s = '';
j = 1;
for (i in document)
{
s += j + ". " + i + ": " + document + "<br />\n";
j++;
}


Boy, this sure is an old thread. Anyway, I ended up figuring this error out. Whilst
fiddling with assigning Object methods and properties to arrays and objects (just
crunching numbers), I noticed you get similar "property denied" errors on a lot of
interfaces.

For example the XMLHttpRequest Object does not allow direct access to its channel
property; and in another turn nsIDOM3Document.domConfig did not allow access to the
Document object's domConfig property.

By simply testing for these you can avoid the error (if you are a stickler).

for (i in document)
{
if (i != 'domConfig')
{
// do something with i, document
}
}

The same holds true for the XMLHttpRequest. Test against 'channel', and you alleviate the
error.

No clue what purpose this serves, if any.

-Lost
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top