Title: [241508] branches/safari-607-branch
Revision
241508
Author
bshaf...@apple.com
Date
2019-02-14 00:34:43 -0800 (Thu, 14 Feb 2019)

Log Message

Cherry-pick r241480. rdar://problem/48065618

    Further restricting webarchive loads
    https://bugs.webkit.org/show_bug.cgi?id=194567
    <rdar://problem/47610130>

    Reviewed by Youenn Fablet.

    Source/WebCore:

    This patch futher restricts main frame webarchive loads to the followings:
    1) loaded by clients;
    2) loaded by drag;
    3) reloaded from any of the previous two.

    It moves setAlwaysAllowLocalWebarchive, which is used for testing only, from Document
    to FrameLoader such that the option is remembered during redirections.

    Covered by API tests.

    * dom/Document.h:
    (WebCore::Document::setAlwaysAllowLocalWebarchive): Deleted.
    (WebCore::Document::alwaysAllowLocalWebarchive const): Deleted.
    * loader/DocumentLoader.cpp:
    (WebCore::DocumentLoader::disallowWebArchive const):
    * loader/DocumentLoader.h:
    (WebCore::DocumentLoader::setAllowsWebArchiveForMainFrame):
    (WebCore::DocumentLoader::allowsWebArchiveForMainFrame):
    * loader/FrameLoadRequest.h:
    (WebCore::FrameLoadRequest::setIsRequestFromClientOrUserInput):
    (WebCore::FrameLoadRequest::isRequestFromClientOrUserInput):
    * loader/FrameLoader.cpp:
    (WebCore::FrameLoader::load):
    (WebCore::FrameLoader::reload):
    * loader/FrameLoader.h:
    (WebCore::FrameLoader::setAlwaysAllowLocalWebarchive):
    (WebCore::FrameLoader::alwaysAllowLocalWebarchive const):
    * page/DragController.cpp:
    (WebCore::DragController::performDragOperation):
    * testing/Internals.cpp:
    (WebCore::Internals::setAlwaysAllowLocalWebarchive const):
    * testing/Internals.h:
    * testing/Internals.idl:

    Source/WebKit:

    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::loadRequest):
    Set a flag to indicate a load is started from clients.

    Tools:

    Besides adding API tests, this patch also enhances DragAndDropSimulator to allow
    navigations on drop.

    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
    * TestWebKitAPI/Tests/mac/LoadWebArchive.mm: Added.
    (-[TestLoadWebArchiveNavigationDelegate webView:didFinishNavigation:]):
    (-[TestLoadWebArchiveNavigationDelegate webView:didFailProvisionalNavigation:withError:]):
    (-[TestLoadWebArchiveNavigationDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]):
    (TestWebKitAPI::TEST):
    * TestWebKitAPI/Tests/mac/helloworld.webarchive: Added.
    * TestWebKitAPI/Tests/mac/load-web-archive-1.html: Added.
    * TestWebKitAPI/Tests/mac/load-web-archive-2.html: Added.
    * TestWebKitAPI/cocoa/DragAndDropSimulator.h:
    * TestWebKitAPI/mac/DragAndDropSimulatorMac.mm:
    (-[DragAndDropSimulator initWithWebViewFrame:configuration:]):
    (-[DragAndDropSimulator _webView:dragDestinationActionMaskForDraggingInfo:]):

    LayoutTests:

    * platform/mac/fast/loader/webarchive-encoding-respected.html:
    * webarchive/loading/cache-expired-subresource.html:
    * webarchive/loading/_javascript_-url-iframe-crash.html:
    * webarchive/loading/mainresource-null-mimetype-crash.html:
    * webarchive/loading/missing-data.html:
    * webarchive/loading/object.html:
    * webarchive/loading/test-loading-archive-subresource-null-mimetype.html:
    * webarchive/loading/test-loading-archive-subresource.html:
    * webarchive/loading/test-loading-archive.html:
    * webarchive/loading/test-loading-top-archive.html:
    * webarchive/loading/video-in-webarchive.html:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241480 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-607-branch/LayoutTests/ChangeLog (241507 => 241508)


--- branches/safari-607-branch/LayoutTests/ChangeLog	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/LayoutTests/ChangeLog	2019-02-14 08:34:43 UTC (rev 241508)
@@ -1,3 +1,110 @@
+2019-02-13  Babak Shafiei  <bshaf...@apple.com>
+
+        Cherry-pick r241480. rdar://problem/48065618
+
+    Further restricting webarchive loads
+    https://bugs.webkit.org/show_bug.cgi?id=194567
+    <rdar://problem/47610130>
+    
+    Reviewed by Youenn Fablet.
+    
+    Source/WebCore:
+    
+    This patch futher restricts main frame webarchive loads to the followings:
+    1) loaded by clients;
+    2) loaded by drag;
+    3) reloaded from any of the previous two.
+    
+    It moves setAlwaysAllowLocalWebarchive, which is used for testing only, from Document
+    to FrameLoader such that the option is remembered during redirections.
+    
+    Covered by API tests.
+    
+    * dom/Document.h:
+    (WebCore::Document::setAlwaysAllowLocalWebarchive): Deleted.
+    (WebCore::Document::alwaysAllowLocalWebarchive const): Deleted.
+    * loader/DocumentLoader.cpp:
+    (WebCore::DocumentLoader::disallowWebArchive const):
+    * loader/DocumentLoader.h:
+    (WebCore::DocumentLoader::setAllowsWebArchiveForMainFrame):
+    (WebCore::DocumentLoader::allowsWebArchiveForMainFrame):
+    * loader/FrameLoadRequest.h:
+    (WebCore::FrameLoadRequest::setIsRequestFromClientOrUserInput):
+    (WebCore::FrameLoadRequest::isRequestFromClientOrUserInput):
+    * loader/FrameLoader.cpp:
+    (WebCore::FrameLoader::load):
+    (WebCore::FrameLoader::reload):
+    * loader/FrameLoader.h:
+    (WebCore::FrameLoader::setAlwaysAllowLocalWebarchive):
+    (WebCore::FrameLoader::alwaysAllowLocalWebarchive const):
+    * page/DragController.cpp:
+    (WebCore::DragController::performDragOperation):
+    * testing/Internals.cpp:
+    (WebCore::Internals::setAlwaysAllowLocalWebarchive const):
+    * testing/Internals.h:
+    * testing/Internals.idl:
+    
+    Source/WebKit:
+    
+    * WebProcess/WebPage/WebPage.cpp:
+    (WebKit::WebPage::loadRequest):
+    Set a flag to indicate a load is started from clients.
+    
+    Tools:
+    
+    Besides adding API tests, this patch also enhances DragAndDropSimulator to allow
+    navigations on drop.
+    
+    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+    * TestWebKitAPI/Tests/mac/LoadWebArchive.mm: Added.
+    (-[TestLoadWebArchiveNavigationDelegate webView:didFinishNavigation:]):
+    (-[TestLoadWebArchiveNavigationDelegate webView:didFailProvisionalNavigation:withError:]):
+    (-[TestLoadWebArchiveNavigationDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]):
+    (TestWebKitAPI::TEST):
+    * TestWebKitAPI/Tests/mac/helloworld.webarchive: Added.
+    * TestWebKitAPI/Tests/mac/load-web-archive-1.html: Added.
+    * TestWebKitAPI/Tests/mac/load-web-archive-2.html: Added.
+    * TestWebKitAPI/cocoa/DragAndDropSimulator.h:
+    * TestWebKitAPI/mac/DragAndDropSimulatorMac.mm:
+    (-[DragAndDropSimulator initWithWebViewFrame:configuration:]):
+    (-[DragAndDropSimulator _webView:dragDestinationActionMaskForDraggingInfo:]):
+    
+    LayoutTests:
+    
+    * platform/mac/fast/loader/webarchive-encoding-respected.html:
+    * webarchive/loading/cache-expired-subresource.html:
+    * webarchive/loading/_javascript_-url-iframe-crash.html:
+    * webarchive/loading/mainresource-null-mimetype-crash.html:
+    * webarchive/loading/missing-data.html:
+    * webarchive/loading/object.html:
+    * webarchive/loading/test-loading-archive-subresource-null-mimetype.html:
+    * webarchive/loading/test-loading-archive-subresource.html:
+    * webarchive/loading/test-loading-archive.html:
+    * webarchive/loading/test-loading-top-archive.html:
+    * webarchive/loading/video-in-webarchive.html:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241480 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-02-12  Jiewen Tan  <jiewen_...@apple.com>
+
+            Further restricting webarchive loads
+            https://bugs.webkit.org/show_bug.cgi?id=194567
+            <rdar://problem/47610130>
+
+            Reviewed by Youenn Fablet.
+
+            * platform/mac/fast/loader/webarchive-encoding-respected.html:
+            * webarchive/loading/cache-expired-subresource.html:
+            * webarchive/loading/_javascript_-url-iframe-crash.html:
+            * webarchive/loading/mainresource-null-mimetype-crash.html:
+            * webarchive/loading/missing-data.html:
+            * webarchive/loading/object.html:
+            * webarchive/loading/test-loading-archive-subresource-null-mimetype.html:
+            * webarchive/loading/test-loading-archive-subresource.html:
+            * webarchive/loading/test-loading-archive.html:
+            * webarchive/loading/test-loading-top-archive.html:
+            * webarchive/loading/video-in-webarchive.html:
+
 2019-02-13  Alan Coon  <alanc...@apple.com>
 
         Cherry-pick r241319. rdar://problem/48015672

Modified: branches/safari-607-branch/LayoutTests/platform/mac/fast/loader/webarchive-encoding-respected.html (241507 => 241508)


--- branches/safari-607-branch/LayoutTests/platform/mac/fast/loader/webarchive-encoding-respected.html	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/LayoutTests/platform/mac/fast/loader/webarchive-encoding-respected.html	2019-02-14 08:34:43 UTC (rev 241508)
@@ -4,7 +4,7 @@
 	testRunner.dumpChildFramesAsText();
 }
 if (window.internals)
-    internals.setAlwaysAllowLocalWebarchive();
+    internals.setAlwaysAllowLocalWebarchive(true);
 </script>
 The webarchive in this iframe is utf-8 encoded and will only display properly if the webarchive's encoding is respected.<br>
 <iframe src=""

Modified: branches/safari-607-branch/LayoutTests/webarchive/loading/cache-expired-subresource.html (241507 => 241508)


--- branches/safari-607-branch/LayoutTests/webarchive/loading/cache-expired-subresource.html	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/LayoutTests/webarchive/loading/cache-expired-subresource.html	2019-02-14 08:34:43 UTC (rev 241508)
@@ -5,7 +5,7 @@
         testRunner.waitUntilDone();
     }
     if (window.internals)
-        internals.setAlwaysAllowLocalWebarchive();
+        internals.setAlwaysAllowLocalWebarchive(true);
     
     function frameLoaded() {
         if (window.testRunner)

Modified: branches/safari-607-branch/LayoutTests/webarchive/loading/_javascript_-url-iframe-crash.html (241507 => 241508)


--- branches/safari-607-branch/LayoutTests/webarchive/loading/_javascript_-url-iframe-crash.html	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/LayoutTests/webarchive/loading/_javascript_-url-iframe-crash.html	2019-02-14 08:34:43 UTC (rev 241508)
@@ -4,7 +4,8 @@
         testRunner.dumpAsText();
         testRunner.waitUntilDone();
     }
-    
+    if (window.internals)
+        internals.setAlwaysAllowLocalWebarchive(true);
     window.location="resources/_javascript_-url-iframe-crash.webarchive";
 </script>
 </html>

Modified: branches/safari-607-branch/LayoutTests/webarchive/loading/mainresource-null-mimetype-crash.html (241507 => 241508)


--- branches/safari-607-branch/LayoutTests/webarchive/loading/mainresource-null-mimetype-crash.html	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/LayoutTests/webarchive/loading/mainresource-null-mimetype-crash.html	2019-02-14 08:34:43 UTC (rev 241508)
@@ -5,7 +5,7 @@
         testRunner.waitUntilDone();
     }
     if (window.internals)
-        internals.setAlwaysAllowLocalWebarchive();
+        internals.setAlwaysAllowLocalWebarchive(true);
     _onload_ = function() {
         frame = document.createElement("iframe");
         frame.src = ""

Modified: branches/safari-607-branch/LayoutTests/webarchive/loading/missing-data.html (241507 => 241508)


--- branches/safari-607-branch/LayoutTests/webarchive/loading/missing-data.html	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/LayoutTests/webarchive/loading/missing-data.html	2019-02-14 08:34:43 UTC (rev 241508)
@@ -4,7 +4,7 @@
         testRunner.dumpAsText();
     }
     if (window.internals)
-        internals.setAlwaysAllowLocalWebarchive();
+        internals.setAlwaysAllowLocalWebarchive(true);
     _onload_ = function() {
         frame = document.createElement("iframe");
         frame.src = ""

Modified: branches/safari-607-branch/LayoutTests/webarchive/loading/object.html (241507 => 241508)


--- branches/safari-607-branch/LayoutTests/webarchive/loading/object.html	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/LayoutTests/webarchive/loading/object.html	2019-02-14 08:34:43 UTC (rev 241508)
@@ -3,6 +3,7 @@
     testRunner.dumpAsText();
     testRunner.waitUntilDone();
 }
-
+if (window.internals)
+    internals.setAlwaysAllowLocalWebarchive(true);
 window.location="resources/object.webarchive";
 </script>

Modified: branches/safari-607-branch/LayoutTests/webarchive/loading/test-loading-archive-subresource-null-mimetype.html (241507 => 241508)


--- branches/safari-607-branch/LayoutTests/webarchive/loading/test-loading-archive-subresource-null-mimetype.html	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/LayoutTests/webarchive/loading/test-loading-archive-subresource-null-mimetype.html	2019-02-14 08:34:43 UTC (rev 241508)
@@ -6,7 +6,7 @@
         testRunner.waitUntilDone();
     }
     if (window.internals)
-        internals.setAlwaysAllowLocalWebarchive();
+        internals.setAlwaysAllowLocalWebarchive(true);
     function frameLoaded() {
         if (window.testRunner)
             testRunner.notifyDone();

Modified: branches/safari-607-branch/LayoutTests/webarchive/loading/test-loading-archive-subresource.html (241507 => 241508)


--- branches/safari-607-branch/LayoutTests/webarchive/loading/test-loading-archive-subresource.html	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/LayoutTests/webarchive/loading/test-loading-archive-subresource.html	2019-02-14 08:34:43 UTC (rev 241508)
@@ -4,6 +4,8 @@
         testRunner.dumpAsText();
         testRunner.waitUntilDone();
     }
+    if (window.internals)
+        internals.setAlwaysAllowLocalWebarchive(false);
 
     function frameLoaded() {
         if (window.testRunner)

Modified: branches/safari-607-branch/LayoutTests/webarchive/loading/test-loading-archive.html (241507 => 241508)


--- branches/safari-607-branch/LayoutTests/webarchive/loading/test-loading-archive.html	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/LayoutTests/webarchive/loading/test-loading-archive.html	2019-02-14 08:34:43 UTC (rev 241508)
@@ -6,7 +6,7 @@
         testRunner.waitUntilDone();
     }
     if (window.internals)
-        internals.setAlwaysAllowLocalWebarchive();
+        internals.setAlwaysAllowLocalWebarchive(true);
     function frameLoaded() {
         if (window.testRunner)
             testRunner.notifyDone();

Modified: branches/safari-607-branch/LayoutTests/webarchive/loading/test-loading-top-archive.html (241507 => 241508)


--- branches/safari-607-branch/LayoutTests/webarchive/loading/test-loading-top-archive.html	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/LayoutTests/webarchive/loading/test-loading-top-archive.html	2019-02-14 08:34:43 UTC (rev 241508)
@@ -4,6 +4,8 @@
         testRunner.waitUntilDone();
         testRunner.dumpAsText();
     }
+    if (window.internals)
+        internals.setAlwaysAllowLocalWebarchive(true);
     window.location="resources/top.webarchive";
 </script>
 </html>

Modified: branches/safari-607-branch/LayoutTests/webarchive/loading/video-in-webarchive.html (241507 => 241508)


--- branches/safari-607-branch/LayoutTests/webarchive/loading/video-in-webarchive.html	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/LayoutTests/webarchive/loading/video-in-webarchive.html	2019-02-14 08:34:43 UTC (rev 241508)
@@ -3,5 +3,7 @@
     testRunner.dumpAsText();
     testRunner.waitUntilDone();
 }
+if (window.internals)
+    internals.setAlwaysAllowLocalWebarchive(true);
 window.location="resources/video-in-webarchive.webarchive";
 </script>

Modified: branches/safari-607-branch/Source/WebCore/ChangeLog (241507 => 241508)


--- branches/safari-607-branch/Source/WebCore/ChangeLog	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/Source/WebCore/ChangeLog	2019-02-14 08:34:43 UTC (rev 241508)
@@ -1,5 +1,134 @@
 2019-02-13  Babak Shafiei  <bshaf...@apple.com>
 
+        Cherry-pick r241480. rdar://problem/48065618
+
+    Further restricting webarchive loads
+    https://bugs.webkit.org/show_bug.cgi?id=194567
+    <rdar://problem/47610130>
+    
+    Reviewed by Youenn Fablet.
+    
+    Source/WebCore:
+    
+    This patch futher restricts main frame webarchive loads to the followings:
+    1) loaded by clients;
+    2) loaded by drag;
+    3) reloaded from any of the previous two.
+    
+    It moves setAlwaysAllowLocalWebarchive, which is used for testing only, from Document
+    to FrameLoader such that the option is remembered during redirections.
+    
+    Covered by API tests.
+    
+    * dom/Document.h:
+    (WebCore::Document::setAlwaysAllowLocalWebarchive): Deleted.
+    (WebCore::Document::alwaysAllowLocalWebarchive const): Deleted.
+    * loader/DocumentLoader.cpp:
+    (WebCore::DocumentLoader::disallowWebArchive const):
+    * loader/DocumentLoader.h:
+    (WebCore::DocumentLoader::setAllowsWebArchiveForMainFrame):
+    (WebCore::DocumentLoader::allowsWebArchiveForMainFrame):
+    * loader/FrameLoadRequest.h:
+    (WebCore::FrameLoadRequest::setIsRequestFromClientOrUserInput):
+    (WebCore::FrameLoadRequest::isRequestFromClientOrUserInput):
+    * loader/FrameLoader.cpp:
+    (WebCore::FrameLoader::load):
+    (WebCore::FrameLoader::reload):
+    * loader/FrameLoader.h:
+    (WebCore::FrameLoader::setAlwaysAllowLocalWebarchive):
+    (WebCore::FrameLoader::alwaysAllowLocalWebarchive const):
+    * page/DragController.cpp:
+    (WebCore::DragController::performDragOperation):
+    * testing/Internals.cpp:
+    (WebCore::Internals::setAlwaysAllowLocalWebarchive const):
+    * testing/Internals.h:
+    * testing/Internals.idl:
+    
+    Source/WebKit:
+    
+    * WebProcess/WebPage/WebPage.cpp:
+    (WebKit::WebPage::loadRequest):
+    Set a flag to indicate a load is started from clients.
+    
+    Tools:
+    
+    Besides adding API tests, this patch also enhances DragAndDropSimulator to allow
+    navigations on drop.
+    
+    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+    * TestWebKitAPI/Tests/mac/LoadWebArchive.mm: Added.
+    (-[TestLoadWebArchiveNavigationDelegate webView:didFinishNavigation:]):
+    (-[TestLoadWebArchiveNavigationDelegate webView:didFailProvisionalNavigation:withError:]):
+    (-[TestLoadWebArchiveNavigationDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]):
+    (TestWebKitAPI::TEST):
+    * TestWebKitAPI/Tests/mac/helloworld.webarchive: Added.
+    * TestWebKitAPI/Tests/mac/load-web-archive-1.html: Added.
+    * TestWebKitAPI/Tests/mac/load-web-archive-2.html: Added.
+    * TestWebKitAPI/cocoa/DragAndDropSimulator.h:
+    * TestWebKitAPI/mac/DragAndDropSimulatorMac.mm:
+    (-[DragAndDropSimulator initWithWebViewFrame:configuration:]):
+    (-[DragAndDropSimulator _webView:dragDestinationActionMaskForDraggingInfo:]):
+    
+    LayoutTests:
+    
+    * platform/mac/fast/loader/webarchive-encoding-respected.html:
+    * webarchive/loading/cache-expired-subresource.html:
+    * webarchive/loading/_javascript_-url-iframe-crash.html:
+    * webarchive/loading/mainresource-null-mimetype-crash.html:
+    * webarchive/loading/missing-data.html:
+    * webarchive/loading/object.html:
+    * webarchive/loading/test-loading-archive-subresource-null-mimetype.html:
+    * webarchive/loading/test-loading-archive-subresource.html:
+    * webarchive/loading/test-loading-archive.html:
+    * webarchive/loading/test-loading-top-archive.html:
+    * webarchive/loading/video-in-webarchive.html:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241480 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-02-12  Jiewen Tan  <jiewen_...@apple.com>
+
+            Further restricting webarchive loads
+            https://bugs.webkit.org/show_bug.cgi?id=194567
+            <rdar://problem/47610130>
+
+            Reviewed by Youenn Fablet.
+
+            This patch futher restricts main frame webarchive loads to the followings:
+            1) loaded by clients;
+            2) loaded by drag;
+            3) reloaded from any of the previous two.
+
+            It moves setAlwaysAllowLocalWebarchive, which is used for testing only, from Document
+            to FrameLoader such that the option is remembered during redirections.
+
+            Covered by API tests.
+
+            * dom/Document.h:
+            (WebCore::Document::setAlwaysAllowLocalWebarchive): Deleted.
+            (WebCore::Document::alwaysAllowLocalWebarchive const): Deleted.
+            * loader/DocumentLoader.cpp:
+            (WebCore::DocumentLoader::disallowWebArchive const):
+            * loader/DocumentLoader.h:
+            (WebCore::DocumentLoader::setAllowsWebArchiveForMainFrame):
+            (WebCore::DocumentLoader::allowsWebArchiveForMainFrame):
+            * loader/FrameLoadRequest.h:
+            (WebCore::FrameLoadRequest::setIsRequestFromClientOrUserInput):
+            (WebCore::FrameLoadRequest::isRequestFromClientOrUserInput):
+            * loader/FrameLoader.cpp:
+            (WebCore::FrameLoader::load):
+            (WebCore::FrameLoader::reload):
+            * loader/FrameLoader.h:
+            (WebCore::FrameLoader::setAlwaysAllowLocalWebarchive):
+            (WebCore::FrameLoader::alwaysAllowLocalWebarchive const):
+            * page/DragController.cpp:
+            (WebCore::DragController::performDragOperation):
+            * testing/Internals.cpp:
+            (WebCore::Internals::setAlwaysAllowLocalWebarchive const):
+            * testing/Internals.h:
+            * testing/Internals.idl:
+
+2019-02-13  Babak Shafiei  <bshaf...@apple.com>
+
         Cherry-pick r241479. rdar://problem/48065642
 
     Null-deref crash at SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged()

Modified: branches/safari-607-branch/Source/WebCore/dom/Document.h (241507 => 241508)


--- branches/safari-607-branch/Source/WebCore/dom/Document.h	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/Source/WebCore/dom/Document.h	2019-02-14 08:34:43 UTC (rev 241508)
@@ -1538,10 +1538,6 @@
 
     void frameWasDisconnectedFromOwner();
 
-    // Used in webarchive loading tests.
-    void setAlwaysAllowLocalWebarchive() { m_alwaysAllowLocalWebarchive = true; }
-    bool alwaysAllowLocalWebarchive() const { return m_alwaysAllowLocalWebarchive; }
-
 protected:
     enum ConstructionFlags { Synthesized = 1, NonRenderedPlaceholder = 1 << 1 };
     Document(Frame*, const URL&, unsigned = DefaultDocumentClass, unsigned constructionFlags = 0);
@@ -2085,7 +2081,6 @@
 
     bool m_isRunningUserScripts { false };
 
-    bool m_alwaysAllowLocalWebarchive { false };
 };
 
 Element* eventTargetElementForDocument(Document*);

Modified: branches/safari-607-branch/Source/WebCore/loader/DocumentLoader.cpp (241507 => 241508)


--- branches/safari-607-branch/Source/WebCore/loader/DocumentLoader.cpp	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/Source/WebCore/loader/DocumentLoader.cpp	2019-02-14 08:34:43 UTC (rev 241508)
@@ -854,8 +854,11 @@
     });
 }
 
-// Prevent web archives from loading if it is remote or it is not the main frame because they
-// can claim to be from any domain and thus avoid cross-domain security checks (4120255, 45524528).
+// Prevent web archives from loading if
+// 1) it is remote;
+// 2) it is not the main frame;
+// 3) it is not any of { loaded by clients; loaded by drag; reloaded from any of the previous two };
+// because they can claim to be from any domain and thus avoid cross-domain security checks (4120255, 45524528, 47610130).
 bool DocumentLoader::disallowWebArchive() const
 {
     using MIMETypeHashSet = HashSet<String, ASCIICaseInsensitiveHash>;
@@ -885,11 +888,11 @@
     if (!SchemeRegistry::shouldTreatURLSchemeAsLocal(m_request.url().protocol().toStringWithoutCopying()))
         return true;
 
-    if (!frame() || frame()->isMainFrame())
+    if (!frame() || (frame()->isMainFrame() && m_allowsWebArchiveForMainFrame))
         return false;
 
     // On purpose of maintaining existing tests.
-    if (!frame()->document() || frame()->document()->topDocument().alwaysAllowLocalWebarchive())
+    if (frame()->mainFrame().loader().alwaysAllowLocalWebarchive())
         return false;
     return true;
 }

Modified: branches/safari-607-branch/Source/WebCore/loader/DocumentLoader.h (241507 => 241508)


--- branches/safari-607-branch/Source/WebCore/loader/DocumentLoader.h	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/Source/WebCore/loader/DocumentLoader.h	2019-02-14 08:34:43 UTC (rev 241508)
@@ -339,7 +339,10 @@
 
     WEBCORE_EXPORT void setCustomHeaderFields(Vector<HTTPHeaderField>&& fields);
     const Vector<HTTPHeaderField>& customHeaderFields() { return m_customHeaderFields; }
-    
+
+    void setAllowsWebArchiveForMainFrame(bool allowsWebArchiveForMainFrame) { m_allowsWebArchiveForMainFrame = allowsWebArchiveForMainFrame; }
+    bool allowsWebArchiveForMainFrame() const { return m_allowsWebArchiveForMainFrame; }
+
 protected:
     WEBCORE_EXPORT DocumentLoader(const ResourceRequest&, const SubstituteData&);
 
@@ -561,6 +564,8 @@
 #ifndef NDEBUG
     bool m_hasEverBeenAttached { false };
 #endif
+
+    bool m_allowsWebArchiveForMainFrame { false };
 };
 
 inline void DocumentLoader::recordMemoryCacheLoadForFutureClientNotification(const ResourceRequest& request)

Modified: branches/safari-607-branch/Source/WebCore/loader/FrameLoadRequest.h (241507 => 241508)


--- branches/safari-607-branch/Source/WebCore/loader/FrameLoadRequest.h	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/Source/WebCore/loader/FrameLoadRequest.h	2019-02-14 08:34:43 UTC (rev 241508)
@@ -94,6 +94,9 @@
     bool isSystemPreview() const { return m_systemPreviewInfo.isSystemPreview; }
     const IntRect& systemPreviewRect() const { return m_systemPreviewInfo.systemPreviewRect; }
 
+    void setIsRequestFromClientOrUserInput() { m_isRequestFromClientOrUserInput = true; }
+    bool isRequestFromClientOrUserInput() const { return m_isRequestFromClientOrUserInput; }
+
 private:
     Ref<Document> m_requester;
     Ref<SecurityOrigin> m_requesterSecurityOrigin;
@@ -114,6 +117,7 @@
     AtomicString m_downloadAttribute;
     InitiatedByMainFrame m_initiatedByMainFrame { InitiatedByMainFrame::Unknown };
     SystemPreviewInfo m_systemPreviewInfo;
+    bool m_isRequestFromClientOrUserInput { false };
 };
 
 } // namespace WebCore

Modified: branches/safari-607-branch/Source/WebCore/loader/FrameLoader.cpp (241507 => 241508)


--- branches/safari-607-branch/Source/WebCore/loader/FrameLoader.cpp	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/Source/WebCore/loader/FrameLoader.cpp	2019-02-14 08:34:43 UTC (rev 241508)
@@ -1477,6 +1477,7 @@
         request.setSubstituteData(defaultSubstituteDataForURL(request.resourceRequest().url()));
 
     Ref<DocumentLoader> loader = m_client.createDocumentLoader(request.resourceRequest(), request.substituteData());
+    loader->setAllowsWebArchiveForMainFrame(request.isRequestFromClientOrUserInput());
     addSameSiteInfoToRequestIfNeeded(loader->request());
     applyShouldOpenExternalURLsPolicyToNewDocumentLoader(m_frame, loader, request);
 
@@ -1774,6 +1775,7 @@
     // Create a new document loader for the reload, this will become m_documentLoader eventually,
     // but first it has to be the "policy" document loader, and then the "provisional" document loader.
     Ref<DocumentLoader> loader = m_client.createDocumentLoader(initialRequest, defaultSubstituteDataForURL(initialRequest.url()));
+    loader->setAllowsWebArchiveForMainFrame(m_documentLoader->allowsWebArchiveForMainFrame());
     applyShouldOpenExternalURLsPolicyToNewDocumentLoader(m_frame, loader, InitiatedByMainFrame::Unknown, m_documentLoader->shouldOpenExternalURLsPolicyToPropagate());
 
     loader->setUserContentExtensionsEnabled(!options.contains(ReloadOption::DisableContentBlockers));

Modified: branches/safari-607-branch/Source/WebCore/loader/FrameLoader.h (241507 => 241508)


--- branches/safari-607-branch/Source/WebCore/loader/FrameLoader.h	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/Source/WebCore/loader/FrameLoader.h	2019-02-14 08:34:43 UTC (rev 241508)
@@ -317,6 +317,10 @@
     bool shouldSuppressTextInputFromEditing() const;
     bool isReloadingFromOrigin() const { return m_loadType == FrameLoadType::ReloadFromOrigin; }
 
+    // Used in webarchive loading tests.
+    void setAlwaysAllowLocalWebarchive(bool alwaysAllowLocalWebarchive) { m_alwaysAllowLocalWebarchive = alwaysAllowLocalWebarchive; }
+    bool alwaysAllowLocalWebarchive() const { return m_alwaysAllowLocalWebarchive; }
+
 private:
     enum FormSubmissionCacheLoadPolicy {
         MayAttemptCacheOnlyLoadForFormSubmissionItem,
@@ -484,6 +488,8 @@
 
     URL m_previousURL;
     RefPtr<HistoryItem> m_requestedHistoryItem;
+
+    bool m_alwaysAllowLocalWebarchive { false };
 };
 
 // This function is called by createWindow() in JSDOMWindowBase.cpp, for example, for

Modified: branches/safari-607-branch/Source/WebCore/page/DragController.cpp (241507 => 241508)


--- branches/safari-607-branch/Source/WebCore/page/DragController.cpp	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/Source/WebCore/page/DragController.cpp	2019-02-14 08:34:43 UTC (rev 241508)
@@ -284,7 +284,9 @@
         return false;
 
     m_client.willPerformDragDestinationAction(DragDestinationActionLoad, dragData);
-    m_page.mainFrame().loader().load(FrameLoadRequest(m_page.mainFrame(), { urlString }, shouldOpenExternalURLsPolicy));
+    FrameLoadRequest frameLoadRequest { m_page.mainFrame(), { urlString }, shouldOpenExternalURLsPolicy };
+    frameLoadRequest.setIsRequestFromClientOrUserInput();
+    m_page.mainFrame().loader().load(WTFMove(frameLoadRequest));
     return true;
 }
 

Modified: branches/safari-607-branch/Source/WebCore/testing/Internals.cpp (241507 => 241508)


--- branches/safari-607-branch/Source/WebCore/testing/Internals.cpp	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/Source/WebCore/testing/Internals.cpp	2019-02-14 08:34:43 UTC (rev 241508)
@@ -4917,12 +4917,12 @@
     });
 }
 
-void Internals::setAlwaysAllowLocalWebarchive() const
+void Internals::setAlwaysAllowLocalWebarchive(bool alwaysAllowLocalWebarchive)
 {
-    auto* document = contextDocument();
-    if (!document)
+    auto* localFrame = frame();
+    if (!localFrame)
         return;
-    document->setAlwaysAllowLocalWebarchive();
+    localFrame->loader().setAlwaysAllowLocalWebarchive(alwaysAllowLocalWebarchive);
 }
 
 } // namespace WebCore

Modified: branches/safari-607-branch/Source/WebCore/testing/Internals.h (241507 => 241508)


--- branches/safari-607-branch/Source/WebCore/testing/Internals.h	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/Source/WebCore/testing/Internals.h	2019-02-14 08:34:43 UTC (rev 241508)
@@ -793,7 +793,7 @@
     };
     Vector<CookieData> getCookies() const;
 
-    void setAlwaysAllowLocalWebarchive() const;
+    void setAlwaysAllowLocalWebarchive(bool);
 
 private:
     explicit Internals(Document&);

Modified: branches/safari-607-branch/Source/WebCore/testing/Internals.idl (241507 => 241508)


--- branches/safari-607-branch/Source/WebCore/testing/Internals.idl	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/Source/WebCore/testing/Internals.idl	2019-02-14 08:34:43 UTC (rev 241508)
@@ -732,5 +732,5 @@
 
     sequence<CookieData> getCookies();
 
-    void setAlwaysAllowLocalWebarchive();
+    void setAlwaysAllowLocalWebarchive(boolean alwaysAllowLocalWebarchive);
 };

Modified: branches/safari-607-branch/Source/WebKit/ChangeLog (241507 => 241508)


--- branches/safari-607-branch/Source/WebKit/ChangeLog	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/Source/WebKit/ChangeLog	2019-02-14 08:34:43 UTC (rev 241508)
@@ -1,5 +1,104 @@
 2019-02-13  Babak Shafiei  <bshaf...@apple.com>
 
+        Cherry-pick r241480. rdar://problem/48065618
+
+    Further restricting webarchive loads
+    https://bugs.webkit.org/show_bug.cgi?id=194567
+    <rdar://problem/47610130>
+    
+    Reviewed by Youenn Fablet.
+    
+    Source/WebCore:
+    
+    This patch futher restricts main frame webarchive loads to the followings:
+    1) loaded by clients;
+    2) loaded by drag;
+    3) reloaded from any of the previous two.
+    
+    It moves setAlwaysAllowLocalWebarchive, which is used for testing only, from Document
+    to FrameLoader such that the option is remembered during redirections.
+    
+    Covered by API tests.
+    
+    * dom/Document.h:
+    (WebCore::Document::setAlwaysAllowLocalWebarchive): Deleted.
+    (WebCore::Document::alwaysAllowLocalWebarchive const): Deleted.
+    * loader/DocumentLoader.cpp:
+    (WebCore::DocumentLoader::disallowWebArchive const):
+    * loader/DocumentLoader.h:
+    (WebCore::DocumentLoader::setAllowsWebArchiveForMainFrame):
+    (WebCore::DocumentLoader::allowsWebArchiveForMainFrame):
+    * loader/FrameLoadRequest.h:
+    (WebCore::FrameLoadRequest::setIsRequestFromClientOrUserInput):
+    (WebCore::FrameLoadRequest::isRequestFromClientOrUserInput):
+    * loader/FrameLoader.cpp:
+    (WebCore::FrameLoader::load):
+    (WebCore::FrameLoader::reload):
+    * loader/FrameLoader.h:
+    (WebCore::FrameLoader::setAlwaysAllowLocalWebarchive):
+    (WebCore::FrameLoader::alwaysAllowLocalWebarchive const):
+    * page/DragController.cpp:
+    (WebCore::DragController::performDragOperation):
+    * testing/Internals.cpp:
+    (WebCore::Internals::setAlwaysAllowLocalWebarchive const):
+    * testing/Internals.h:
+    * testing/Internals.idl:
+    
+    Source/WebKit:
+    
+    * WebProcess/WebPage/WebPage.cpp:
+    (WebKit::WebPage::loadRequest):
+    Set a flag to indicate a load is started from clients.
+    
+    Tools:
+    
+    Besides adding API tests, this patch also enhances DragAndDropSimulator to allow
+    navigations on drop.
+    
+    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+    * TestWebKitAPI/Tests/mac/LoadWebArchive.mm: Added.
+    (-[TestLoadWebArchiveNavigationDelegate webView:didFinishNavigation:]):
+    (-[TestLoadWebArchiveNavigationDelegate webView:didFailProvisionalNavigation:withError:]):
+    (-[TestLoadWebArchiveNavigationDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]):
+    (TestWebKitAPI::TEST):
+    * TestWebKitAPI/Tests/mac/helloworld.webarchive: Added.
+    * TestWebKitAPI/Tests/mac/load-web-archive-1.html: Added.
+    * TestWebKitAPI/Tests/mac/load-web-archive-2.html: Added.
+    * TestWebKitAPI/cocoa/DragAndDropSimulator.h:
+    * TestWebKitAPI/mac/DragAndDropSimulatorMac.mm:
+    (-[DragAndDropSimulator initWithWebViewFrame:configuration:]):
+    (-[DragAndDropSimulator _webView:dragDestinationActionMaskForDraggingInfo:]):
+    
+    LayoutTests:
+    
+    * platform/mac/fast/loader/webarchive-encoding-respected.html:
+    * webarchive/loading/cache-expired-subresource.html:
+    * webarchive/loading/_javascript_-url-iframe-crash.html:
+    * webarchive/loading/mainresource-null-mimetype-crash.html:
+    * webarchive/loading/missing-data.html:
+    * webarchive/loading/object.html:
+    * webarchive/loading/test-loading-archive-subresource-null-mimetype.html:
+    * webarchive/loading/test-loading-archive-subresource.html:
+    * webarchive/loading/test-loading-archive.html:
+    * webarchive/loading/test-loading-top-archive.html:
+    * webarchive/loading/video-in-webarchive.html:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241480 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-02-12  Jiewen Tan  <jiewen_...@apple.com>
+
+            Further restricting webarchive loads
+            https://bugs.webkit.org/show_bug.cgi?id=194567
+            <rdar://problem/47610130>
+
+            Reviewed by Youenn Fablet.
+
+            * WebProcess/WebPage/WebPage.cpp:
+            (WebKit::WebPage::loadRequest):
+            Set a flag to indicate a load is started from clients.
+
+2019-02-13  Babak Shafiei  <bshaf...@apple.com>
+
         Cherry-pick r241453. rdar://problem/48065612
 
     Fix -Wformat warning from r241401

Modified: branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp (241507 => 241508)


--- branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-02-14 08:34:43 UTC (rev 241508)
@@ -1388,6 +1388,7 @@
     frameLoadRequest.setLockHistory(loadParameters.lockHistory);
     frameLoadRequest.setlockBackForwardList(loadParameters.lockBackForwardList);
     frameLoadRequest.setClientRedirectSourceForHistory(loadParameters.clientRedirectSourceForHistory);
+    frameLoadRequest.setIsRequestFromClientOrUserInput();
 
     corePage()->userInputBridge().loadRequest(WTFMove(frameLoadRequest));
 

Modified: branches/safari-607-branch/Tools/ChangeLog (241507 => 241508)


--- branches/safari-607-branch/Tools/ChangeLog	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/Tools/ChangeLog	2019-02-14 08:34:43 UTC (rev 241508)
@@ -1,5 +1,117 @@
 2019-02-13  Babak Shafiei  <bshaf...@apple.com>
 
+        Cherry-pick r241480. rdar://problem/48065618
+
+    Further restricting webarchive loads
+    https://bugs.webkit.org/show_bug.cgi?id=194567
+    <rdar://problem/47610130>
+    
+    Reviewed by Youenn Fablet.
+    
+    Source/WebCore:
+    
+    This patch futher restricts main frame webarchive loads to the followings:
+    1) loaded by clients;
+    2) loaded by drag;
+    3) reloaded from any of the previous two.
+    
+    It moves setAlwaysAllowLocalWebarchive, which is used for testing only, from Document
+    to FrameLoader such that the option is remembered during redirections.
+    
+    Covered by API tests.
+    
+    * dom/Document.h:
+    (WebCore::Document::setAlwaysAllowLocalWebarchive): Deleted.
+    (WebCore::Document::alwaysAllowLocalWebarchive const): Deleted.
+    * loader/DocumentLoader.cpp:
+    (WebCore::DocumentLoader::disallowWebArchive const):
+    * loader/DocumentLoader.h:
+    (WebCore::DocumentLoader::setAllowsWebArchiveForMainFrame):
+    (WebCore::DocumentLoader::allowsWebArchiveForMainFrame):
+    * loader/FrameLoadRequest.h:
+    (WebCore::FrameLoadRequest::setIsRequestFromClientOrUserInput):
+    (WebCore::FrameLoadRequest::isRequestFromClientOrUserInput):
+    * loader/FrameLoader.cpp:
+    (WebCore::FrameLoader::load):
+    (WebCore::FrameLoader::reload):
+    * loader/FrameLoader.h:
+    (WebCore::FrameLoader::setAlwaysAllowLocalWebarchive):
+    (WebCore::FrameLoader::alwaysAllowLocalWebarchive const):
+    * page/DragController.cpp:
+    (WebCore::DragController::performDragOperation):
+    * testing/Internals.cpp:
+    (WebCore::Internals::setAlwaysAllowLocalWebarchive const):
+    * testing/Internals.h:
+    * testing/Internals.idl:
+    
+    Source/WebKit:
+    
+    * WebProcess/WebPage/WebPage.cpp:
+    (WebKit::WebPage::loadRequest):
+    Set a flag to indicate a load is started from clients.
+    
+    Tools:
+    
+    Besides adding API tests, this patch also enhances DragAndDropSimulator to allow
+    navigations on drop.
+    
+    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+    * TestWebKitAPI/Tests/mac/LoadWebArchive.mm: Added.
+    (-[TestLoadWebArchiveNavigationDelegate webView:didFinishNavigation:]):
+    (-[TestLoadWebArchiveNavigationDelegate webView:didFailProvisionalNavigation:withError:]):
+    (-[TestLoadWebArchiveNavigationDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]):
+    (TestWebKitAPI::TEST):
+    * TestWebKitAPI/Tests/mac/helloworld.webarchive: Added.
+    * TestWebKitAPI/Tests/mac/load-web-archive-1.html: Added.
+    * TestWebKitAPI/Tests/mac/load-web-archive-2.html: Added.
+    * TestWebKitAPI/cocoa/DragAndDropSimulator.h:
+    * TestWebKitAPI/mac/DragAndDropSimulatorMac.mm:
+    (-[DragAndDropSimulator initWithWebViewFrame:configuration:]):
+    (-[DragAndDropSimulator _webView:dragDestinationActionMaskForDraggingInfo:]):
+    
+    LayoutTests:
+    
+    * platform/mac/fast/loader/webarchive-encoding-respected.html:
+    * webarchive/loading/cache-expired-subresource.html:
+    * webarchive/loading/_javascript_-url-iframe-crash.html:
+    * webarchive/loading/mainresource-null-mimetype-crash.html:
+    * webarchive/loading/missing-data.html:
+    * webarchive/loading/object.html:
+    * webarchive/loading/test-loading-archive-subresource-null-mimetype.html:
+    * webarchive/loading/test-loading-archive-subresource.html:
+    * webarchive/loading/test-loading-archive.html:
+    * webarchive/loading/test-loading-top-archive.html:
+    * webarchive/loading/video-in-webarchive.html:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241480 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-02-12  Jiewen Tan  <jiewen_...@apple.com>
+
+            Further restricting webarchive loads
+            https://bugs.webkit.org/show_bug.cgi?id=194567
+            <rdar://problem/47610130>
+
+            Reviewed by Youenn Fablet.
+
+            Besides adding API tests, this patch also enhances DragAndDropSimulator to allow
+            navigations on drop.
+
+            * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+            * TestWebKitAPI/Tests/mac/LoadWebArchive.mm: Added.
+            (-[TestLoadWebArchiveNavigationDelegate webView:didFinishNavigation:]):
+            (-[TestLoadWebArchiveNavigationDelegate webView:didFailProvisionalNavigation:withError:]):
+            (-[TestLoadWebArchiveNavigationDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]):
+            (TestWebKitAPI::TEST):
+            * TestWebKitAPI/Tests/mac/helloworld.webarchive: Added.
+            * TestWebKitAPI/Tests/mac/load-web-archive-1.html: Added.
+            * TestWebKitAPI/Tests/mac/load-web-archive-2.html: Added.
+            * TestWebKitAPI/cocoa/DragAndDropSimulator.h:
+            * TestWebKitAPI/mac/DragAndDropSimulatorMac.mm:
+            (-[DragAndDropSimulator initWithWebViewFrame:configuration:]):
+            (-[DragAndDropSimulator _webView:dragDestinationActionMaskForDraggingInfo:]):
+
+2019-02-13  Babak Shafiei  <bshaf...@apple.com>
+
         Cherry-pick r241336. rdar://problem/48065621
 
     Regression(PSON) MESSAGE_CHECK() hit under WebPageProxy::didFailProvisionalLoadForFrameShared()

Modified: branches/safari-607-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (241507 => 241508)


--- branches/safari-607-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2019-02-14 08:34:43 UTC (rev 241508)
@@ -273,6 +273,9 @@
 		57303BC9200824D300355965 /* CBORValueTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57303BAC2006C56000355965 /* CBORValueTest.cpp */; };
 		57303BCA20082C0100355965 /* CBORWriterTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57303BAB2006C55400355965 /* CBORWriterTest.cpp */; };
 		57303BCB2008376500355965 /* CBORReaderTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57303BC220071E2200355965 /* CBORReaderTest.cpp */; };
+		573255A522139BC700396AE8 /* helloworld.webarchive in Copy Resources */ = {isa = PBXBuildFile; fileRef = 573255A422139B9000396AE8 /* helloworld.webarchive */; };
+		573255A622139BC700396AE8 /* load-web-archive-1.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 573255A222139B8F00396AE8 /* load-web-archive-1.html */; };
+		573255A722139BC700396AE8 /* load-web-archive-2.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 573255A322139B9000396AE8 /* load-web-archive-2.html */; };
 		574F55D2204D47F0002948C6 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 574F55D0204D471C002948C6 /* Security.framework */; };
 		57599E211F07191900A3FB8C /* IndexedDBStructuredCloneBackwardCompatibility.mm in Sources */ = {isa = PBXBuildFile; fileRef = 57599E201F07191700A3FB8C /* IndexedDBStructuredCloneBackwardCompatibility.mm */; };
 		57599E271F071AA000A3FB8C /* IndexedDBStructuredCloneBackwardCompatibility.sqlite3 in Copy Resources */ = {isa = PBXBuildFile; fileRef = 57599E241F07192C00A3FB8C /* IndexedDBStructuredCloneBackwardCompatibility.sqlite3 */; };
@@ -280,6 +283,7 @@
 		57599E2A1F071AA000A3FB8C /* IndexedDBStructuredCloneBackwardCompatibilityRead.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 57599E251F07192C00A3FB8C /* IndexedDBStructuredCloneBackwardCompatibilityRead.html */; };
 		57599E2B1F071AA000A3FB8C /* IndexedDBStructuredCloneBackwardCompatibilityWrite.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 57599E231F07192C00A3FB8C /* IndexedDBStructuredCloneBackwardCompatibilityWrite.html */; };
 		5769C50B1D9B0002000847FB /* SerializedCryptoKeyWrap.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5769C50A1D9B0001000847FB /* SerializedCryptoKeyWrap.mm */; };
+		5778D05622110A2600899E3B /* LoadWebArchive.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5778D05522110A2600899E3B /* LoadWebArchive.mm */; };
 		578CBD67204FB2C80083B9F2 /* LocalAuthentication.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 578CBD66204FB2C70083B9F2 /* LocalAuthentication.framework */; };
 		57901FB11CAF142D00ED64F9 /* LoadInvalidURLRequest.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 57901FB01CAF141C00ED64F9 /* LoadInvalidURLRequest.html */; };
 		579651E7216BFDED006EBFE5 /* FidoHidMessageTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 579651E6216BFD53006EBFE5 /* FidoHidMessageTest.cpp */; };
@@ -1105,6 +1109,7 @@
 				467C565321B5ED130057516D /* GetSessionCookie.html in Copy Resources */,
 				074994421EA5034B000DA44E /* getUserMedia.html in Copy Resources */,
 				F46A095B1ED8A6E600D4AA55 /* gif-and-file-input.html in Copy Resources */,
+				573255A522139BC700396AE8 /* helloworld.webarchive in Copy Resources */,
 				9B4F8FA7159D52DD002D9F94 /* HTMLCollectionNamedItem.html in Copy Resources */,
 				9B26FCCA159D16DE00CC3765 /* HTMLFormCollectionNamedItem.html in Copy Resources */,
 				BCBD3737125ABBEB00D2C29F /* icon.png in Copy Resources */,
@@ -1171,6 +1176,8 @@
 				8361F1781E610B4E00759B25 /* link-with-download-attribute-with-slashes.html in Copy Resources */,
 				8349D3C41DB9728E004A9F65 /* link-with-download-attribute.html in Copy Resources */,
 				378E64791632707400B6C676 /* link-with-title.html in Copy Resources */,
+				573255A622139BC700396AE8 /* load-web-archive-1.html in Copy Resources */,
+				573255A722139BC700396AE8 /* load-web-archive-2.html in Copy Resources */,
 				57901FB11CAF142D00ED64F9 /* LoadInvalidURLRequest.html in Copy Resources */,
 				8C10AF98206467920018FD90 /* localstorage-empty-string-value.html in Copy Resources */,
 				51E6A8961D2F1CA700C004B6 /* LocalStorageClear.html in Copy Resources */,
@@ -1643,6 +1650,9 @@
 		57303BAB2006C55400355965 /* CBORWriterTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CBORWriterTest.cpp; sourceTree = "<group>"; };
 		57303BAC2006C56000355965 /* CBORValueTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CBORValueTest.cpp; sourceTree = "<group>"; };
 		57303BC220071E2200355965 /* CBORReaderTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CBORReaderTest.cpp; sourceTree = "<group>"; };
+		573255A222139B8F00396AE8 /* load-web-archive-1.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "load-web-archive-1.html"; sourceTree = "<group>"; };
+		573255A322139B9000396AE8 /* load-web-archive-2.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "load-web-archive-2.html"; sourceTree = "<group>"; };
+		573255A422139B9000396AE8 /* helloworld.webarchive */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; path = helloworld.webarchive; sourceTree = "<group>"; };
 		5735F0251F3A4EA6000EE801 /* TestWebKitAPI-iOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "TestWebKitAPI-iOS.entitlements"; sourceTree = "<group>"; };
 		574F55D0204D471C002948C6 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
 		57599E201F07191700A3FB8C /* IndexedDBStructuredCloneBackwardCompatibility.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IndexedDBStructuredCloneBackwardCompatibility.mm; sourceTree = "<group>"; };
@@ -1651,6 +1661,7 @@
 		57599E251F07192C00A3FB8C /* IndexedDBStructuredCloneBackwardCompatibilityRead.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = IndexedDBStructuredCloneBackwardCompatibilityRead.html; sourceTree = "<group>"; };
 		57599E261F07192C00A3FB8C /* IndexedDBStructuredCloneBackwardCompatibility.sqlite3-shm */ = {isa = PBXFileReference; lastKnownFileType = file; path = "IndexedDBStructuredCloneBackwardCompatibility.sqlite3-shm"; sourceTree = "<group>"; };
 		5769C50A1D9B0001000847FB /* SerializedCryptoKeyWrap.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SerializedCryptoKeyWrap.mm; sourceTree = "<group>"; };
+		5778D05522110A2600899E3B /* LoadWebArchive.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = LoadWebArchive.mm; sourceTree = "<group>"; };
 		578CBD66204FB2C70083B9F2 /* LocalAuthentication.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LocalAuthentication.framework; path = System/Library/Frameworks/LocalAuthentication.framework; sourceTree = SDKROOT; };
 		57901FAC1CAF12C200ED64F9 /* LoadInvalidURLRequest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LoadInvalidURLRequest.mm; sourceTree = "<group>"; };
 		57901FAE1CAF137100ED64F9 /* LoadInvalidURLRequest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LoadInvalidURLRequest.mm; sourceTree = "<group>"; };
@@ -3433,6 +3444,7 @@
 				F4BFA68C1E4AD08000154298 /* LegacyDragAndDropTests.mm */,
 				7A7B0E7E1EAFE454006AB8AE /* LimitTitleSize.mm */,
 				57901FAE1CAF137100ED64F9 /* LoadInvalidURLRequest.mm */,
+				5778D05522110A2600899E3B /* LoadWebArchive.mm */,
 				CDA315961ED53651009F60D3 /* MediaPlaybackSleepAssertion.mm */,
 				E1220D9F155B25480013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.mm */,
 				517E7DFB15110EA600D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.mm */,
@@ -3486,6 +3498,7 @@
 				1A7E8B351812093600AEB74A /* FragmentNavigation.html */,
 				F47728981E4AE3AD007ABF6A /* full-page-contenteditable.html */,
 				CDBFCC421A9FF44800A7B691 /* FullscreenZoomInitialFrame.html */,
+				573255A422139B9000396AE8 /* helloworld.webarchive */,
 				9B4F8FA6159D52CA002D9F94 /* HTMLCollectionNamedItem.html */,
 				9B26FCB4159D15E700CC3765 /* HTMLFormCollectionNamedItem.html */,
 				57F56A5B1C7F8A4000F31D7E /* IsNavigationActionTrusted.html */,
@@ -3492,6 +3505,8 @@
 				C2CF975816CEC69E0054E99D /* JSContextBackForwardCache1.html */,
 				C2CF975916CEC69E0054E99D /* JSContextBackForwardCache2.html */,
 				F42DA5151D8CEFDB00336F40 /* large-input-field-focus-onload.html */,
+				573255A222139B8F00396AE8 /* load-web-archive-1.html */,
+				573255A322139B9000396AE8 /* load-web-archive-2.html */,
 				57901FB01CAF141C00ED64F9 /* LoadInvalidURLRequest.html */,
 				CDA315991ED540A5009F60D3 /* MediaPlaybackSleepAssertion.html */,
 				E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */,
@@ -4088,6 +4103,7 @@
 				5C838F7F1DB04F900082858F /* LoadInvalidURLRequest.mm in Sources */,
 				7C83E0C01D0A652700FEBCF3 /* LoadInvalidURLRequest.mm in Sources */,
 				7CCE7F001A411AE600447C4C /* LoadPageOnCrash.cpp in Sources */,
+				5778D05622110A2600899E3B /* LoadWebArchive.mm in Sources */,
 				51E6A8941D2F1C0A00C004B6 /* LocalStorageClear.mm in Sources */,
 				CA38459620AE17A900990D3B /* LocalStorageDatabaseTracker.mm in Sources */,
 				46C519DA1D355AB200DAA51A /* LocalStorageNullEntries.mm in Sources */,

Added: branches/safari-607-branch/Tools/TestWebKitAPI/Tests/mac/LoadWebArchive.mm (0 => 241508)


--- branches/safari-607-branch/Tools/TestWebKitAPI/Tests/mac/LoadWebArchive.mm	                        (rev 0)
+++ branches/safari-607-branch/Tools/TestWebKitAPI/Tests/mac/LoadWebArchive.mm	2019-02-14 08:34:43 UTC (rev 241508)
@@ -0,0 +1,210 @@
+/*
+ * 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.
+ */
+
+#import "config.h"
+
+#import "DragAndDropSimulator.h"
+#import "PlatformUtilities.h"
+#import "Test.h"
+#import "TestWKWebView.h"
+#import <WebKit/WKDragDestinationAction.h>
+#import <WebKit/WKNavigationPrivate.h>
+#import <WebKit/WKWebView.h>
+#import <WebKit/WKWebViewPrivate.h>
+#import <wtf/RetainPtr.h>
+#import <wtf/text/WTFString.h>
+
+#if WK_API_ENABLED
+
+static bool navigationComplete = false;
+static bool navigationFail = false;
+static String finalURL;
+static id<WKNavigationDelegate> gDelegate;
+static RetainPtr<WKWebView> newWebView;
+
+@interface TestLoadWebArchiveNavigationDelegate : NSObject <WKNavigationDelegate, WKUIDelegate>
+@end
+
+@implementation TestLoadWebArchiveNavigationDelegate
+
+- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
+{
+    navigationComplete = true;
+    finalURL = navigation._request.URL.lastPathComponent;
+}
+
+- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error
+{
+    navigationFail = true;
+    finalURL = navigation._request.URL.lastPathComponent;
+}
+
+- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures
+{
+    newWebView = adoptNS([[WKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:configuration]);
+    [newWebView setNavigationDelegate:gDelegate];
+
+    return newWebView.get();
+}
+
+@end
+
+namespace TestWebKitAPI {
+
+TEST(LoadWebArchive, FailNavigation1)
+{
+    // Using `document.location.href = '';`.
+    RetainPtr<NSURL> testURL = [[NSBundle mainBundle] URLForResource:@"load-web-archive-1" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
+
+    auto webView = adoptNS([[WKWebView alloc] init]);
+    auto delegate = adoptNS([[TestLoadWebArchiveNavigationDelegate alloc] init]);
+    [webView setNavigationDelegate:delegate.get()];
+
+    navigationFail = false;
+    [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]];
+    Util::run(&navigationFail);
+
+    EXPECT_WK_STREQ(finalURL, "helloworld.webarchive");
+}
+
+TEST(LoadWebArchive, FailNavigation2)
+{
+    // Using `window.open('helloworld.webarchive');`.
+    RetainPtr<NSURL> testURL = [[NSBundle mainBundle] URLForResource:@"load-web-archive-2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
+
+    auto delegate = adoptNS([[TestLoadWebArchiveNavigationDelegate alloc] init]);
+    gDelegate = delegate.get();
+
+    auto webView = adoptNS([[WKWebView alloc] init]);
+    [webView setNavigationDelegate:delegate.get()];
+    [webView setUIDelegate:delegate.get()];
+
+    navigationFail = false;
+    [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]];
+    Util::run(&navigationFail);
+
+    EXPECT_WK_STREQ(finalURL, "helloworld.webarchive");
+}
+
+TEST(LoadWebArchive, ClientNavigationSucceed)
+{
+    RetainPtr<NSURL> testURL = [[NSBundle mainBundle] URLForResource:@"helloworld" withExtension:@"webarchive" subdirectory:@"TestWebKitAPI.resources"];
+
+    auto webView = adoptNS([[WKWebView alloc] init]);
+    auto delegate = adoptNS([[TestLoadWebArchiveNavigationDelegate alloc] init]);
+    [webView setNavigationDelegate:delegate.get()];
+
+    navigationComplete = false;
+    [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]];
+    Util::run(&navigationComplete);
+
+    EXPECT_WK_STREQ(finalURL, "helloworld.webarchive");
+}
+
+TEST(LoadWebArchive, ClientNavigationReload)
+{
+    RetainPtr<NSURL> testURL = [[NSBundle mainBundle] URLForResource:@"helloworld" withExtension:@"webarchive" subdirectory:@"TestWebKitAPI.resources"];
+
+    auto webView = adoptNS([[WKWebView alloc] init]);
+    auto delegate = adoptNS([[TestLoadWebArchiveNavigationDelegate alloc] init]);
+    [webView setNavigationDelegate:delegate.get()];
+
+    navigationComplete = false;
+    [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]];
+    Util::run(&navigationComplete);
+    EXPECT_WK_STREQ(finalURL, "helloworld.webarchive");
+
+    navigationComplete = false;
+    [webView reload];
+    Util::run(&navigationComplete);
+    EXPECT_WK_STREQ(finalURL, "");
+}
+
+TEST(LoadWebArchive, DragNavigationSucceed)
+{
+    RetainPtr<NSURL> webArchiveURL = [[NSBundle mainBundle] URLForResource:@"helloworld" withExtension:@"webarchive" subdirectory:@"TestWebKitAPI.resources"];
+    RetainPtr<NSURL> simpleURL = [[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
+
+    NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
+    [pasteboard clearContents];
+    [pasteboard declareTypes:@[NSFilenamesPboardType] owner:nil];
+    [pasteboard setPropertyList:@[webArchiveURL.get().path] forType:NSFilenamesPboardType];
+
+    auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebViewFrame:CGRectMake(0, 0, 320, 500)]);
+    [simulator setExternalDragPasteboard:pasteboard];
+    [simulator setDragDestinationAction:WKDragDestinationActionAny];
+
+    auto webView = [simulator webView];
+    auto delegate = adoptNS([[TestLoadWebArchiveNavigationDelegate alloc] init]);
+    [webView setNavigationDelegate:delegate.get()];
+
+    navigationComplete = false;
+    [webView loadRequest:[NSURLRequest requestWithURL:simpleURL.get()]];
+    Util::run(&navigationComplete);
+    EXPECT_WK_STREQ(finalURL, "simple.html");
+
+    navigationComplete = false;
+    [simulator runFrom:CGPointMake(0, 0) to:CGPointMake(50, 50)];
+    Util::run(&navigationComplete);
+    EXPECT_WK_STREQ(finalURL, "helloworld.webarchive");
+}
+
+TEST(LoadWebArchive, DragNavigationReload)
+{
+    RetainPtr<NSURL> webArchiveURL = [[NSBundle mainBundle] URLForResource:@"helloworld" withExtension:@"webarchive" subdirectory:@"TestWebKitAPI.resources"];
+    RetainPtr<NSURL> simpleURL = [[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
+
+    NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
+    [pasteboard clearContents];
+    [pasteboard declareTypes:@[NSFilenamesPboardType] owner:nil];
+    [pasteboard setPropertyList:@[webArchiveURL.get().path] forType:NSFilenamesPboardType];
+
+    auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebViewFrame:CGRectMake(0, 0, 320, 500)]);
+    [simulator setExternalDragPasteboard:pasteboard];
+    [simulator setDragDestinationAction:WKDragDestinationActionAny];
+
+    auto webView = [simulator webView];
+    auto delegate = adoptNS([[TestLoadWebArchiveNavigationDelegate alloc] init]);
+    [webView setNavigationDelegate:delegate.get()];
+
+    navigationComplete = false;
+    [webView loadRequest:[NSURLRequest requestWithURL:simpleURL.get()]];
+    Util::run(&navigationComplete);
+    EXPECT_WK_STREQ(finalURL, "simple.html");
+
+    navigationComplete = false;
+    [simulator runFrom:CGPointMake(0, 0) to:CGPointMake(50, 50)];
+    Util::run(&navigationComplete);
+    EXPECT_WK_STREQ(finalURL, "helloworld.webarchive");
+
+    navigationComplete = false;
+    [webView reload];
+    Util::run(&navigationComplete);
+    EXPECT_WK_STREQ(finalURL, "");
+}
+
+} // namespace TestWebKitAPI
+
+#endif // WK_API_ENABLED

Added: branches/safari-607-branch/Tools/TestWebKitAPI/Tests/mac/helloworld.webarchive (0 => 241508)


--- branches/safari-607-branch/Tools/TestWebKitAPI/Tests/mac/helloworld.webarchive	                        (rev 0)
+++ branches/safari-607-branch/Tools/TestWebKitAPI/Tests/mac/helloworld.webarchive	2019-02-14 08:34:43 UTC (rev 241508)
@@ -0,0 +1,4 @@
+bplist00\xD1_WebMainResource\xD4	
+_WebResourceTextEncodingName_WebResourceData^WebResourceURL_WebResourceMIMETypeUUTF-8O)<HTML><BODY>
+Hello, World!
+</BODY></HTML>_+file:///Users/andersca/test/helloworld.htmlYtext/html&DVe{\x81\xAD\xDB\xE5
\ No newline at end of file

Added: branches/safari-607-branch/Tools/TestWebKitAPI/Tests/mac/load-web-archive-1.html (0 => 241508)


--- branches/safari-607-branch/Tools/TestWebKitAPI/Tests/mac/load-web-archive-1.html	                        (rev 0)
+++ branches/safari-607-branch/Tools/TestWebKitAPI/Tests/mac/load-web-archive-1.html	2019-02-14 08:34:43 UTC (rev 241508)
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+<script>
+    document.location.href = '';
+</script>
+</html>

Added: branches/safari-607-branch/Tools/TestWebKitAPI/Tests/mac/load-web-archive-2.html (0 => 241508)


--- branches/safari-607-branch/Tools/TestWebKitAPI/Tests/mac/load-web-archive-2.html	                        (rev 0)
+++ branches/safari-607-branch/Tools/TestWebKitAPI/Tests/mac/load-web-archive-2.html	2019-02-14 08:34:43 UTC (rev 241508)
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+<script>
+    window.open('helloworld.webarchive');
+</script>
+</html>

Modified: branches/safari-607-branch/Tools/TestWebKitAPI/cocoa/DragAndDropSimulator.h (241507 => 241508)


--- branches/safari-607-branch/Tools/TestWebKitAPI/cocoa/DragAndDropSimulator.h	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/Tools/TestWebKitAPI/cocoa/DragAndDropSimulator.h	2019-02-14 08:34:43 UTC (rev 241508)
@@ -84,6 +84,7 @@
 @property (nonatomic, readonly) NSArray<_WKAttachment *> *insertedAttachments;
 @property (nonatomic, readonly) NSArray<_WKAttachment *> *removedAttachments;
 @property (nonatomic, readonly) TestWKWebView *webView;
+@property (nonatomic) WKDragDestinationAction dragDestinationAction;
 
 #if PLATFORM(IOS_FAMILY)
 

Modified: branches/safari-607-branch/Tools/TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm (241507 => 241508)


--- branches/safari-607-branch/Tools/TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/Tools/TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm	2019-02-14 08:34:43 UTC (rev 241508)
@@ -332,6 +332,7 @@
 
 - (instancetype)initWithWebViewFrame:(CGRect)frame configuration:(WKWebViewConfiguration *)configuration
 {
+    self.dragDestinationAction = WKDragDestinationActionAny & ~WKDragDestinationActionLoad;
     if (configuration)
         return [self initWithWebView:[[[TestWKWebView alloc] initWithFrame:frame configuration:configuration] autorelease]];
 
@@ -768,6 +769,11 @@
     [_removedAttachments addObject:attachment];
 }
 
+- (WKDragDestinationAction)_webView:(WKWebView *)webView dragDestinationActionMaskForDraggingInfo:(id)draggingInfo
+{
+    return self.dragDestinationAction;
+}
+
 #pragma mark - _WKInputDelegate
 
 - (BOOL)_webView:(WKWebView *)webView focusShouldStartInputSession:(id <_WKFocusedElementInfo>)info

Modified: branches/safari-607-branch/Tools/TestWebKitAPI/mac/DragAndDropSimulatorMac.mm (241507 => 241508)


--- branches/safari-607-branch/Tools/TestWebKitAPI/mac/DragAndDropSimulatorMac.mm	2019-02-14 08:34:34 UTC (rev 241507)
+++ branches/safari-607-branch/Tools/TestWebKitAPI/mac/DragAndDropSimulatorMac.mm	2019-02-14 08:34:43 UTC (rev 241508)
@@ -122,6 +122,7 @@
         _webView = adoptNS([[DragAndDropTestWKWebView alloc] initWithFrame:frame configuration:configuration ?: [[[WKWebViewConfiguration alloc] init] autorelease] simulator:self]);
         _filePromiseDestinationURLs = adoptNS([NSMutableArray new]);
         [_webView setUIDelegate:self];
+        self.dragDestinationAction = WKDragDestinationActionAny & ~WKDragDestinationActionLoad;
     }
     return self;
 }
@@ -470,6 +471,11 @@
     _doneWaitingForDrop = true;
 }
 
+- (WKDragDestinationAction)_webView:(WKWebView *)webView dragDestinationActionMaskForDraggingInfo:(id)draggingInfo
+{
+    return self.dragDestinationAction;
+}
+
 @end
 
 #endif // ENABLE(DRAG_SUPPORT) && PLATFORM(MAC) && WK_API_ENABLED
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to