<!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>[20677] trunk/WebCore</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/20677">20677</a></dd>
<dt>Author</dt> <dd>bdash</dd>
<dt>Date</dt> <dd>2007-04-03 05:51:55 -0700 (Tue, 03 Apr 2007)</dd>
</dl>
<h3>Log Message</h3>
<pre>2007-04-03 Mitz Pettel <mitz@webkit.org>
Reviewed by Darin.
- fix http://bugs.webkit.org/show_bug.cgi?id=13218
<rdar://problem/5095977>
Reproducible crash after call to window.close()
* manual-tests/stale-currentEvent.html: Added.
* page/EventHandler.cpp:
(WebCore::EventHandler::hoverTimerFired): Instead of faking a mouse event,
just hit-test the last mouse event coordinates and update for hover state
changes. This eliminates the use of currentEvent, which can be a non-mouse
event or even a stale event.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCorepageEventHandlercpp">trunk/WebCore/page/EventHandler.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkWebCoremanualtestsstalecurrentEventhtml">trunk/WebCore/manual-tests/stale-currentEvent.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (20676 => 20677)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2007-04-03 11:24:41 UTC (rev 20676)
+++ trunk/WebCore/ChangeLog        2007-04-03 12:51:55 UTC (rev 20677)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2007-04-03 Mitz Pettel <mitz@webkit.org>
+
+ Reviewed by Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=13218
+ <rdar://problem/5095977>
+ Reproducible crash after call to window.close()
+
+ * manual-tests/stale-currentEvent.html: Added.
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::hoverTimerFired): Instead of faking a mouse event,
+ just hit-test the last mouse event coordinates and update for hover state
+ changes. This eliminates the use of currentEvent, which can be a non-mouse
+ event or even a stale event.
+
</ins><span class="cx"> 2007-04-02 Adele Peterson <adele@apple.com>
</span><span class="cx">
</span><span class="cx"> Reviewed by Maciej.
</span></span></pre></div>
<a id="trunkWebCoremanualtestsstalecurrentEventhtml"></a>
<div class="addfile"><h4>Added: trunk/WebCore/manual-tests/stale-currentEvent.html (0 => 20677)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/manual-tests/stale-currentEvent.html         (rev 0)
+++ trunk/WebCore/manual-tests/stale-currentEvent.html        2007-04-03 12:51:55 UTC (rev 20677)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+<head>
+ <script type="text/javascript">
+ var inner_win;
+
+ function open_inner()
+ {
+ var src = 'data:text/html,<title>Pop up</title><input type="button" value="Close" onclick="opener.closeChild()">';
+ var tp = document.getElementById("theparent");
+ inner_win = window.open(src, 'inner', 'width=200, height=200, left=' + (screenLeft + tp.offsetLeft) + ', top=' + (screenTop + outerHeight - innerHeight + tp.offsetTop));
+ }
+
+ function removeHoverNode()
+ {
+ var tp = document.getElementById("theparent");
+ tp.parentNode.removeChild(tp);
+ setTimeout(reportSuccess, 500);
+ }
+
+ function reportSuccess()
+ {
+ document.body.appendChild(document.createTextNode("SUCCESS"));
+ }
+
+ function closeChild()
+ {
+ inner_win.close();
+ document.body.offsetTop;
+ setTimeout(removeHoverNode, 100);
+ }
+ </script>
+</head>
+<body>
+<p><b>BUG ID:</b> <a href="rdar://problem/5095977">5095997</a> (<a href="http://bugs.webkit.org/show_bug.cgi?id=13218">13218</a>) Reproducible crash after call to window.close()</p>
+
+<p id="test" style="background-color:skyblue; padding:3px;"><b>STEPS TO TEST:</b><br>
+ 1. Click the Open button below. A pop up window will open.<br>
+ 2. In the pop up window, click the Close button, being careful not to
+ move the mouse during and shortly after clicking.
+</p>
+
+<p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b>
+ The black square will be replaced by the word &ldquo;SUCCESS&rdquo; and Safari will not crash.
+</p>
+
+<p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>
+ Safari will crash (the word &ldquo;SUCCESS&rdquo; may appear before the crash).
+</p>
+ <div id='theparent'>
+ <input type="button" value="Open" onclick="open_inner()">
+ <div style="background: black; width: 200px; height:200px">
+ </div>
+ </div>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkWebCorepageEventHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/page/EventHandler.cpp (20676 => 20677)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/page/EventHandler.cpp        2007-04-03 11:24:41 UTC (rev 20676)
+++ trunk/WebCore/page/EventHandler.cpp        2007-04-03 12:51:55 UTC (rev 20677)
</span><span class="lines">@@ -1243,7 +1243,16 @@
</span><span class="cx"> void EventHandler::hoverTimerFired(Timer<EventHandler>*)
</span><span class="cx"> {
</span><span class="cx"> m_hoverTimer.stop();
</span><del>- prepareMouseEvent(HitTestRequest(false, false, true), PlatformMouseEvent(PlatformMouseEvent::currentEvent));
</del><ins>+
+ ASSERT(m_frame);
+ ASSERT(m_frame->document());
+
+ if (RenderObject* renderer = m_frame->renderer()) {
+ IntPoint documentPoint = m_frame->view()->windowToContents(m_currentMousePosition);
+ HitTestResult result(documentPoint);
+ renderer->layer()->hitTest(HitTestRequest(false, false, true), result);
+ m_frame->document()->updateRendering();
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static EventTargetNode* eventTargetNodeForDocument(Document* doc)
</span></span></pre>
</div>
</div>
</body>
</html>