<!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>[242494] tags/Safari-608.1.7.1.1</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/242494">242494</a></dd>
<dt>Author</dt> <dd>alancoon@apple.com</dd>
<dt>Date</dt> <dd>2019-03-05 11:13:50 -0800 (Tue, 05 Mar 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Cherry-pick <a href="http://trac.webkit.org/projects/webkit/changeset/242468">r242468</a>. rdar://problem/47820581

    Correctly handle sandbox extensions when the same WKWebView loads multiple file:// URLs.
    <rdar://problem/47820581> and https://bugs.webkit.org/show_bug.cgi?id=195291

    Reviewed by Tim Horton.

    Source/WebKit:

    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::SandboxExtensionTracker::shouldReuseCommittedSandboxExtension): If there is a pendingProvisionalSandboxExtension
      then its existence should override our willingness to reuse the existing committed extension.
    (WebKit::shouldReuseCommittedSandboxExtension): Deleted.
    * WebProcess/WebPage/WebPage.h:

    Tools:

    Loading a file: URL into a WKWebView and then loading another file: url from a completely
    different directory into that same WKWebView should work.

    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
    * TestWebKitAPI/Tests/WebKitCocoa/LoadFileURL.mm: Added.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242468 268f45cc-cd09-0410-ab3c-d52691b4dbfc</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#tagsSafari6081711SourceWebKitChangeLog">tags/Safari-608.1.7.1.1/Source/WebKit/ChangeLog</a></li>
<li><a href="#tagsSafari6081711SourceWebKitWebProcessWebPageWebPagecpp">tags/Safari-608.1.7.1.1/Source/WebKit/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#tagsSafari6081711SourceWebKitWebProcessWebPageWebPageh">tags/Safari-608.1.7.1.1/Source/WebKit/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#tagsSafari6081711ToolsChangeLog">tags/Safari-608.1.7.1.1/Tools/ChangeLog</a></li>
<li><a href="#tagsSafari6081711ToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">tags/Safari-608.1.7.1.1/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#tagsSafari6081711ToolsTestWebKitAPITestsWebKitCocoaLoadFileURLmm">tags/Safari-608.1.7.1.1/Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadFileURL.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="tagsSafari6081711SourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: tags/Safari-608.1.7.1.1/Source/WebKit/ChangeLog (242493 => 242494)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-608.1.7.1.1/Source/WebKit/ChangeLog  2019-03-05 19:13:46 UTC (rev 242493)
+++ tags/Safari-608.1.7.1.1/Source/WebKit/ChangeLog     2019-03-05 19:13:50 UTC (rev 242494)
</span><span class="lines">@@ -1,5 +1,45 @@
</span><span class="cx"> 2019-03-05  Alan Coon  <alancoon@apple.com>
</span><span class="cx"> 
</span><ins>+        Cherry-pick r242468. rdar://problem/47820581
+
+    Correctly handle sandbox extensions when the same WKWebView loads multiple file:// URLs.
+    <rdar://problem/47820581> and https://bugs.webkit.org/show_bug.cgi?id=195291
+    
+    Reviewed by Tim Horton.
+    
+    Source/WebKit:
+    
+    * WebProcess/WebPage/WebPage.cpp:
+    (WebKit::WebPage::SandboxExtensionTracker::shouldReuseCommittedSandboxExtension): If there is a pendingProvisionalSandboxExtension
+      then its existence should override our willingness to reuse the existing committed extension.
+    (WebKit::shouldReuseCommittedSandboxExtension): Deleted.
+    * WebProcess/WebPage/WebPage.h:
+    
+    Tools:
+    
+    Loading a file: URL into a WKWebView and then loading another file: url from a completely
+    different directory into that same WKWebView should work.
+    
+    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+    * TestWebKitAPI/Tests/WebKitCocoa/LoadFileURL.mm: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242468 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-03-05  Brady Eidson  <beidson@apple.com>
+
+            Correctly handle sandbox extensions when the same WKWebView loads multiple file:// URLs.
+            <rdar://problem/47820581> and https://bugs.webkit.org/show_bug.cgi?id=195291
+
+            Reviewed by Tim Horton.
+
+            * WebProcess/WebPage/WebPage.cpp:
+            (WebKit::WebPage::SandboxExtensionTracker::shouldReuseCommittedSandboxExtension): If there is a pendingProvisionalSandboxExtension
+              then its existence should override our willingness to reuse the existing committed extension.
+            (WebKit::shouldReuseCommittedSandboxExtension): Deleted.
+            * WebProcess/WebPage/WebPage.h:
+
+2019-03-05  Alan Coon  <alancoon@apple.com>
+
</ins><span class="cx">         Cherry-pick r242411. rdar://problem/47820581
</span><span class="cx"> 
</span><span class="cx">     Unreviewed, rolling out r242376.
</span></span></pre></div>
<a id="tagsSafari6081711SourceWebKitWebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: tags/Safari-608.1.7.1.1/Source/WebKit/WebProcess/WebPage/WebPage.cpp (242493 => 242494)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-608.1.7.1.1/Source/WebKit/WebProcess/WebPage/WebPage.cpp     2019-03-05 19:13:46 UTC (rev 242493)
+++ tags/Safari-608.1.7.1.1/Source/WebKit/WebProcess/WebPage/WebPage.cpp        2019-03-05 19:13:50 UTC (rev 242494)
</span><span class="lines">@@ -4399,7 +4399,7 @@
</span><span class="cx">     m_pendingProvisionalSandboxExtension = WTFMove(pendingProvisionalSandboxExtension);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool shouldReuseCommittedSandboxExtension(WebFrame* frame)
</del><ins>+bool WebPage::SandboxExtensionTracker::shouldReuseCommittedSandboxExtension(WebFrame* frame)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(frame->isMainFrame());
</span><span class="cx"> 
</span><span class="lines">@@ -4410,6 +4410,9 @@
</span><span class="cx">     if (isReload(frameLoadType))
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><ins>+    if (m_pendingProvisionalSandboxExtension)
+        return false;
+
</ins><span class="cx">     DocumentLoader* documentLoader = frameLoader.documentLoader();
</span><span class="cx">     DocumentLoader* provisionalDocumentLoader = frameLoader.provisionalDocumentLoader();
</span><span class="cx">     if (!documentLoader || !provisionalDocumentLoader)
</span></span></pre></div>
<a id="tagsSafari6081711SourceWebKitWebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: tags/Safari-608.1.7.1.1/Source/WebKit/WebProcess/WebPage/WebPage.h (242493 => 242494)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-608.1.7.1.1/Source/WebKit/WebProcess/WebPage/WebPage.h       2019-03-05 19:13:46 UTC (rev 242493)
+++ tags/Safari-608.1.7.1.1/Source/WebKit/WebProcess/WebPage/WebPage.h  2019-03-05 19:13:50 UTC (rev 242494)
</span><span class="lines">@@ -729,6 +729,7 @@
</span><span class="cx"> 
</span><span class="cx">     private:
</span><span class="cx">         void setPendingProvisionalSandboxExtension(RefPtr<SandboxExtension>&&);
</span><ins>+        bool shouldReuseCommittedSandboxExtension(WebFrame*);
</ins><span class="cx"> 
</span><span class="cx">         RefPtr<SandboxExtension> m_pendingProvisionalSandboxExtension;
</span><span class="cx">         RefPtr<SandboxExtension> m_provisionalSandboxExtension;
</span></span></pre></div>
<a id="tagsSafari6081711ToolsChangeLog"></a>
<div class="modfile"><h4>Modified: tags/Safari-608.1.7.1.1/Tools/ChangeLog (242493 => 242494)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-608.1.7.1.1/Tools/ChangeLog  2019-03-05 19:13:46 UTC (rev 242493)
+++ tags/Safari-608.1.7.1.1/Tools/ChangeLog     2019-03-05 19:13:50 UTC (rev 242494)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2019-03-05  Alan Coon  <alancoon@apple.com>
+
+        Cherry-pick r242468. rdar://problem/47820581
+
+    Correctly handle sandbox extensions when the same WKWebView loads multiple file:// URLs.
+    <rdar://problem/47820581> and https://bugs.webkit.org/show_bug.cgi?id=195291
+    
+    Reviewed by Tim Horton.
+    
+    Source/WebKit:
+    
+    * WebProcess/WebPage/WebPage.cpp:
+    (WebKit::WebPage::SandboxExtensionTracker::shouldReuseCommittedSandboxExtension): If there is a pendingProvisionalSandboxExtension
+      then its existence should override our willingness to reuse the existing committed extension.
+    (WebKit::shouldReuseCommittedSandboxExtension): Deleted.
+    * WebProcess/WebPage/WebPage.h:
+    
+    Tools:
+    
+    Loading a file: URL into a WKWebView and then loading another file: url from a completely
+    different directory into that same WKWebView should work.
+    
+    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+    * TestWebKitAPI/Tests/WebKitCocoa/LoadFileURL.mm: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242468 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-03-05  Brady Eidson  <beidson@apple.com>
+
+            Correctly handle sandbox extensions when the same WKWebView loads multiple file:// URLs.
+            <rdar://problem/47820581> and https://bugs.webkit.org/show_bug.cgi?id=195291
+
+            Reviewed by Tim Horton.
+
+            Loading a file: URL into a WKWebView and then loading another file: url from a completely
+            different directory into that same WKWebView should work.
+
+            * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+            * TestWebKitAPI/Tests/WebKitCocoa/LoadFileURL.mm: Added.
+
</ins><span class="cx"> 2019-02-26  Philippe Normand  <pnormand@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         [WPE] Add API for webview background color configuration
</span></span></pre></div>
<a id="tagsSafari6081711ToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: tags/Safari-608.1.7.1.1/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (242493 => 242494)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-608.1.7.1.1/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj      2019-03-05 19:13:46 UTC (rev 242493)
+++ tags/Safari-608.1.7.1.1/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2019-03-05 19:13:50 UTC (rev 242494)
</span><span class="lines">@@ -213,6 +213,7 @@
</span><span class="cx">          5120C83E1E67678F0025B250 /* WebsiteDataStoreCustomPaths.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5120C83B1E674E350025B250 /* WebsiteDataStoreCustomPaths.html */; };
</span><span class="cx">          512C4C9E20EAA40D004945EA /* ResponsivenessTimerCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 512C4C9D20EAA405004945EA /* ResponsivenessTimerCrash.mm */; };
</span><span class="cx">          51393E221523952D005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51393E1D1523944A005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp */; };
</span><ins>+               51396E1A222E516000A42FCE /* LoadFileURL.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51396E19222E4E8600A42FCE /* LoadFileURL.mm */; };
</ins><span class="cx">           5142B2731517C8C800C32B19 /* ContextMenuCanCopyURL.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5142B2721517C89100C32B19 /* ContextMenuCanCopyURL.html */; };
</span><span class="cx">          514958BE1F7427AC00E87BAD /* WKWebViewAutofillTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514958BD1F7427AC00E87BAD /* WKWebViewAutofillTests.mm */; };
</span><span class="cx">          515BE16F1D428BB100DD7C68 /* StoreBlobToBeDeleted.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 515BE16E1D4288FF00DD7C68 /* StoreBlobToBeDeleted.html */; };
</span><span class="lines">@@ -1590,6 +1591,7 @@
</span><span class="cx">          512C4C9D20EAA405004945EA /* ResponsivenessTimerCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResponsivenessTimerCrash.mm; sourceTree = "<group>"; };
</span><span class="cx">          51393E1D1523944A005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowExtensionBasic_Bundle.cpp; sourceTree = "<group>"; };
</span><span class="cx">          51393E1E1523944A005F39C5 /* DOMWindowExtensionBasic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowExtensionBasic.cpp; sourceTree = "<group>"; };
</span><ins>+               51396E19222E4E8600A42FCE /* LoadFileURL.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LoadFileURL.mm; sourceTree = "<group>"; };
</ins><span class="cx">           5142B2701517C88B00C32B19 /* ContextMenuCanCopyURL.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ContextMenuCanCopyURL.mm; sourceTree = "<group>"; };
</span><span class="cx">          5142B2721517C89100C32B19 /* ContextMenuCanCopyURL.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = ContextMenuCanCopyURL.html; sourceTree = "<group>"; };
</span><span class="cx">          514958BD1F7427AC00E87BAD /* WKWebViewAutofillTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewAutofillTests.mm; sourceTree = "<group>"; };
</span><span class="lines">@@ -2545,6 +2547,7 @@
</span><span class="cx">                          37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */,
</span><span class="cx">                          A125478D1DB18B9400358564 /* LoadDataWithNilMIMEType.mm */,
</span><span class="cx">                          4612C2B8210A6ABF00B788A6 /* LoadFileThenReload.mm */,
</span><ins>+                               51396E19222E4E8600A42FCE /* LoadFileURL.mm */,
</ins><span class="cx">                           57901FAC1CAF12C200ED64F9 /* LoadInvalidURLRequest.mm */,
</span><span class="cx">                          51E6A8921D2F1BEC00C004B6 /* LocalStorageClear.mm */,
</span><span class="cx">                          CA38459520AE012E00990D3B /* LocalStorageDatabaseTracker.mm */,
</span><span class="lines">@@ -4146,6 +4149,7 @@
</span><span class="cx">                          7CCE7EFF1A411AE600447C4C /* LoadCanceledNoServerRedirectCallback.cpp in Sources */,
</span><span class="cx">                          A125478F1DB18B9400358564 /* LoadDataWithNilMIMEType.mm in Sources */,
</span><span class="cx">                          4612C2B9210A6ACE00B788A6 /* LoadFileThenReload.mm in Sources */,
</span><ins>+                               51396E1A222E516000A42FCE /* LoadFileURL.mm in Sources */,
</ins><span class="cx">                           5C838F7F1DB04F900082858F /* LoadInvalidURLRequest.mm in Sources */,
</span><span class="cx">                          7C83E0C01D0A652700FEBCF3 /* LoadInvalidURLRequest.mm in Sources */,
</span><span class="cx">                          7CCE7F001A411AE600447C4C /* LoadPageOnCrash.cpp in Sources */,
</span></span></pre></div>
<a id="tagsSafari6081711ToolsTestWebKitAPITestsWebKitCocoaLoadFileURLmm"></a>
<div class="addfile"><h4>Added: tags/Safari-608.1.7.1.1/Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadFileURL.mm (0 => 242494)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-608.1.7.1.1/Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadFileURL.mm                             (rev 0)
+++ tags/Safari-608.1.7.1.1/Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadFileURL.mm        2019-03-05 19:13:50 UTC (rev 242494)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+/*
+ * Copyright (C) 2019 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.
+ */
+
+#include "config.h"
+
+#import "PlatformUtilities.h"
+#import "Test.h"
+#import "TestNavigationDelegate.h"
+#import <WebKit/WebKit.h>
+#import <wtf/RetainPtr.h>
+
+
+TEST(WKWebView, LoadTwoFiles)
+{
+    auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+
+    auto delegate = adoptNS([[TestNavigationDelegate alloc] init]);
+    [webView setNavigationDelegate:delegate.get()];
+
+    NSURL *file = [[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
+    [webView loadFileURL:file allowingReadAccessToURL:file.URLByDeletingLastPathComponent];
+    [delegate waitForDidFinishNavigation];
+
+    // Load a second file: resource that is in a completely different directory from the above
+    file = [[NSBundle mainBundle] URLForResource:@"simple2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
+    NSURL *targetURL = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/simple2.html" stringByExpandingTildeInPath]];
+    [[NSFileManager defaultManager] createDirectoryAtURL:targetURL.URLByDeletingLastPathComponent withIntermediateDirectories:YES attributes:nil error:nil];
+    [[NSFileManager defaultManager] removeItemAtURL:targetURL error:nil];
+    [[NSFileManager defaultManager] copyItemAtURL:file toURL:targetURL error:nil];
+    
+    // If this second load succeeds (e.g. doesn't timeout due to a sandbox violation) the test passes
+    [webView loadFileURL:targetURL allowingReadAccessToURL:targetURL.URLByDeletingLastPathComponent];
+    [delegate waitForDidFinishNavigation];
+}
</ins></span></pre>
</div>
</div>

</body>
</html>