<!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" />
<title>[165137] branches/safari-537.75-branch</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { 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 #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#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>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/165137">165137</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2014-03-05 16:03:52 -0800 (Wed, 05 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/157957">r157957</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari53775branchSourceWebCoreChangeLog">branches/safari-537.75-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari53775branchSourceWebCoreloaderNavigationSchedulercpp">branches/safari-537.75-branch/Source/WebCore/loader/NavigationScheduler.cpp</a></li>
<li><a href="#branchessafari53775branchToolsChangeLog">branches/safari-537.75-branch/Tools/ChangeLog</a></li>
<li><a href="#branchessafari53775branchToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">branches/safari-537.75-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari53775branchToolsTestWebKitAPITestsmacWillPerformClientRedirectToURLCrashhtml">branches/safari-537.75-branch/Tools/TestWebKitAPI/Tests/mac/WillPerformClientRedirectToURLCrash.html</a></li>
<li><a href="#branchessafari53775branchToolsTestWebKitAPITestsmacWillPerformClientRedirectToURLCrashmm">branches/safari-537.75-branch/Tools/TestWebKitAPI/Tests/mac/WillPerformClientRedirectToURLCrash.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari53775branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-537.75-branch/Source/WebCore/ChangeLog (165136 => 165137)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.75-branch/Source/WebCore/ChangeLog        2014-03-05 23:35:14 UTC (rev 165136)
+++ branches/safari-537.75-branch/Source/WebCore/ChangeLog        2014-03-06 00:03:52 UTC (rev 165137)
</span><span class="lines">@@ -1,5 +1,31 @@
</span><span class="cx"> 2014-03-05  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r157957.
+
+    2013-10-24  Daniel Bates  &lt;dabates@apple.com&gt;
+
+            Crash in WebCore::NavigationScheduler::startTimer()
+            https://bugs.webkit.org/show_bug.cgi?id=123288
+            &lt;rdar://problem/14055644&gt;
+
+            Reviewed by Alexey Proskuryakov.
+
+            Currently NavigationScheduler::startTimer() synchronously notifies the client
+            before the Web Inspector of a scheduled redirect. If a client cancels this
+            redirect then NavigationScheduler::m_redirect will become null and we'll
+            subsequently crash when informing the Web Inspector of this formerly scheduled
+            redirect. Instead, NavigationScheduler::startTimer() should notify the Web
+            Inspector before it notifies the client of a scheduled redirect.
+
+            As a side benefit of this change, the Web Inspector is notified of a scheduled
+            redirect before being notified of it being canceled when a client chooses to cancel
+            a scheduled redirect.
+
+            * loader/NavigationScheduler.cpp:
+            (WebCore::NavigationScheduler::startTimer):
+
+2014-03-05  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
</ins><span class="cx">         Merge r153829
</span><span class="cx"> 
</span><span class="cx">     2013-08-08  Andreas Kling  &lt;akling@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari53775branchSourceWebCoreloaderNavigationSchedulercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-537.75-branch/Source/WebCore/loader/NavigationScheduler.cpp (165136 => 165137)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.75-branch/Source/WebCore/loader/NavigationScheduler.cpp        2014-03-05 23:35:14 UTC (rev 165136)
+++ branches/safari-537.75-branch/Source/WebCore/loader/NavigationScheduler.cpp        2014-03-06 00:03:52 UTC (rev 165137)
</span><span class="lines">@@ -465,9 +465,10 @@
</span><span class="cx">     if (!m_redirect-&gt;shouldStartTimer(m_frame))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    m_timer.startOneShot(m_redirect-&gt;delay());
-    m_redirect-&gt;didStartTimer(m_frame, &amp;m_timer);
-    InspectorInstrumentation::frameScheduledNavigation(m_frame, m_redirect-&gt;delay());
</del><ins>+    double delay = m_redirect-&gt;delay();
+    m_timer.startOneShot(delay);
+    InspectorInstrumentation::frameScheduledNavigation(m_frame, delay);
+    m_redirect-&gt;didStartTimer(m_frame, &amp;m_timer); // m_redirect may be null on return (e.g. the client canceled the load)
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void NavigationScheduler::cancel(bool newLoadInProgress)
</span></span></pre></div>
<a id="branchessafari53775branchToolsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-537.75-branch/Tools/ChangeLog (165136 => 165137)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.75-branch/Tools/ChangeLog        2014-03-05 23:35:14 UTC (rev 165136)
+++ branches/safari-537.75-branch/Tools/ChangeLog        2014-03-06 00:03:52 UTC (rev 165137)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2014-03-05  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r157957.
+
+    2013-10-24  Daniel Bates  &lt;dabates@apple.com&gt;
+
+            Crash in WebCore::NavigationScheduler::startTimer()
+            https://bugs.webkit.org/show_bug.cgi?id=123288
+            &lt;rdar://problem/14055644&gt;
+
+            Reviewed by Alexey Proskuryakov.
+
+            Add API test.
+
+            * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+            * TestWebKitAPI/Tests/mac/WillPerformClientRedirectToURLCrash.html: Added.
+            * TestWebKitAPI/Tests/mac/WillPerformClientRedirectToURLCrash.mm: Added.
+
</ins><span class="cx"> 2014-02-11  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r158447.
</span></span></pre></div>
<a id="branchessafari53775branchToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: branches/safari-537.75-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (165136 => 165137)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.75-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2014-03-05 23:35:14 UTC (rev 165136)
+++ branches/safari-537.75-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2014-03-06 00:03:52 UTC (rev 165137)
</span><span class="lines">@@ -214,6 +214,8 @@
</span><span class="cx">                 CD5393C81757BA9700C07123 /* MD5.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5393C71757BA9700C07123 /* MD5.cpp */; };
</span><span class="cx">                 CD5393CA1757BAC400C07123 /* SHA1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5393C91757BAC400C07123 /* SHA1.cpp */; };
</span><span class="cx">                 CD5497B415857F0C00B5BC30 /* MediaTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5497B315857F0C00B5BC30 /* MediaTime.cpp */; };
</span><ins>+                CE14F1A4181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CE14F1A2181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html */; }; 
+                CE32C7C818184C4900CD8C28 /* WillPerformClientRedirectToURLCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = CE32C7C718184C4900CD8C28 /* WillPerformClientRedirectToURLCrash.mm */; }; 
</ins><span class="cx">                 E1220DA0155B25480013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1220D9F155B25480013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.mm */; };
</span><span class="cx">                 E1220DCA155B28AA0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */; };
</span><span class="cx">                 E194E1BB177E5145009C4D4E /* StopLoadingFromDidReceiveResponse.mm in Sources */ = {isa = PBXBuildFile; fileRef = E194E1BA177E5145009C4D4E /* StopLoadingFromDidReceiveResponse.mm */; };
</span><span class="lines">@@ -282,6 +284,7 @@
</span><span class="cx">                                 1A02C870125D4CFD00E3F4BD /* find.html in Copy Resources */,
</span><span class="cx">                                 9B4F8FA7159D52DD002D9F94 /* HTMLCollectionNamedItem.html in Copy Resources */,
</span><span class="cx">                                 9B26FCCA159D16DE00CC3765 /* HTMLFormCollectionNamedItem.html in Copy Resources */,
</span><ins>+                                CE14F1A4181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html in Copy Resources */,
</ins><span class="cx">                                 BCBD3737125ABBEB00D2C29F /* icon.png in Copy Resources */,
</span><span class="cx">                                 378E64791632707400B6C676 /* link-with-title.html in Copy Resources */,
</span><span class="cx">                                 9361002914DC95A70061379D /* lots-of-iframes.html in Copy Resources */,
</span><span class="lines">@@ -537,6 +540,8 @@
</span><span class="cx">                 CD5393C71757BA9700C07123 /* MD5.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MD5.cpp; path = WTF/MD5.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CD5393C91757BAC400C07123 /* SHA1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SHA1.cpp; path = WTF/SHA1.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CD5497B315857F0C00B5BC30 /* MediaTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MediaTime.cpp; path = WTF/MediaTime.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                CE14F1A2181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = WillPerformClientRedirectToURLCrash.html; sourceTree = &quot;&lt;group&gt;&quot;; }; 
+                CE32C7C718184C4900CD8C28 /* WillPerformClientRedirectToURLCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WillPerformClientRedirectToURLCrash.mm; sourceTree = &quot;&lt;group&gt;&quot;; }; 
</ins><span class="cx">                 E1220D9F155B25480013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryCacheDisableWithinResourceLoadDelegate.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = MemoryCacheDisableWithinResourceLoadDelegate.html; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E194E1BA177E5145009C4D4E /* StopLoadingFromDidReceiveResponse.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StopLoadingFromDidReceiveResponse.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -916,6 +921,7 @@
</span><span class="cx">                                 C540F775152E4DA000A40C8C /* SimplifyMarkup.mm */,
</span><span class="cx">                                 291861FD17BD4DC700D4E41E /* StopLoadingFromDidFinishLoading.mm */,
</span><span class="cx">                                 E194E1BA177E5145009C4D4E /* StopLoadingFromDidReceiveResponse.mm */,
</span><ins>+                                CE32C7C718184C4900CD8C28 /* WillPerformClientRedirectToURLCrash.mm */,
</ins><span class="cx">                                 3799AD3914120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm */,
</span><span class="cx">                                 37A6895D148A9B50005100FA /* SubresourceErrorCrash.mm */,
</span><span class="cx">                                 E490296714E2E3A4002BEDD1 /* TypingStyleCrash.mm */,
</span><span class="lines">@@ -944,6 +950,7 @@
</span><span class="cx">                                 37DC678F140D7D3A00ABCCDB /* DOMRangeOfString.html */,
</span><span class="cx">                                 9B4F8FA6159D52CA002D9F94 /* HTMLCollectionNamedItem.html */,
</span><span class="cx">                                 9B26FCB4159D15E700CC3765 /* HTMLFormCollectionNamedItem.html */,
</span><ins>+                                 CE14F1A2181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html */,
</ins><span class="cx">                                 E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */,
</span><span class="cx">                                 517E7E031511187500D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html */,
</span><span class="cx">                                 290A9BB81735F42300D71BBC /* OpenNewWindow.html */,
</span><span class="lines">@@ -1118,6 +1125,7 @@
</span><span class="cx">                                 1ADBEFAE130C689C00D61D19 /* ForceRepaint.cpp in Sources */,
</span><span class="cx">                                 BCBD3710125AA2EB00D2C29F /* FrameMIMETypeHTML.cpp in Sources */,
</span><span class="cx">                                 BCBD3761125ABCFE00D2C29F /* FrameMIMETypePNG.cpp in Sources */,
</span><ins>+                                CE32C7C818184C4900CD8C28 /* WillPerformClientRedirectToURLCrash.mm in Sources */,
</ins><span class="cx">                                 290F427B172A23A500939FF0 /* TestProtocol.mm in Sources */,
</span><span class="cx">                                 1AA9E55914980A9900001A8A /* Functional.cpp in Sources */,
</span><span class="cx">                                 C0C5D3BE14598B6F00A802A6 /* GetBackingScaleFactor.mm in Sources */,
</span></span></pre></div>
<a id="branchessafari53775branchToolsTestWebKitAPITestsmacWillPerformClientRedirectToURLCrashhtmlfromrev157957trunkToolsTestWebKitAPITestsmacWillPerformClientRedirectToURLCrashhtml"></a>
<div class="copfile"><h4>Copied: branches/safari-537.75-branch/Tools/TestWebKitAPI/Tests/mac/WillPerformClientRedirectToURLCrash.html (from rev 157957, trunk/Tools/TestWebKitAPI/Tests/mac/WillPerformClientRedirectToURLCrash.html) (0 => 165137)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.75-branch/Tools/TestWebKitAPI/Tests/mac/WillPerformClientRedirectToURLCrash.html                                (rev 0)
+++ branches/safari-537.75-branch/Tools/TestWebKitAPI/Tests/mac/WillPerformClientRedirectToURLCrash.html        2014-03-06 00:03:52 UTC (rev 165137)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;iframe id=&quot;frame&quot; src=&quot;about:blank&quot;&gt;&lt;/iframe&gt;
+&lt;script&gt;
+var query = window.location.search;
+if (!query)
+    document.getElementById(&quot;frame&quot;).src = &quot;WillPerformClientRedirectToURLCrash.html?FAIL&quot;;
+else if (query == &quot;?PASS&quot;)
+    alert(&quot;PASS&quot;);
+else
+    alert(&quot;FAIL&quot;);
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="branchessafari53775branchToolsTestWebKitAPITestsmacWillPerformClientRedirectToURLCrashmmfromrev157957trunkToolsTestWebKitAPITestsmacWillPerformClientRedirectToURLCrashmm"></a>
<div class="copfile"><h4>Copied: branches/safari-537.75-branch/Tools/TestWebKitAPI/Tests/mac/WillPerformClientRedirectToURLCrash.mm (from rev 157957, trunk/Tools/TestWebKitAPI/Tests/mac/WillPerformClientRedirectToURLCrash.mm) (0 => 165137)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.75-branch/Tools/TestWebKitAPI/Tests/mac/WillPerformClientRedirectToURLCrash.mm                                (rev 0)
+++ branches/safari-537.75-branch/Tools/TestWebKitAPI/Tests/mac/WillPerformClientRedirectToURLCrash.mm        2014-03-06 00:03:52 UTC (rev 165137)
</span><span class="lines">@@ -0,0 +1,86 @@
</span><ins>+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &quot;config.h&quot;
+#import &quot;PlatformUtilities.h&quot;
+#import &quot;WTFStringUtilities.h&quot;
+
+#import &lt;wtf/RetainPtr.h&gt;
+
+static bool testFinished;
+
+static NSURL *testURL()
+{
+    static RetainPtr&lt;NSURL&gt; url = [[NSBundle mainBundle] URLForResource:@&quot;WillPerformClientRedirectToURLCrash&quot; withExtension:@&quot;html&quot; subdirectory:@&quot;TestWebKitAPI.resources&quot;];
+    return url.get();
+}
+
+@interface WebKit1TestDelegate : NSObject
+
++ (WebKit1TestDelegate *)shared;
+
+@end
+
+@implementation WebKit1TestDelegate
+
++ (WebKit1TestDelegate *)shared
+{
+    static WebKit1TestDelegate *sharedTestDelegate = [[WebKit1TestDelegate alloc] init];
+    return sharedTestDelegate;
+}
+
+// MARK: WebFrameLoadDelegate callbacks
+
+- (void)webView:(WebView *)webView willPerformClientRedirectToURL:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date forFrame:(WebFrame *)frame
+{
+    // Start a new load; canceling the scheduled redirect. Should not cause a crash.
+    NSString *url = [NSString stringWithFormat:@&quot;%@?PASS&quot;, testURL()];
+    [frame loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
+}
+
+// MARK: WebUIDelegate callbacks
+
+-(void)webView:(WebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame
+{
+    EXPECT_EQ(String(&quot;PASS&quot;), String(message));
+    testFinished = true;
+}
+
+@end
+
+namespace TestWebKitAPI {
+
+TEST(WebKit1, WillPerformClientRedirectToURLCrash)
+{
+    @autoreleasepool {
+        RetainPtr&lt;WebView&gt; webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+        [webView setFrameLoadDelegate: [WebKit1TestDelegate shared]];
+        [webView setUIDelegate:[WebKit1TestDelegate shared]];
+        [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:testURL()]];
+        Util::run(&amp;testFinished);
+    }
+}
+
+} // namespace TestWebKitAPI
</ins></span></pre>
</div>
</div>

</body>
</html>