<!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>[187962] trunk</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/187962">187962</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2015-08-05 09:05:55 -0700 (Wed, 05 Aug 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>REGRESSION (<a href="http://trac.webkit.org/projects/webkit/changeset/185111">r185111</a>): Clicking phone numbers doesn't prompt to call sometimes
https://bugs.webkit.org/show_bug.cgi?id=147678
&lt;rdar://problem/21827815&gt;

Reviewed by Brady Eidson.

Source/WebCore:

Fixes an issue where a non-user-initiated navigation of the main frame to a phone link (tel URL)
may be ignored. The navigation is ignored if the page was reloaded as a result of a web content
process crash, its lifetime exceeded the back-forward cache expiration interval, or a person
quits and opens Safari again, among other scenarios.

* history/HistoryItem.cpp:
(WebCore::HistoryItem::setShouldOpenExternalURLsPolicy): Added.
(WebCore::HistoryItem::shouldOpenExternalURLsPolicy): Added.
* history/HistoryItem.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadDifferentDocumentItem): Apply the &quot;should open external URLs&quot; policy
from the history item, if applicable. Also, be more explicit when instantiating a NavigationAction
so as to help make it straightforward to reduce the number of NavigationAction constructors we have
in the future.
* loader/HistoryController.cpp:
(WebCore::HistoryController::saveDocumentState): Save the &quot;should open external URLs&quot; policy to
the history item.
(WebCore::HistoryController::restoreDocumentState): Apply the &quot;should open external URLs&quot; policy
from the history item to the document loader.
(WebCore::HistoryController::initializeItem): Update the &quot;should open external URLs&quot; policy of
the history item to reflect the policy of the document loader associated with the current frame.

Source/WebKit2:

Teach WebKit to save and restore the &quot;should open external URLs&quot; policy.

* Shared/SessionState.cpp:
(WebKit::isValidEnum): Added.
(WebKit::PageState::encode): Modified to encode the &quot;should open external URLs&quot; policy.
(WebKit::PageState::decode): Modified to decode the &quot;should open external URLs&quot; policy.
* Shared/SessionState.h: Added ShouldOpenExternalURLsPolicy to PageState (defaults to WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow).
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _killWebContentProcessAndResetState]): Added; used in the unit test TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm.
* UIProcess/API/Cocoa/WKWebViewPrivate.h: Declare -[WKWebView _killWebContentProcessAndResetState].
* UIProcess/mac/LegacySessionStateCoding.cpp: Defined constant sessionHistoryEntryShouldOpenExternalURLsPolicyKey.
(WebKit::encodeSessionHistory): Modified to encode the &quot;should open external URLs&quot; policy.
(WebKit::decodeSessionHistoryEntry): Modified to decode the &quot;should open external URLs&quot; policy.
* WebProcess/WebCoreSupport/SessionStateConversion.cpp:
(WebKit::toPageState): Copy &quot;should open external URLs&quot; policy from specified history item.
(WebKit::toHistoryItem): Apply &quot;should open external URLs&quot; policy from PageState to HistoryItem.

Tools:

Add a test to ensure that we restore the &quot;should open external URLs&quot; policy on
page reload after the web content process crashes.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/should-open-external-schemes.html: Added.
* TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm:
(TEST):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehistoryHistoryItemcpp">trunk/Source/WebCore/history/HistoryItem.cpp</a></li>
<li><a href="#trunkSourceWebCorehistoryHistoryItemh">trunk/Source/WebCore/history/HistoryItem.h</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoadercpp">trunk/Source/WebCore/loader/FrameLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderHistoryControllercpp">trunk/Source/WebCore/loader/HistoryController.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedSessionStatecpp">trunk/Source/WebKit2/Shared/SessionState.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedSessionStateh">trunk/Source/WebKit2/Shared/SessionState.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacLegacySessionStateCodingcpp">trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportSessionStateConversioncpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaShouldOpenExternalURLsInNewWindowActionsmm">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2shouldopenexternalschemeshtml">trunk/Tools/TestWebKitAPI/Tests/WebKit2/should-open-external-schemes.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (187961 => 187962)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebCore/ChangeLog        2015-08-05 16:05:55 UTC (rev 187962)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2015-08-05  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        REGRESSION (r185111): Clicking phone numbers doesn't prompt to call sometimes
+        https://bugs.webkit.org/show_bug.cgi?id=147678
+        &lt;rdar://problem/21827815&gt;
+
+        Reviewed by Brady Eidson.
+
+        Fixes an issue where a non-user-initiated navigation of the main frame to a phone link (tel URL)
+        may be ignored. The navigation is ignored if the page was reloaded as a result of a web content
+        process crash, its lifetime exceeded the back-forward cache expiration interval, or a person
+        quits and opens Safari again, among other scenarios.
+
+        * history/HistoryItem.cpp:
+        (WebCore::HistoryItem::setShouldOpenExternalURLsPolicy): Added.
+        (WebCore::HistoryItem::shouldOpenExternalURLsPolicy): Added.
+        * history/HistoryItem.h:
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::loadDifferentDocumentItem): Apply the &quot;should open external URLs&quot; policy
+        from the history item, if applicable. Also, be more explicit when instantiating a NavigationAction
+        so as to help make it straightforward to reduce the number of NavigationAction constructors we have
+        in the future.
+        * loader/HistoryController.cpp:
+        (WebCore::HistoryController::saveDocumentState): Save the &quot;should open external URLs&quot; policy to
+        the history item.
+        (WebCore::HistoryController::restoreDocumentState): Apply the &quot;should open external URLs&quot; policy
+        from the history item to the document loader.
+        (WebCore::HistoryController::initializeItem): Update the &quot;should open external URLs&quot; policy of
+        the history item to reflect the policy of the document loader associated with the current frame.
+
</ins><span class="cx"> 2015-08-04  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Checkboxes and radio buttons should scale when zooming or pinching to zoom
</span></span></pre></div>
<a id="trunkSourceWebCorehistoryHistoryItemcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/history/HistoryItem.cpp (187961 => 187962)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/history/HistoryItem.cpp        2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebCore/history/HistoryItem.cpp        2015-08-05 16:05:55 UTC (rev 187962)
</span><span class="lines">@@ -351,6 +351,16 @@
</span><span class="cx">     m_documentState.clear();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void HistoryItem::setShouldOpenExternalURLsPolicy(ShouldOpenExternalURLsPolicy policy)
+{
+    m_shouldOpenExternalURLsPolicy = policy;
+}
+
+ShouldOpenExternalURLsPolicy HistoryItem::shouldOpenExternalURLsPolicy() const
+{
+    return m_shouldOpenExternalURLsPolicy;
+}
+
</ins><span class="cx"> bool HistoryItem::isTargetItem() const
</span><span class="cx"> {
</span><span class="cx">     return m_isTargetItem;
</span></span></pre></div>
<a id="trunkSourceWebCorehistoryHistoryItemh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/history/HistoryItem.h (187961 => 187962)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/history/HistoryItem.h        2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebCore/history/HistoryItem.h        2015-08-05 16:05:55 UTC (rev 187962)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #define HistoryItem_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;FloatRect.h&quot;
</span><ins>+#include &quot;FrameLoaderTypes.h&quot;
</ins><span class="cx"> #include &quot;IntPoint.h&quot;
</span><span class="cx"> #include &quot;IntRect.h&quot;
</span><span class="cx"> #include &quot;SerializedScriptValue.h&quot;
</span><span class="lines">@@ -117,6 +118,9 @@
</span><span class="cx">     WEBCORE_EXPORT void setDocumentState(const Vector&lt;String&gt;&amp;);
</span><span class="cx">     void clearDocumentState();
</span><span class="cx"> 
</span><ins>+    WEBCORE_EXPORT void setShouldOpenExternalURLsPolicy(ShouldOpenExternalURLsPolicy);
+    WEBCORE_EXPORT ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy() const;
+
</ins><span class="cx">     void setURL(const URL&amp;);
</span><span class="cx">     WEBCORE_EXPORT void setURLString(const String&amp;);
</span><span class="cx">     WEBCORE_EXPORT void setOriginalURLString(const String&amp;);
</span><span class="lines">@@ -231,6 +235,8 @@
</span><span class="cx">     IntPoint m_scrollPoint;
</span><span class="cx">     float m_pageScaleFactor;
</span><span class="cx">     Vector&lt;String&gt; m_documentState;
</span><ins>+
+    ShouldOpenExternalURLsPolicy m_shouldOpenExternalURLsPolicy { ShouldOpenExternalURLsPolicy::ShouldNotAllow };
</ins><span class="cx">     
</span><span class="cx">     HistoryItemVector m_children;
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (187961 => 187962)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.cpp        2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp        2015-08-05 16:05:55 UTC (rev 187962)
</span><span class="lines">@@ -3228,7 +3228,11 @@
</span><span class="cx"> 
</span><span class="cx">     if (!item.referrer().isNull())
</span><span class="cx">         request.setHTTPReferrer(item.referrer());
</span><del>-    
</del><ins>+
+    ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy = shouldOpenExternalURLsPolicyToApply(m_frame, item.shouldOpenExternalURLsPolicy());
+    bool isFormSubmission = false;
+    Event* event = nullptr;
+
</ins><span class="cx">     // If this was a repost that failed the page cache, we might try to repost the form.
</span><span class="cx">     NavigationAction action;
</span><span class="cx">     if (formData) {
</span><span class="lines">@@ -3254,10 +3258,10 @@
</span><span class="cx">         
</span><span class="cx">         if (cacheLoadPolicy == MayAttemptCacheOnlyLoadForFormSubmissionItem) {
</span><span class="cx">             request.setCachePolicy(ReturnCacheDataDontLoad);
</span><del>-            action = NavigationAction(request, loadType, false);
</del><ins>+            action = NavigationAction(request, loadType, isFormSubmission, event, shouldOpenExternalURLsPolicy);
</ins><span class="cx">         } else {
</span><span class="cx">             request.setCachePolicy(ReturnCacheDataElseLoad);
</span><del>-            action = NavigationAction(request, NavigationType::FormResubmitted);
</del><ins>+            action = NavigationAction(request, NavigationType::FormResubmitted, event, shouldOpenExternalURLsPolicy);
</ins><span class="cx">         }
</span><span class="cx">     } else {
</span><span class="cx">         switch (loadType) {
</span><span class="lines">@@ -3282,7 +3286,7 @@
</span><span class="cx"> 
</span><span class="cx">         ResourceRequest requestForOriginalURL(request);
</span><span class="cx">         requestForOriginalURL.setURL(itemOriginalURL);
</span><del>-        action = NavigationAction(requestForOriginalURL, loadType, false);
</del><ins>+        action = NavigationAction(requestForOriginalURL, loadType, isFormSubmission, event, shouldOpenExternalURLsPolicy);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     loadWithNavigationAction(request, action, LockHistory::No, loadType, 0, AllowNavigationToInvalidURL::Yes);
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderHistoryControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/HistoryController.cpp (187961 => 187962)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/HistoryController.cpp        2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebCore/loader/HistoryController.cpp        2015-08-05 16:05:55 UTC (rev 187962)
</span><span class="lines">@@ -191,6 +191,9 @@
</span><span class="cx">     ASSERT(m_frame.document());
</span><span class="cx">     Document&amp; document = *m_frame.document();
</span><span class="cx">     if (item-&gt;isCurrentDocument(document) &amp;&amp; document.hasLivingRenderTree()) {
</span><ins>+        if (DocumentLoader* documentLoader = document.loader())
+            item-&gt;setShouldOpenExternalURLsPolicy(documentLoader-&gt;shouldOpenExternalURLsPolicyToPropagate());
+
</ins><span class="cx">         LOG(Loading, &quot;WebCoreLoading %s: saving form state to %p&quot;, m_frame.tree().uniqueName().string().utf8().data(), item);
</span><span class="cx">         item-&gt;setDocumentState(document.formElementsState());
</span><span class="cx">     }
</span><span class="lines">@@ -230,6 +233,8 @@
</span><span class="cx">     if (m_frame.loader().documentLoader()-&gt;isClientRedirect())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    m_frame.loader().documentLoader()-&gt;setShouldOpenExternalURLsPolicy(m_currentItem-&gt;shouldOpenExternalURLsPolicy());
+
</ins><span class="cx">     LOG(Loading, &quot;WebCoreLoading %s: restoring form state from %p&quot;, m_frame.tree().uniqueName().string().utf8().data(), m_currentItem.get());
</span><span class="cx">     m_frame.document()-&gt;setStateForNewFormElements(m_currentItem-&gt;documentState());
</span><span class="cx"> }
</span><span class="lines">@@ -648,6 +653,8 @@
</span><span class="cx">     if (!unreachableURL.isEmpty() || documentLoader-&gt;response().httpStatusCode() &gt;= 400)
</span><span class="cx">         item.setLastVisitWasFailure(true);
</span><span class="cx"> 
</span><ins>+    item.setShouldOpenExternalURLsPolicy(documentLoader-&gt;shouldOpenExternalURLsPolicyToPropagate());
+
</ins><span class="cx">     // Save form state if this is a POST
</span><span class="cx">     item.setFormInfoFromRequest(documentLoader-&gt;request());
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (187961 => 187962)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebKit2/ChangeLog        2015-08-05 16:05:55 UTC (rev 187962)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2015-08-05  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        REGRESSION (r185111): Clicking phone numbers doesn't prompt to call sometimes
+        https://bugs.webkit.org/show_bug.cgi?id=147678
+        &lt;rdar://problem/21827815&gt;
+
+        Reviewed by Brady Eidson.
+
+        Teach WebKit to save and restore the &quot;should open external URLs&quot; policy.
+
+        * Shared/SessionState.cpp:
+        (WebKit::isValidEnum): Added.
+        (WebKit::PageState::encode): Modified to encode the &quot;should open external URLs&quot; policy.
+        (WebKit::PageState::decode): Modified to decode the &quot;should open external URLs&quot; policy.
+        * Shared/SessionState.h: Added ShouldOpenExternalURLsPolicy to PageState (defaults to WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow).
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _killWebContentProcessAndResetState]): Added; used in the unit test TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm.
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h: Declare -[WKWebView _killWebContentProcessAndResetState].
+        * UIProcess/mac/LegacySessionStateCoding.cpp: Defined constant sessionHistoryEntryShouldOpenExternalURLsPolicyKey.
+        (WebKit::encodeSessionHistory): Modified to encode the &quot;should open external URLs&quot; policy.
+        (WebKit::decodeSessionHistoryEntry): Modified to decode the &quot;should open external URLs&quot; policy.
+        * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
+        (WebKit::toPageState): Copy &quot;should open external URLs&quot; policy from specified history item.
+        (WebKit::toHistoryItem): Apply &quot;should open external URLs&quot; policy from PageState to HistoryItem.
+
</ins><span class="cx"> 2015-08-04  Antti Koivisto  &lt;antti@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Network cache fetches should have timeout
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedSessionStatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/SessionState.cpp (187961 => 187962)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/SessionState.cpp        2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebKit2/Shared/SessionState.cpp        2015-08-05 16:05:55 UTC (rev 187962)
</span><span class="lines">@@ -30,6 +30,17 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><ins>+bool isValidEnum(WebCore::ShouldOpenExternalURLsPolicy policy)
+{
+    switch (policy) {
+    case WebCore::ShouldOpenExternalURLsPolicy::ShouldAllow:
+    case WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes:
+    case WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow:
+        return true;
+    }
+    return false;
+}
+
</ins><span class="cx"> void HTTPBody::Element::encode(IPC::ArgumentEncoder&amp; encoder) const
</span><span class="cx"> {
</span><span class="cx">     encoder.encodeEnum(type);
</span><span class="lines">@@ -170,6 +181,7 @@
</span><span class="cx"> {
</span><span class="cx">     encoder &lt;&lt; title;
</span><span class="cx">     encoder &lt;&lt; mainFrameState;
</span><ins>+    encoder.encodeEnum(shouldOpenExternalURLsPolicy);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool PageState::decode(IPC::ArgumentDecoder&amp; decoder, PageState&amp; result)
</span><span class="lines">@@ -178,6 +190,8 @@
</span><span class="cx">         return false;
</span><span class="cx">     if (!decoder.decode(result.mainFrameState))
</span><span class="cx">         return false;
</span><ins>+    if (!decoder.decodeEnum(result.shouldOpenExternalURLsPolicy) || !isValidEnum(result.shouldOpenExternalURLsPolicy))
+        return false;
</ins><span class="cx"> 
</span><span class="cx">     return true;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedSessionStateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/SessionState.h (187961 => 187962)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/SessionState.h        2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebKit2/Shared/SessionState.h        2015-08-05 16:05:55 UTC (rev 187962)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #include &lt;WebCore/FloatRect.h&gt;
</span><ins>+#include &lt;WebCore/FrameLoaderTypes.h&gt;
</ins><span class="cx"> #include &lt;WebCore/IntRect.h&gt;
</span><span class="cx"> #include &lt;WebCore/URL.h&gt;
</span><span class="cx"> #include &lt;wtf/Optional.h&gt;
</span><span class="lines">@@ -44,6 +45,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><ins>+bool isValidEnum(WebCore::ShouldOpenExternalURLsPolicy);
+
</ins><span class="cx"> struct HTTPBody {
</span><span class="cx">     struct Element {
</span><span class="cx">         void encode(IPC::ArgumentEncoder&amp;) const;
</span><span class="lines">@@ -115,6 +118,7 @@
</span><span class="cx"> 
</span><span class="cx">     String title;
</span><span class="cx">     FrameState mainFrameState;
</span><ins>+    WebCore::ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy { WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> struct BackForwardListItemState {
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (187961 => 187962)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2015-08-05 16:05:55 UTC (rev 187962)
</span><span class="lines">@@ -2046,6 +2046,11 @@
</span><span class="cx">     _page-&gt;process().terminate();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)_killWebContentProcessAndResetState
+{
+    _page-&gt;terminateProcess();
+}
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> static WebCore::FloatSize activeMinimumLayoutSize(WKWebView *webView, const CGRect&amp; bounds)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (187961 => 187962)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2015-08-05 16:05:55 UTC (rev 187962)
</span><span class="lines">@@ -175,6 +175,8 @@
</span><span class="cx"> @property (nonatomic, setter=_setOverrideDeviceScaleFactor:) CGFloat _overrideDeviceScaleFactor WK_AVAILABLE(WK_MAC_TBA, NA);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+- (void)_killWebContentProcessAndResetState;
+
</ins><span class="cx"> - (void)_getMainResourceDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler;
</span><span class="cx"> - (void)_getWebArchiveDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacLegacySessionStateCodingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp (187961 => 187962)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp        2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp        2015-08-05 16:05:55 UTC (rev 187962)
</span><span class="lines">@@ -54,6 +54,7 @@
</span><span class="cx"> static const CFStringRef sessionHistoryEntryTitleKey = CFSTR(&quot;SessionHistoryEntryTitle&quot;);
</span><span class="cx"> static const CFStringRef sessionHistoryEntryOriginalURLKey = CFSTR(&quot;SessionHistoryEntryOriginalURL&quot;);
</span><span class="cx"> static const CFStringRef sessionHistoryEntryDataKey = CFSTR(&quot;SessionHistoryEntryData&quot;);
</span><ins>+static const CFStringRef sessionHistoryEntryShouldOpenExternalURLsPolicyKey = CFSTR(&quot;SessionHistoryEntryShouldOpenExternalURLsPolicyKey&quot;);
</ins><span class="cx"> 
</span><span class="cx"> // Session history entry data.
</span><span class="cx"> const uint32_t sessionHistoryEntryDataVersion = 2;
</span><span class="lines">@@ -426,12 +427,15 @@
</span><span class="cx">         auto title = item.pageState.title.createCFString();
</span><span class="cx">         auto originalURL = item.pageState.mainFrameState.originalURLString.createCFString();
</span><span class="cx">         auto data = encodeSessionHistoryEntryData(item.pageState.mainFrameState);
</span><ins>+        auto shouldOpenExternalURLsPolicyValue = static_cast&lt;uint64_t&gt;(item.pageState.shouldOpenExternalURLsPolicy);
+        auto shouldOpenExternalURLsPolicy = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &amp;shouldOpenExternalURLsPolicyValue));
</ins><span class="cx"> 
</span><span class="cx">         auto entryDictionary = createDictionary({
</span><span class="cx">             { sessionHistoryEntryURLKey, url.get() },
</span><span class="cx">             { sessionHistoryEntryTitleKey, title.get() },
</span><span class="cx">             { sessionHistoryEntryOriginalURLKey, originalURL.get() },
</span><span class="cx">             { sessionHistoryEntryDataKey, data.get() },
</span><ins>+            { sessionHistoryEntryShouldOpenExternalURLsPolicyKey, shouldOpenExternalURLsPolicy.get() },
</ins><span class="cx">         });
</span><span class="cx"> 
</span><span class="cx">         CFArrayAppendValue(entries.get(), entryDictionary.get());
</span><span class="lines">@@ -965,10 +969,20 @@
</span><span class="cx">     if (!historyEntryData)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><ins>+    auto rawShouldOpenExternalURLsPolicy = dynamic_cf_cast&lt;CFNumberRef&gt;(CFDictionaryGetValue(entryDictionary, sessionHistoryEntryShouldOpenExternalURLsPolicyKey));
+    WebCore::ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy;
+    if (rawShouldOpenExternalURLsPolicy) {
+        uint64_t value;
+        CFNumberGetValue(rawShouldOpenExternalURLsPolicy, kCFNumberSInt64Type, &amp;value);
+        shouldOpenExternalURLsPolicy = static_cast&lt;WebCore::ShouldOpenExternalURLsPolicy&gt;(value);
+    } else
+        shouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes;
+
</ins><span class="cx">     if (!decodeSessionHistoryEntryData(historyEntryData, backForwardListItemState.pageState.mainFrameState))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     backForwardListItemState.pageState.title = title;
</span><ins>+    backForwardListItemState.pageState.shouldOpenExternalURLsPolicy = shouldOpenExternalURLsPolicy;
</ins><span class="cx">     backForwardListItemState.pageState.mainFrameState.urlString = urlString;
</span><span class="cx">     backForwardListItemState.pageState.mainFrameState.originalURLString = originalURLString;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportSessionStateConversioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.cpp (187961 => 187962)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.cpp        2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.cpp        2015-08-05 16:05:55 UTC (rev 187962)
</span><span class="lines">@@ -116,6 +116,7 @@
</span><span class="cx"> 
</span><span class="cx">     pageState.title = historyItem.title();
</span><span class="cx">     pageState.mainFrameState = toFrameState(historyItem);
</span><ins>+    pageState.shouldOpenExternalURLsPolicy = historyItem.shouldOpenExternalURLsPolicy();
</ins><span class="cx"> 
</span><span class="cx">     return pageState;
</span><span class="cx"> }
</span><span class="lines">@@ -188,6 +189,7 @@
</span><span class="cx"> Ref&lt;HistoryItem&gt; toHistoryItem(const PageState&amp; pageState)
</span><span class="cx"> {
</span><span class="cx">     Ref&lt;HistoryItem&gt; historyItem = HistoryItem::create(pageState.mainFrameState.urlString, pageState.title);
</span><ins>+    historyItem-&gt;setShouldOpenExternalURLsPolicy(pageState.shouldOpenExternalURLsPolicy);
</ins><span class="cx">     applyFrameState(historyItem, pageState.mainFrameState);
</span><span class="cx"> 
</span><span class="cx">     return historyItem;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (187961 => 187962)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Tools/ChangeLog        2015-08-05 16:05:55 UTC (rev 187962)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2015-08-05  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        REGRESSION (r185111): Clicking phone numbers doesn't prompt to call sometimes
+        https://bugs.webkit.org/show_bug.cgi?id=147678
+        &lt;rdar://problem/21827815&gt;
+
+        Reviewed by Brady Eidson.
+
+        Add a test to ensure that we restore the &quot;should open external URLs&quot; policy on
+        page reload after the web content process crashes.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit2/should-open-external-schemes.html: Added.
+        * TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm:
+        (TEST):
+
</ins><span class="cx"> 2015-08-04  Hunseop Jeong  &lt;hs85.jeong@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL] Editing tests have been broken since r186694
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (187961 => 187962)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2015-08-05 16:05:55 UTC (rev 187962)
</span><span class="lines">@@ -298,6 +298,7 @@
</span><span class="cx">                 CE3524F91B1441C40028A7C5 /* TextFieldDidBeginAndEndEditing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE3524F11B142B8D0028A7C5 /* TextFieldDidBeginAndEndEditing.cpp */; };
</span><span class="cx">                 CE3524FA1B1443890028A7C5 /* input-focus-blur.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CE3524F51B142BBB0028A7C5 /* input-focus-blur.html */; };
</span><span class="cx">                 CEA6CF2819CCF69D0064F5A7 /* open-and-close-window.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CEA6CF2719CCF69D0064F5A7 /* open-and-close-window.html */; };
</span><ins>+                CEBABD491B71687C0051210A /* should-open-external-schemes.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CEBABD481B71687C0051210A /* should-open-external-schemes.html */; };
</ins><span class="cx">                 E1220DCA155B28AA0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */; };
</span><span class="cx">                 E194E1BD177E53C7009C4D4E /* StopLoadingFromDidReceiveResponse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E194E1BC177E534A009C4D4E /* StopLoadingFromDidReceiveResponse.html */; };
</span><span class="cx">                 E19DB9791B32137C00DB38D4 /* NavigatorLanguage.mm in Sources */ = {isa = PBXBuildFile; fileRef = E19DB9781B32137C00DB38D4 /* NavigatorLanguage.mm */; };
</span><span class="lines">@@ -403,6 +404,7 @@
</span><span class="cx">                                 51E5C7021919C3B200D8B3E1 /* simple2.html in Copy Resources */,
</span><span class="cx">                                 51E5C7031919C3B200D8B3E1 /* simple3.html in Copy Resources */,
</span><span class="cx">                                 C01A23F21266156700C9ED55 /* spacebar-scrolling.html in Copy Resources */,
</span><ins>+                                CEBABD491B71687C0051210A /* should-open-external-schemes.html in Copy Resources */,
</ins><span class="cx">                                 E194E1BD177E53C7009C4D4E /* StopLoadingFromDidReceiveResponse.html in Copy Resources */,
</span><span class="cx">                                 CD59F53519E9110D00CF1835 /* test-mse.mp4 in Copy Resources */,
</span><span class="cx">                                 524BBCA119E30C77002F1AF1 /* test.mp4 in Copy Resources */,
</span><span class="lines">@@ -726,6 +728,7 @@
</span><span class="cx">                 CE3524F51B142BBB0028A7C5 /* input-focus-blur.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;input-focus-blur.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenAndCloseWindow.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CEA6CF2719CCF69D0064F5A7 /* open-and-close-window.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = &quot;open-and-close-window.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                CEBABD481B71687C0051210A /* should-open-external-schemes.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = &quot;should-open-external-schemes.html&quot;; 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">@@ -1163,6 +1166,7 @@
</span><span class="cx">                                 BC909778125571AB00083756 /* simple.html */,
</span><span class="cx">                                 51E780361919AFF8001829A2 /* simple2.html */,
</span><span class="cx">                                 51E780371919AFF8001829A2 /* simple3.html */,
</span><ins>+                                CEBABD481B71687C0051210A /* should-open-external-schemes.html */,
</ins><span class="cx">                                 C02B7882126615410026BF0F /* spacebar-scrolling.html */,
</span><span class="cx">                                 CD59F53319E910BC00CF1835 /* test-mse.mp4 */,
</span><span class="cx">                                 524BBCA019E30C63002F1AF1 /* test.mp4 */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2shouldopenexternalschemeshtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/should-open-external-schemes.html (0 => 187962)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/should-open-external-schemes.html                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/should-open-external-schemes.html        2015-08-05 16:05:55 UTC (rev 187962)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script&gt;
+function navigateToTelURL()
+{
+     window.location.href = &quot;tel:+1 (408) 996-1010&quot;;
+}
+
+function navigateToTelURLInZeroTimer()
+{
+    window.setTimeout(navigateToTelURL, 0);
+}
+
+function navigateToTelURLInNestedZeroTimer()
+{
+    window.setTimeout(navigateToTelURLInZeroTimer, 0);
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaShouldOpenExternalURLsInNewWindowActionsmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm (187961 => 187962)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm        2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm        2015-08-05 16:05:55 UTC (rev 187962)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;PlatformUtilities.h&quot;
</span><span class="cx"> #import &lt;WebKit/WKNavigationActionPrivate.h&gt;
</span><ins>+#import &lt;WebKit/WKWebViewPrivate.h&gt;
</ins><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="lines">@@ -206,6 +207,48 @@
</span><span class="cx">     action = nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+TEST(WebKit2, RestoreShouldOpenExternalURLsPolicyAfterCrash)
+{
+    auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+    auto window = adoptNS([[NSWindow alloc] initWithContentRect:[webView frame] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
+    [[window contentView] addSubview:webView.get()];
+    auto controller = adoptNS([[ShouldOpenExternalURLsInNewWindowActionsController alloc] init]);
+    [webView setNavigationDelegate:controller.get()];
+    [webView setUIDelegate:controller.get()];
+
+    finishedNavigation = false;
+    NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@&quot;should-open-external-schemes&quot; withExtension:@&quot;html&quot; subdirectory:@&quot;TestWebKitAPI.resources&quot;]];
+    [webView loadRequest:request];
+    TestWebKitAPI::Util::run(&amp;finishedNavigation);
+    finishedNavigation = false;
+
+    // Before crash
+    decidedPolicy = false;
+    [webView evaluateJavaScript:@&quot;navigateToTelURLInNestedZeroTimer()&quot; completionHandler:nil]; // Non-user initiated navigation because it is performed in a nested timer callback.
+    TestWebKitAPI::Util::run(&amp;decidedPolicy);
+    decidedPolicy = false;
+
+    ASSERT_TRUE([action _shouldOpenExternalSchemes]);
+    ASSERT_FALSE([action _shouldOpenAppLinks]);
+
+    // Crash
+    [webView _killWebContentProcessAndResetState];
+    [webView reload];
+
+    finishedNavigation = false;
+    TestWebKitAPI::Util::run(&amp;finishedNavigation);
+    finishedNavigation = false;
+
+    // After crash
+    decidedPolicy = false;
+    [webView evaluateJavaScript:@&quot;navigateToTelURLInNestedZeroTimer()&quot; completionHandler:nil]; // Non-user initiated navigation because it is performed in a nested timer callback.
+    TestWebKitAPI::Util::run(&amp;decidedPolicy);
+    decidedPolicy = false;
+
+    ASSERT_TRUE([action _shouldOpenExternalSchemes]);
+    ASSERT_FALSE([action _shouldOpenAppLinks]);
+};
+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre>
</div>
</div>

</body>
</html>