<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Iterator loops over key twice after delete"
href="https://bugs.webkit.org/show_bug.cgi?id=149811">149811</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Iterator loops over key twice after delete
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>Product</th>
<td>WebKit
</td>
</tr>
<tr>
<th>Version</th>
<td>WebKit Nightly Build
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>Critical
</td>
</tr>
<tr>
<th>Priority</th>
<td>P2
</td>
</tr>
<tr>
<th>Component</th>
<td>JavaScriptCore
</td>
</tr>
<tr>
<th>Assignee</th>
<td>webkit-unassigned@lists.webkit.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>timon@orawski.com
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=262446" name="attach_262446" title="reproducible test case">attachment 262446</a> <a href="attachment.cgi?id=262446&action=edit" title="reproducible test case">[details]</a></span>
reproducible test case
The following code iterates twice over the key "0" in the object cols - despite it only existing in the object once.
<html>
<head>
<script>
var f = function() {
"use strict";
var cols = {"col":{"title":"&nbsp;","type":"sys","events":[],"name":0,"id":0,"_i":0}};
var len = 0;
var remapcols = ['col'];
for (var i = 0; i < remapcols.length; i++) {
cols[cols[remapcols[i]].name] = cols[remapcols[i]];
delete cols[remapcols[i]];
}
var count = 0;
console.group("object:")
console.log(cols);
console.groupEnd();
console.group("This group should only contain one line");
for (var col2 in cols) { console.log("" + count++ +": Iterating over key: " + col2); }
console.groupEnd();
};
f();</script>
</head>
<body>
Check console log, expected output is a single log entry "0: Iterating over key: 0"
</body>
</html></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>