<!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>[24004] trunk</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/24004">24004</a></dd>
<dt>Author</dt> <dd>bdash</dd>
<dt>Date</dt> <dd>2007-07-04 23:08:56 -0700 (Wed, 04 Jul 2007)</dd>
</dl>

<h3>Log Message</h3>
<pre>2007-07-04  Matt Perry  &lt;mpComplete@gmail.com&gt;

        Fix for http://bugs.webkit.org/show_bug.cgi?id=13400
        Bug 13400: REGRESSION (r20809-20814): No back entry created for navigations created by assigning to document.location
        &lt;rdar://problem/5153025&gt;

        Treat userGesture as always true for setLocation, forcing a back/forward
        entry to be created.

        * bindings/js/JSHTMLDocumentCustom.cpp:
        (WebCore::JSHTMLDocument::setLocation):

2007-07-04  Matt Perry  &lt;mpComplete@gmail.com&gt;

        Test for http://bugs.webkit.org/show_bug.cgi?id=13400
        Bug 13400: REGRESSION (r20809-20814): No back entry created for navigations created by assigning to document.location
        &lt;rdar://problem/5153025&gt;

        Test that assigning to document.location in various ways adds an
        item to the back/forward list.

        * http/tests/navigation/document-location-click-expected.txt: Added.
        * http/tests/navigation/document-location-click-timeout-expected.txt: Added.
        * http/tests/navigation/document-location-click-timeout.html: Added.
        * http/tests/navigation/document-location-click.html: Added.
        * http/tests/navigation/document-location-mouseover-expected.txt: Added.
        * http/tests/navigation/document-location-mouseover.html: Added.
        * http/tests/navigation/document-location-onload-expected.txt: Added.
        * http/tests/navigation/document-location-onload.html: Added.
        * http/tests/navigation/resources/document-location.js: 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="#trunkWebCorebindingsjsJSHTMLDocumentCustomcpp">trunk/WebCore/bindings/js/JSHTMLDocumentCustom.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestsnavigationdocumentlocationclickexpectedtxt">trunk/LayoutTests/http/tests/navigation/document-location-click-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsnavigationdocumentlocationclicktimeoutexpectedtxt">trunk/LayoutTests/http/tests/navigation/document-location-click-timeout-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsnavigationdocumentlocationclicktimeouthtml">trunk/LayoutTests/http/tests/navigation/document-location-click-timeout.html</a></li>
<li><a href="#trunkLayoutTestshttptestsnavigationdocumentlocationclickhtml">trunk/LayoutTests/http/tests/navigation/document-location-click.html</a></li>
<li><a href="#trunkLayoutTestshttptestsnavigationdocumentlocationmouseoverexpectedtxt">trunk/LayoutTests/http/tests/navigation/document-location-mouseover-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsnavigationdocumentlocationmouseoverhtml">trunk/LayoutTests/http/tests/navigation/document-location-mouseover.html</a></li>
<li><a href="#trunkLayoutTestshttptestsnavigationdocumentlocationonloadexpectedtxt">trunk/LayoutTests/http/tests/navigation/document-location-onload-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsnavigationdocumentlocationonloadhtml">trunk/LayoutTests/http/tests/navigation/document-location-onload.html</a></li>
<li><a href="#trunkLayoutTestshttptestsnavigationresourcesdocumentlocationjs">trunk/LayoutTests/http/tests/navigation/resources/document-location.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (24003 => 24004)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2007-07-05 06:04:56 UTC (rev 24003)
+++ trunk/LayoutTests/ChangeLog        2007-07-05 06:08:56 UTC (rev 24004)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2007-07-04  Matt Perry  &lt;mpComplete@gmail.com&gt;
+
+        Test for http://bugs.webkit.org/show_bug.cgi?id=13400
+        Bug 13400: REGRESSION (r20809-20814): No back entry created for navigations created by assigning to document.location
+        &lt;rdar://problem/5153025&gt;
+
+        Test that assigning to document.location in various ways adds an
+        item to the back/forward list.
+
+        * http/tests/navigation/document-location-click-expected.txt: Added.
+        * http/tests/navigation/document-location-click-timeout-expected.txt: Added.
+        * http/tests/navigation/document-location-click-timeout.html: Added.
+        * http/tests/navigation/document-location-click.html: Added.
+        * http/tests/navigation/document-location-mouseover-expected.txt: Added.
+        * http/tests/navigation/document-location-mouseover.html: Added.
+        * http/tests/navigation/document-location-onload-expected.txt: Added.
+        * http/tests/navigation/document-location-onload.html: Added.
+        * http/tests/navigation/resources/document-location.js: Added.
+
</ins><span class="cx"> 2007-07-04  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         - take out infinity tests from the test for bug 5292262 (see below) for now since they
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsnavigationdocumentlocationclickexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/navigation/document-location-click-expected.txt (0 => 24004)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/navigation/document-location-click-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/document-location-click-expected.txt        2007-07-05 06:08:56 UTC (rev 24004)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+This tests that assigning to document.location from a button click adds a back/forward item. Navigate
+
+============== Back Forward List ==============
+        http://127.0.0.1:8000/navigation/document-location-click.html  **nav target**
+curr-&gt;  http://127.0.0.1:8000/navigation/document-location-click.html?1  **nav target**
+===============================================
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsnavigationdocumentlocationclicktimeoutexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/navigation/document-location-click-timeout-expected.txt (0 => 24004)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/navigation/document-location-click-timeout-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/document-location-click-timeout-expected.txt        2007-07-05 06:08:56 UTC (rev 24004)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+This tests that assigning to document.location from a timeout in a button click adds a back/forward item. Navigate
+
+============== Back Forward List ==============
+        http://127.0.0.1:8000/navigation/document-location-click-timeout.html  **nav target**
+curr-&gt;  http://127.0.0.1:8000/navigation/document-location-click-timeout.html?1  **nav target**
+===============================================
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsnavigationdocumentlocationclicktimeouthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/navigation/document-location-click-timeout.html (0 => 24004)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/navigation/document-location-click-timeout.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/document-location-click-timeout.html        2007-07-05 06:08:56 UTC (rev 24004)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;resources/document-location.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+  function runTest() {
+    // Simulate clicking the Navigate button.
+    var button = document.getElementById(&quot;navigate&quot;);
+    var x = button.offsetLeft + button.offsetWidth / 2;
+    var y = button.offsetTop + button.offsetHeight / 2;
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseDown(); 
+    eventSender.mouseUp(); 
+  }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;start()&quot;&gt;
+This tests that assigning to document.location from a timeout in a button click
+adds a back/forward item.
+&lt;button onclick=&quot;setTimeout('setLocation()', 0)&quot; id=&quot;navigate&quot;&gt;Navigate&lt;/button&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsnavigationdocumentlocationclickhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/navigation/document-location-click.html (0 => 24004)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/navigation/document-location-click.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/document-location-click.html        2007-07-05 06:08:56 UTC (rev 24004)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;resources/document-location.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+  function runTest() {
+    // Simulate clicking the Navigate button.
+    var button = document.getElementById(&quot;navigate&quot;);
+    var x = button.offsetLeft + button.offsetWidth / 2;
+    var y = button.offsetTop + button.offsetHeight / 2;
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseDown(); 
+    eventSender.mouseUp(); 
+  }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;start()&quot;&gt;
+This tests that assigning to document.location from a button click adds a
+back/forward item.
+&lt;button onclick=&quot;setLocation()&quot; id=&quot;navigate&quot;&gt;Navigate&lt;/button&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsnavigationdocumentlocationmouseoverexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/navigation/document-location-mouseover-expected.txt (0 => 24004)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/navigation/document-location-mouseover-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/document-location-mouseover-expected.txt        2007-07-05 06:08:56 UTC (rev 24004)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+This tests that assigning to document.location from a button click adds a back/forward item. Navigate
+
+============== Back Forward List ==============
+        http://127.0.0.1:8000/navigation/document-location-mouseover.html  **nav target**
+curr-&gt;  http://127.0.0.1:8000/navigation/document-location-mouseover.html?1  **nav target**
+===============================================
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsnavigationdocumentlocationmouseoverhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/navigation/document-location-mouseover.html (0 => 24004)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/navigation/document-location-mouseover.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/document-location-mouseover.html        2007-07-05 06:08:56 UTC (rev 24004)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;resources/document-location.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+  function runTest() {
+    // Simulate mousing over the Navigate button.
+    var button = document.getElementById(&quot;navigate&quot;);
+    var x = button.offsetLeft + button.offsetWidth / 2;
+    var y = button.offsetTop + button.offsetHeight / 2;
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseMoveTo(0, 0);
+  }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;start()&quot;&gt;
+This tests that assigning to document.location from a button click adds a
+back/forward item.
+&lt;button onmouseover=&quot;setLocation()&quot; id=&quot;navigate&quot;&gt;Navigate&lt;/button&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsnavigationdocumentlocationonloadexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/navigation/document-location-onload-expected.txt (0 => 24004)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/navigation/document-location-onload-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/document-location-onload-expected.txt        2007-07-05 06:08:56 UTC (rev 24004)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+This tests that assigning to document.location from a timeout from the onload handler adds a back/forward item.
+
+============== Back Forward List ==============
+        http://127.0.0.1:8000/navigation/document-location-onload.html  **nav target**
+curr-&gt;  http://127.0.0.1:8000/navigation/document-location-onload.html?1  **nav target**
+===============================================
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsnavigationdocumentlocationonloadhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/navigation/document-location-onload.html (0 => 24004)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/navigation/document-location-onload.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/document-location-onload.html        2007-07-05 06:08:56 UTC (rev 24004)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;resources/document-location.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+  function runTest() {
+    setTimeout('setLocation()', 0);
+  }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;start()&quot;&gt;
+This tests that assigning to document.location from a timeout from the onload
+handler adds a back/forward item.
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsnavigationresourcesdocumentlocationjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/navigation/resources/document-location.js (0 => 24004)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/navigation/resources/document-location.js                                (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/resources/document-location.js        2007-07-05 06:08:56 UTC (rev 24004)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+function start() {
+  if (window.layoutTestController) {
+    var n = document.location.search.substring(1);
+    if (!n) {
+      // page just opened
+      layoutTestController.dumpBackForwardList();
+      layoutTestController.dumpAsText();
+      layoutTestController.waitUntilDone();
+
+      runTest();
+    } else {
+      // loaded the ?1 navigation
+      layoutTestController.notifyDone();
+    }
+  }
+}
+
+function setLocation() {
+  document.location = &quot;?1&quot;
+}
+
</ins></span></pre></div>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (24003 => 24004)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2007-07-05 06:04:56 UTC (rev 24003)
+++ trunk/WebCore/ChangeLog        2007-07-05 06:08:56 UTC (rev 24004)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2007-07-04  Matt Perry  &lt;mpComplete@gmail.com&gt;
+
+        Fix for http://bugs.webkit.org/show_bug.cgi?id=13400
+        Bug 13400: REGRESSION (r20809-20814): No back entry created for navigations created by assigning to document.location
+        &lt;rdar://problem/5153025&gt;
+
+        Treat userGesture as always true for setLocation, forcing a back/forward
+        entry to be created.
+
+        * bindings/js/JSHTMLDocumentCustom.cpp:
+        (WebCore::JSHTMLDocument::setLocation):
+
</ins><span class="cx"> 2007-07-04  Adam Roben  &lt;aroben@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Restore MouseEventWithHitTestResults::targetNode's old behavior
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSHTMLDocumentCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSHTMLDocumentCustom.cpp (24003 => 24004)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSHTMLDocumentCustom.cpp        2007-07-05 06:04:56 UTC (rev 24003)
+++ trunk/WebCore/bindings/js/JSHTMLDocumentCustom.cpp        2007-07-05 06:08:56 UTC (rev 24004)
</span><span class="lines">@@ -115,9 +115,8 @@
</span><span class="cx">     if (activeFrame)
</span><span class="cx">         str = activeFrame-&gt;document()-&gt;completeURL(str);
</span><span class="cx"> 
</span><del>-    // We want a new history item if this JS was called via a user gesture
-    bool userGesture = static_cast&lt;ScriptInterpreter*&gt;(exec-&gt;dynamicInterpreter())-&gt;wasRunByUserGesture();
-    frame-&gt;loader()-&gt;scheduleLocationChange(str, activeFrame-&gt;loader()-&gt;outgoingReferrer(), !userGesture);
</del><ins>+    // We always want a new history item when assigning to document.location.
+    frame-&gt;loader()-&gt;scheduleLocationChange(str, activeFrame-&gt;loader()-&gt;outgoingReferrer(), false, true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Custom functions
</span></span></pre>
</div>
</div>

</body>
</html>