Closed Bug 262981 Opened 20 years ago Closed 20 years ago

typeof on const domConfig property triggers uncaught exception

Categories

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

x86
Windows XP
defect
Not set
minor

Tracking

()

RESOLVED DUPLICATE of bug 226193

People

(Reporter: sandraros, Unassigned)

Details

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910

The following HTML source triggers a systematic error:

<html>
<head>
<title>Bug typeof</title>
<script language="javascript">
<!--
function myDocumentClick( event ) {
alert( typeof( event.currentTarget.domConfig ) ) ;
}
document.onclick = myDocumentClick;
//-->
</script>
</head>
<body>
<br>
</body>
</html>

after the user clicks mouse button anywhere, a popup should be displayed with
the type of the event.currentTarget.domConfig property (javascript debugger
tells it is of type "{const XPComponent}" ), but the following error occurs and
the popup is not displayed:

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:///C:/path/bug_typeof.html :: myDocumentClick :: line 8"  data: no]

The context is : I have written a function to display all properties (at any
depth) of any variable, I use "typeof" to know if the variable is an object or
not. In the first case, I explore its properties. Otherwise, the property value
is displayed.
The core JavaScript 1.5 reference manual does not speak about all variable types
(only string, number, function, object, undefined, boolean), thus Mozilla should
decide what to do.

Expected result :
I hope the solution would be to return a value like "const class" or something
like this (I don't know what is the type of domConfig), instead of an "uncaught
exception". 

Reproducible: Always
Steps to Reproduce:
1.Create HTML as indicated
2.Open the HTML page, and click somewhere


Actual Results:  
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:///C:/path/bug_typeof.html :: myDocumentClick :: line 8"  data: no]

Expected Results:  
typeof operator should have returned a string containing the type of the
property (whatever it is), instead of an uncaught exception.

Workaround : use try and catch to catch the typeof error.
Attached file html to reproduce error (obsolete) —
Comment on attachment 161165 [details]
html to reproduce error

<html>
<head>
<title>Bug typeof</title>
<script language="javascript">
<!--
function myDocumentClick( event ) {
alert( typeof( event.currentTarget.domConfig ) ) ;
}
document.onclick = myDocumentClick;
//-->
</script>
</head>
<body>
<br>
</body>
</html>
Attachment #161165 - Attachment is obsolete: true
Assignee: general → general
Component: JavaScript Engine → DOM
QA Contact: pschwartau → general

*** This bug has been marked as a duplicate of 226193 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: