Closed Bug 283448 Opened 19 years ago Closed 19 years ago

JS exception on input.value="" in keypress handler

Categories

(Firefox :: General, defect)

1.0 Branch
x86
Linux
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 236791

People

(Reporter: porton, Assigned: bugzilla)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.5) Gecko/20041111 Firefox/1.0 (Debian package 1.0-2)
Build Identifier: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.5) Gecko/20041111 Firefox/1.0 (Debian package 1.0-2)

When I type something and then press Enter in the entry in the attached HTML
file, JS console shows an error (an exception). It is a bug in Firefox.

Reproducible: Always

Steps to Reproduce:
1. Open the attached HTML file.
2. Type "xxx" in the entry.
3. Press Enter.
4. View JS console.
Actual Results:  
Error: [Exception... "'Permission denied to get property
XULElement.selectedIndex' when calling method:
[nsIAutoCompletePopup::selectedIndex]"  nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame ::
file:///home/porton/t/x.html :: entry_on_keypress :: line 11"  data: no]
Source File: file:///home/porton/t/x.html
Line: 11

Expected Results:  
No error message.

<html>
<head>
<title>Test</title>
<meta http-equiv='Content-Script-Type" content='text/javascript' />
<script type='text/javascript'>
function eat() {
  document.getElementById('entry').value = "";
}
function entry_on_keypress(e) {
  if(e.keyCode==10 || e.keyCode==13) {
    eat();
    //e.preventDefault();
  }
}
</script>
</head>
<body onload="document.getElementById('entry').onkeypress=entry_on_keypress">
<p><input type='text' id='entry' /></p>
<!--p><input type='button' onclick='eat()' /></p-->
</body>
</html>
The bug found in Firefox 1.0.
Version: unspecified → 1.0 Branch
A trivial bugzilla search quickly turns up bug 240221.

*** This bug has been marked as a duplicate of 236791 ***
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
v.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.