<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[20001] trunk</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/20001">20001</a></dd>
<dt>Author</dt> <dd>bdash</dd>
<dt>Date</dt> <dd>2007-03-06 20:07:42 -0800 (Tue, 06 Mar 2007)</dd>
</dl>

<h3>Log Message</h3>
<pre>2007-03-06  Mark Rowe  &lt;mrowe@apple.com&gt;

        Reviewed by Sam Weinig.

        Fix http://bugs.webkit.org/show_bug.cgi?id=12942
        Bug 12942: ASSERTION FAILURE: qantas.com.au changing selected item in &lt;select&gt; via JS

        Test: fast/dom/select-selectedIndex-bug-12942.html.

        * html/HTMLSelectElement.cpp:
        (WebCore::HTMLSelectElement::recalcListItems): Reset m_lastOnChangeIndex when recalculating list items.
        * html/HTMLSelectElement.h:

2007-03-06  Mark Rowe  &lt;mrowe@apple.com&gt;

        Reviewed by Sam Weinig.

        Test for http://bugs.webkit.org/show_bug.cgi?id=12942
        Bug 12942: ASSERTION FAILURE: qantas.com.au changing selected item in &lt;select&gt; via JS

        * fast/dom/select-selectedIndex-bug-12942-expected.txt: Added.
        * fast/dom/select-selectedIndex-bug-12942.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCorehtmlHTMLSelectElementcpp">trunk/WebCore/html/HTMLSelectElement.cpp</a></li>
<li><a href="#trunkWebCorehtmlHTMLSelectElementh">trunk/WebCore/html/HTMLSelectElement.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomselectselectedIndexbug12942expectedtxt">trunk/LayoutTests/fast/dom/select-selectedIndex-bug-12942-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomselectselectedIndexbug12942html">trunk/LayoutTests/fast/dom/select-selectedIndex-bug-12942.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (20000 => 20001)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2007-03-07 04:05:05 UTC (rev 20000)
+++ trunk/LayoutTests/ChangeLog        2007-03-07 04:07:42 UTC (rev 20001)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2007-03-06  Mark Rowe  &lt;mrowe@apple.com&gt;
+
+        Reviewed by Sam Weinig.
+
+        Test for http://bugs.webkit.org/show_bug.cgi?id=12942
+        Bug 12942: ASSERTION FAILURE: qantas.com.au changing selected item in &lt;select&gt; via JS
+
+        * fast/dom/select-selectedIndex-bug-12942-expected.txt: Added.
+        * fast/dom/select-selectedIndex-bug-12942.html: Added.
+
</ins><span class="cx"> 2007-03-06  Mitz Pettel  &lt;mitz@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Adele.
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomselectselectedIndexbug12942expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/select-selectedIndex-bug-12942-expected.txt (0 => 20001)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/select-selectedIndex-bug-12942-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/select-selectedIndex-bug-12942-expected.txt        2007-03-07 04:07:42 UTC (rev 20001)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+Test for bug 12942
+
+This test has succeeded if it does not crash.
+
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomselectselectedIndexbug12942html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/select-selectedIndex-bug-12942.html (0 => 20001)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/select-selectedIndex-bug-12942.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/select-selectedIndex-bug-12942.html        2007-03-07 04:07:42 UTC (rev 20001)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+    &lt;title&gt;Test for Bug 12942&lt;/title&gt;
+    &lt;script type=&quot;text/javascript&quot;&gt;
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+        window.onload = function() {
+            var select = document.getElementsByTagName('select')[0];
+            select.options[1].selected = true;
+            select.options.length = 1;
+            select.selectedIndex = 0;
+        }
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;h2&gt;Test for &lt;a href='http://bugs.webkit.org/show_bug.cgi?id=12942'&gt;bug 12942&lt;/a&gt;&lt;/h2&gt;
+
+    &lt;p&gt;This test has succeeded if it does not hit an assertion failure.&lt;/p&gt;
+
+    &lt;select&gt;
+        &lt;option&gt;A&lt;/option&gt;
+        &lt;option&gt;B&lt;/option&gt;
+    &lt;/select&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (20000 => 20001)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2007-03-07 04:05:05 UTC (rev 20000)
+++ trunk/WebCore/ChangeLog        2007-03-07 04:07:42 UTC (rev 20001)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2007-03-06  Mark Rowe  &lt;mrowe@apple.com&gt;
+
+        Reviewed by Sam Weinig.
+
+        Fix http://bugs.webkit.org/show_bug.cgi?id=12942
+        Bug 12942: ASSERTION FAILURE: qantas.com.au changing selected item in &lt;select&gt; via JS
+
+        Test: fast/dom/select-selectedIndex-bug-12942.html.
+
+        * html/HTMLSelectElement.cpp:
+        (WebCore::HTMLSelectElement::recalcListItems): Reset m_lastOnChangeIndex when recalculating list items.
+        * html/HTMLSelectElement.h:
+
</ins><span class="cx"> 2007-03-06  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Rubberstamped by Kevin Decker
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLSelectElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLSelectElement.cpp (20000 => 20001)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLSelectElement.cpp        2007-03-07 04:05:05 UTC (rev 20000)
+++ trunk/WebCore/html/HTMLSelectElement.cpp        2007-03-07 04:07:42 UTC (rev 20001)
</span><span class="lines">@@ -520,6 +520,7 @@
</span><span class="cx">                 current = parent-&gt;nextSibling();
</span><span class="cx">         }
</span><span class="cx">     }
</span><ins>+    m_lastOnChangeIndex = -1;
</ins><span class="cx">     m_recalcListItems = false;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLSelectElementh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLSelectElement.h (20000 => 20001)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLSelectElement.h        2007-03-07 04:05:05 UTC (rev 20000)
+++ trunk/WebCore/html/HTMLSelectElement.h        2007-03-07 04:07:42 UTC (rev 20001)
</span><span class="lines">@@ -154,10 +154,10 @@
</span><span class="cx">     int m_size;
</span><span class="cx">     bool m_multiple;
</span><span class="cx">     mutable bool m_recalcListItems;
</span><del>-    int m_lastOnChangeIndex;
-    
</del><ins>+    mutable int m_lastOnChangeIndex;
+
</ins><span class="cx">     int m_activeSelectionAnchorIndex;
</span><del>-    int m_activeSelectionEndIndex;  
</del><ins>+    int m_activeSelectionEndIndex;
</ins><span class="cx">     bool m_activeSelectionState;
</span><span class="cx"> 
</span><span class="cx">     // Instance variables for type-ahead find
</span></span></pre>
</div>
</div>

</body>
</html>