Closed Bug 49213 Opened 24 years ago Closed 24 years ago

with statement failure

Categories

(Core :: JavaScript Engine, defect, P3)

x86
Windows NT
defect

Tracking

()

VERIFIED DUPLICATE of bug 38215

People

(Reporter: bugzilla, Assigned: brendan)

Details

Found an instance in which the with statement fails to operate correctly.  
Given the following page:

<html>

<head>
<title>JavaScript with text</title>
<script type="text/javascript">
<!--
function with_test() {
  alert('image src is ' + document.images['wait'].src);
  alert('image src length is ' + document.images['wait'].src.length);
  with (document.images['wait']) {
    alert('image src is ' + src);
    alert('image src length is ' + src.length);
  }
}
// -->
</script>
</head>

<body>
<img src="mozilla.jpg" name=wait>
<form action="#">
<input type=button onClick="with_test()" value="Test">
</form>
</body>

</html>

When with_test is called the first two alert statements will work fine and the 
next two within the with { } statement will both fail with the message "src is 
not defined".
Sending to Brendan because this is so similar to bug 38215.
Is it in fact a duplicate?
Assignee: rogerl → brendan
This is the same class of bugs as 38215, and could be combined.  Apparently, the
src property of image objects (and only that property) is handled only by the
underlying C++ object's GetProperty routine, which uses an inefficient string
compare to specialize its behavior for "src".  This is the same raw deal as in
bug 38215, just for image.src rather than for location.href.

There are probably other specific bugs of this class.  I would say let's combine
bugs under the general class "DOM must use resolve, not getProperty, to be lazy"
(or similar words).

/be
Status: UNCONFIRMED → NEW
Ever confirmed: true

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